Link to home
Start Free TrialLog in
Avatar of trillo
trillo

asked on

VB Migration

The problem: Using an ActiveX dll

In VB, in the references dialog y can select any registered dll such as 'Olemsg.dll'.
Then in any piece of code i can instantiate objects exposed in the library using a simple and cheap Dim statement e.g.:
Dim obj As MAPI.Recipient
'or
Set obj = CreateObject("MAPI.Recipient")


How do I do the same in C++? I'm using VC++ 6.0

Thanks
Avatar of vbk_bgm
vbk_bgm

You need to derive a class from the type library (View -> ClassWizard and Add new class from the type lib). Select the classes that you need for your app.
Then you could create object using CreateDispatch and delete using ReleaseDispatch
For instance, if you are creating for Excel Automation.
m_Excel.CreateDispatch(Excel.Application);
where mExcel is of type Application in this case.
ASKER CERTIFIED SOLUTION
Avatar of MUpchu777
MUpchu777

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial