How can I call a VB ActiveX dll from VC++ 
Author Message
 How can I call a VB ActiveX dll from VC++

I have tried to call my VB ActiveX dll from VC++

Below is what I have tried:

/*Global Scope*/
const IID IID_IclsOutlook;

DEFINE_GUID(IID_IclsOutlook,
    0x4601081CL, 0x6E79, 0x48D9, 0xAA, 0x0F, 0x68, 0x4B, 0x58, 0xE3, 0x5D,
0xA5);

void CVBCallerDlg::OnButton1()
{
    CLSID clsid;
    void *ppv;

     HRESULT hr;
     hr=CoInitialize(NULL);

     hr= CoCreateInstance(clsid,
          NULL,
          CLSCTX_INPROC_SERVER,
          IID_IclsOutlook,
          (void **)&ppv);

 ppv->Initialize();

Quote:
}

When I build the code I get this error:
error C2227: left of '->Initialize' must point to class/struct/union

If I remove the line of code I don't receive any error when I build the
project.

The Initialize() function exists in my ActiveX.dll, but I don't even get any
class members up when I type ppv->, so I know there is something wrong.

I'm a newbie to VC and COM.

Hope that someone can help me,

regards,
Stian



Thu, 02 Jan 2003 03:00:00 GMT  
 How can I call a VB ActiveX dll from VC++

I also have this line of code just before the call to CoCreateInstance.

CLSIDFromProgID(L"prjOutLook.clsOutlook", &clsid);



Quote:
> I have tried to call my VB ActiveX dll from VC++

> Below is what I have tried:

> /*Global Scope*/
> const IID IID_IclsOutlook;

> DEFINE_GUID(IID_IclsOutlook,
>     0x4601081CL, 0x6E79, 0x48D9, 0xAA, 0x0F, 0x68, 0x4B, 0x58, 0xE3, 0x5D,
> 0xA5);

> void CVBCallerDlg::OnButton1()
> {
>     CLSID clsid;
>     void *ppv;

>      HRESULT hr;
>      hr=CoInitialize(NULL);

>      hr= CoCreateInstance(clsid,
>           NULL,
>           CLSCTX_INPROC_SERVER,
>           IID_IclsOutlook,
>           (void **)&ppv);

>  ppv->Initialize();

> }

> When I build the code I get this error:
> error C2227: left of '->Initialize' must point to class/struct/union

> If I remove the line of code I don't receive any error when I build the
> project.

> The Initialize() function exists in my ActiveX.dll, but I don't even get
any
> class members up when I type ppv->, so I know there is something wrong.

> I'm a newbie to VC and COM.

> Hope that someone can help me,

> regards,
> Stian



Thu, 02 Jan 2003 03:00:00 GMT  
 How can I call a VB ActiveX dll from VC++
Try changing your declaration of ppv to:
IclsOutlook *ppv;

-Jonathan



Quote:
> I have tried to call my VB ActiveX dll from VC++

> Below is what I have tried:

> /*Global Scope*/
> const IID IID_IclsOutlook;

> DEFINE_GUID(IID_IclsOutlook,
>     0x4601081CL, 0x6E79, 0x48D9, 0xAA, 0x0F, 0x68, 0x4B, 0x58, 0xE3, 0x5D,
> 0xA5);

> void CVBCallerDlg::OnButton1()
> {
>     CLSID clsid;
>     void *ppv;

>      HRESULT hr;
>      hr=CoInitialize(NULL);

>      hr= CoCreateInstance(clsid,
>           NULL,
>           CLSCTX_INPROC_SERVER,
>           IID_IclsOutlook,
>           (void **)&ppv);

>  ppv->Initialize();

> }

> When I build the code I get this error:
> error C2227: left of '->Initialize' must point to class/struct/union

> If I remove the line of code I don't receive any error when I build the
> project.

> The Initialize() function exists in my ActiveX.dll, but I don't even get
any
> class members up when I type ppv->, so I know there is something wrong.

> I'm a newbie to VC and COM.

> Hope that someone can help me,

> regards,
> Stian



Thu, 02 Jan 2003 03:00:00 GMT  
 How can I call a VB ActiveX dll from VC++

Quote:
> I have tried to call my VB ActiveX dll from VC++

I felt your pain, as I tried to do this same thing all day today  ;)
I finally came across the following article in MSDN which cleared it
all up for me:

Q194873

This article shows how to accomplish the task both using AND not
using MFC.

Thanks to Emanoil Stanescu for his 3/9/2000 post on deja.com that
finally guided me to this MSDN article:

(http://x61.deja.com/getdoc.xp?
AN=595313340&CONTEXT=963899046.1884225542&hitnum=4)

HTH,

Dave

Sent via Deja.com http://www.deja.com/
Before you buy.



Sat, 04 Jan 2003 03:00:00 GMT  
 How can I call a VB ActiveX dll from VC++

It worked! The article just saved me for hours and hours of "fun".

Thank you Dave,

Stian

Quote:

> > I have tried to call my VB ActiveX dll from VC++

> I felt your pain, as I tried to do this same thing all day today  ;)
> I finally came across the following article in MSDN which cleared it
> all up for me:

> Q194873

> This article shows how to accomplish the task both using AND not
> using MFC.

> Thanks to Emanoil Stanescu for his 3/9/2000 post on deja.com that
> finally guided me to this MSDN article:

> (http://x61.deja.com/getdoc.xp?
> AN=595313340&CONTEXT=963899046.1884225542&hitnum=4)

> HTH,

> Dave

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sat, 04 Jan 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How do you call VB ActiveX DLL functions from VC

2. call vb ActiveX DLL in VC++

3. How to call a VB ActiveX DLL from VC++

4. call vb ActiveX DLL in VC++

5. Creating c dll calling vb ActiveX dll

6. Problem using VB 5 activex DLL in a VC++ activex control

7. How to call VB functions in VB dlls from VC++

8. Atl NT service calling VB ActiveX dll had problem when clean-up

9. Call/Use VB ActiveX Dll in Visual C

10. calling vb activex dll

11. Calling a VB ActiveX DLL

12. Help - Calling ActiveX DLL function from VB and C++ returns different values

 

 
Powered by phpBB® Forum Software