Hello all,
I have source code in plain C++ that creates an instance
of, and activates, the MS Web Browser control. However, its
seems to be a daunting task to do the same in MASM.
A Class is needed to instantate the Browser using
"CoCreateInstance", right ? Secondly, where do ASM programmers get a "this" pointer?
Thanks for any pointers (no pun intended)
Xtreme
Actually I was just trying to do the same thing, I beleive you'll have to use a Web browser ActiveX control (mshtml.dll I think) but I don't have much experience with COM (yet) so I haven't tried further. I found some things at msdn about the control.
Thomas
Oh boy, are you trying to open a can of worms.
To host a visual COM object (.ocx) you have to impliment a ton of interfaces not limited to:
IOleInPlaceFrame
IOleInPlaceWindow
IOleClientSite
IAdviseSink
IOleInPlaceSite
And no doubt some persistance interfaces too.
The only documentation you will find will be in C. Perhaps best is "Inside Ole" (complete book free on MSDN). The only site I found of someone looking to impliment a site is "The Makings Of An OCX Container" at: http://users.neca.com/vmis/final1.htm
Basically, you are trying to code a very fast host app with some very slow hog servers. It makes more sense to me to go the other way, make fast servers for hogs, (IE, asm components for VB). Examples of the latter and other good things at:
here.is/ComInAsm
Oh, BTW, since you asked...
The following gives you a reference to the system Shell Link object. One gets THIS like so:
.data
sIID_IShellLink TEXTEQU <{0000214EEH, 00000H, 00000H, \
{0C0H, 000H, 000H, 000H, 000H, 000H, 000H, 046H}}>
sCLSID_ShellLink TEXTEQU <{000021401H, 00000H, 00000H, \
{0C0H, 000H, 000H, 000H, 000H, 000H, 000H, 046H}}>
CLSID_ShellLink GUID sCLSID_ShellLink
IID_IShellLink GUID sIID_IShellLink
psl DWORD 0 ; holder for THIS
.code
invoke CoCreateInstance, ADDR CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER,
ADDR IID_IShellLink, ADDR psl
What could be simpler? ;-)
(hint: see my shell link tut)
This message was edited by Ernie, on 2/3/2001 4:38:52 PMErnie,
The "this" pointer I use in C++ (no MFC or ATL) is a
pointer to a *Class* that contains all of the code I use
to create and manipulate the WebBrowser control.
The last param of CoCreateInstance is used elsewhere:
// Create and WebBrowser control that we are hosting.
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IOleObject, (LPVOID*)&_pIOleObject);
// Set the Web Browser Control's site (this)
_pIOleObject->SetClientSite(this);
How do I do the above in asm? ;)
Xtreme
This message was edited by xtreme, on 2/3/2001 6:27:35 PM
This thread is moving to the COM section.