Archived

This topic is now archived and is closed to further replies.

siaspete

ActiveX DLL

Recommended Posts

Hello, I have some code in an ActiveX DLL I want to use from a C++ Win32 Console App written in Visual C++ 6, but I''ve no idea how. I''ve got the DLL registered using regsvr32.exe, but I''m not sure where to go from there. Google and MSDN search aren''t working to well for me because I don''t know the terminology of what I''m trying to do. Does anyone know where I can go from here? The docs for the DLL I''m trying to use are at this URL: http://www.devincook.com/GOLDParser/doc/engine/activex/index.htm - Pete
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book

Share this post


Link to post
Share on other sites
Hi, I know you said you are trying to use your control with a console app, but this might be a start:
MSDN Doc

I have only ever dealt with ActiveX controls in frames and dialog boxes, but I don't see why it would be a stretch to use one with a regular console app. You could just add it to a dialog in your resource editor, but just never show the dialog. Then you could let ATL do all the AX init stuff and interact with the control. Also, here is a recent thread where someone else was trying to get an AX control going using only Win32 and C++:
GDNet Thread

He was using it in a dialog, but a lot of the concepts still would hold for a console app.


[edited by - CodeMunkie on August 13, 2003 4:47:17 PM]

Share this post


Link to post
Share on other sites
Thanks for your help, and the links.

As far as I know, I''m not dealing with a control but a type library. I spent a long time yesterday trying to get some use of it, and came up with this (which still has problems)...

* Register the DLL using regsvr32.exe, which succeeds.

regsvr32 "GOLD Parser Engine.dll"

* Use the contents of the DLL as a type library by using Visual C++''s #import directive.

#import "GOLD Parser Engine.dll"

I can do that and it doesn''t produce an error, but the sample C++ code in the GOLD docs doesn''t compile.


GOLDParserEngine::_GOLDParserPtr parser;
CoInitialize (NULL);
HRESULT hr = parser.CreateInstance (__uuidof (GOLDParserEngine::_GOLDParser));


The problems I have with this are the following:

* I can''t create an instance of _GOLDParser directly because it has unimplemented pure virtual methods required by COM.
* CreateInstance like above fails because the class isn''t registered, even though I registered the DLL.
* Looking at the contents of the type library using the Visual C++ OLE View tool doesn''t work because it says the library isn''t registered.


Why you shouldn''t use iostream.h - ever! | A Good free online C++ book

Share this post


Link to post
Share on other sites