2 Email : <lmathieson@optusnet.com.au>
4 This is prelimanary stuff - the controls need extra methods and events etc,
5 feel free to email with suggestions &/or patches.
7 Tested with wxWindows 2.3.2.
8 Built with MS Visual C++ 6.0 & DevStudio
9 Minor use of templates and STL
11 -----------------------------------------------------------
12 This sample illustrates using wxActiveX and wxIEHtmlWin too:
13 1. Host an arbitrary ActiveX control
14 2. Specifically host the MSHTML Control
19 wxActiveX is used to host and siplay any activeX control, all the wxWindows developer
20 needs to know is either the ProgID or CLSID of the control in question.
37 wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
38 - Creates a activeX control identified by clsid
40 wxFrame *frame = new wxFrame(this, -1, "test");
41 wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser);
43 wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
44 - Creates a activeX control identified by progId
46 wxFrame *frame = new wxFrame(this, -1, "test");
47 wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar");
50 wxActiveX::~wxActiveX();
51 - Destroys the control
52 - disconnects all connection points
54 HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink);
55 - Connects a event sink. Connections are automaticlly diconnected in the destructor
57 FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol);
58 hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events);
59 if (! SUCCEEDED(hret))
67 wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control.
77 - EVT_MSHTML_BEFORENAVIGATE2
79 * event.Veto() to cancel
80 Generated before an attempt to browse a new url
82 - EVT_MSHTML_NEWWINDOW2
83 * event.Veto() to cancel
84 Generated when the control is asked create a new window (e.g a popup)
86 - EVT_MSHTML_DOCUMENTCOMPLETE
88 Generated after the document has finished loading
90 - EVT_MSHTML_PROGRESSCHANGE
91 * event.m_long1 = progress so far
92 * event.m_long2 = max range of progress
94 - EVT_MSHTML_STATUSTEXTCHANGE
95 * status = event.m_text1
97 - EVT_MSHTML_TITLECHANGE
98 * title = event.m_text1
102 wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
103 - Constructs and initialises the MSHTML control
104 - LoadUrl("about:blank") is called
106 wxIEHtmlWin::~wxIEHtmlWin();
107 - destroys the control
109 void wxIEHtmlWin::LoadUrl(const wxString&);
110 - Attempts to browse to the url, the control uses its internal (MS)
113 bool wxIEHtmlWin::LoadString(wxString html);
114 - Load the passed HTML string
116 bool wxIEHtmlWin::LoadStream(istream *strm);
117 - load the passed HTML stream. The control takes ownership of
118 the pointer, deleting when finished.
120 void wxIEHtmlWin::SetCharset(wxString charset);
121 - Sets the charset of the loaded document
123 void wxIEHtmlWin::SetEditMode(bool seton);
125 NOTE: This does work, but is bare bones - we need more events exposed before
126 this is usable as an HTML editor.
128 bool wxIEHtmlWin::GetEditMode();
129 - Returns the edit mode setting
131 wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false);
132 - Returns the currently selected text (plain or HTML text)
134 wxString GetText(bool asHTML = false);
135 - Returns the body text (plain or HTML text)
138 Email : <lmathieson@optusnet.com.au>