Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing IWebBrowser2 to ATL/COM Method C++

Status
Not open for further replies.

slimtimbodin

Programmer
Nov 16, 2001
11
I wrote an activex dll in VB and I made a reference to the MS Internet Controls (SHDOCVW.DLL) and I wrote a sub that receives a WebBrowser control from the client:

Public Sub Test(TheBrowser As WebBrowser)

After compiling the project I can use the OLECOM viewer and see the Type Library is:

interface _MyClass : IDispatch {
[id(0x60030000)]
HRESULT Test([in, out] IWebBrowser2** TheBrowser);

Everything is working great with my VB DLL. I can Navigate the browser and do everything I need to do.

Now I have to rewrite the DLL in VC++.

I have created an ATL COM project/DLL/No MFC and I added a new ATL simple object.

At the top of the .h for the class I added:

#import "C:\WINNT\system32\shdocvw.dll" named_guids raw_interfaces_only

In the .idl I moved my interface down into the library and I have a line:

importlib("C:\WINNT\system32\shdocvw.dll");

I compile and then I add my method:
Method Name: Test
Parameter: [in, out] IWebBrowser2** TheBrowser

I attempt to compile again and I get:

Error MIDL2020 : error generating type library : AddImplType failed : IWebBrowserApp

Am I approaching this all wrong? Am I able to pass the interface pointer of the WebBrowser into the DLL or do I have to do something completely different?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top