COM Questioin - return interface from VC++ 
Author Message
 COM Questioin - return interface from VC++

Hello,

Could someone please tell me why VB Crashes when I do the following:

IDL code segment:

interface IControl : IUnknown {
    HRESULT doBuilding( [in] IBuilding *p_IBuilding );
    HRESULT getBuilding( [out,retval] IBuilding** ppv );

Quote:
};

C++ code segment:

HRESULT _stdcall XControl::getBuilding( IBuilding **ppv ) {
 MessageBox( 0, "getBuilding()", "XControl", MB_OK );
 return QueryInterface( IID_IBuilding, (void**)ppv );

Quote:
}

VB code segment:

    Dim v_Control As AFOComServerInterfaces.IControl
    Dim v_Building As AFOComServerInterfaces.IBuilding

    Set v_Control = CreateObject("AFO.ComServer")
    Set v_Building1 = v_Control.getBuilding

*boom*

thanks..

Gerald Kelly..



Sat, 15 May 2004 09:35:19 GMT  
 COM Questioin - return interface from VC++
    use [out, retval] LPDISPATCH *lpdp

    vb uses idispatch for all objects.

Quote:
> Hello,

> Could someone please tell me why VB Crashes when I do the following:

> IDL code segment:

> interface IControl : IUnknown {
>     HRESULT doBuilding( [in] IBuilding *p_IBuilding );
>     HRESULT getBuilding( [out,retval] IBuilding** ppv );
> };

> C++ code segment:

> HRESULT _stdcall XControl::getBuilding( IBuilding **ppv ) {
>  MessageBox( 0, "getBuilding()", "XControl", MB_OK );
>  return QueryInterface( IID_IBuilding, (void**)ppv );
> }

> VB code segment:

>     Dim v_Control As AFOComServerInterfaces.IControl
>     Dim v_Building As AFOComServerInterfaces.IBuilding

>     Set v_Control = CreateObject("AFO.ComServer")
>     Set v_Building1 = v_Control.getBuilding

> *boom*

> thanks..

> Gerald Kelly..



Tue, 18 May 2004 13:55:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VC++ to VB Interface (COM / ATL / ?)

2. Returning a value from a VC++ COM to VB

3. Returning a value from a VC++ COM

4. COM Questioin

5. Interfacing Vc++ Dll to Visual Basic

6. VC-COM from VB/VC/Script

7. Newbiw COM Question - COM Interface?

8. Confused by COM terminology: interfaces, coclasses, and COM classes

9. COM Interfaces, VB6 COM Servers, Automation Clients

10. Pls Help with VB==>VC Interface (Newbie!)

11. Getting 16bit VB4.0 programs to interface with 32bit VC++5.0 DLLs

12. VC++ vs VB in User Interfaces

 

 
Powered by phpBB® Forum Software