BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

importing type library

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX)
View previous topic :: View next topic  
Author Message
Luca Brasi
Guest





PostPosted: Thu Mar 17, 2005 4:48 pm    Post subject: importing type library Reply with quote



I'm a newcomer in COM programming, so maybe I ask stupid question (sorry).

I have imported my type library from a COM dll created with vc++ 7. In my
header file I have the following comment:

// COCLASS DEFAULT INTERFACE CREATOR
// CoClass : magicdemoclass
// Interface: TCOMImagicdemoclass
// **************************************

with the interface Imagicdemoclass defined like this:

interface Imagicdemoclass : public IDispatch
{
public:
// [1] property MWFlags
virtual HRESULT STDMETHODCALLTYPE get_MWFlags(Mwcomutil_tlb::IMWFlags**
ppvFlags/*[out,retval]*/) = 0;
// [1] property MWFlags
virtual HRESULT STDMETHODCALLTYPE set_MWFlags(Mwcomutil_tlb::IMWFlags*
ppvFlags/*[in]*/) = 0;
// [2] Method mymagic
virtual HRESULT STDMETHODCALLTYPE mymagic(long nargout/*[in]*/, VARIANT*
y/*[in,out]*/, VARIANT x/*[in]*/) = 0;

}


I access to the COM server with the following lines:

#include "magicdemo_TLB.cpp"
................

VARIANT* y;
VARIANT size;
size.vt=VT_INT;
size.intVal=10;

TCOMImagicdemoclass myobject ;
myobject = Magicdemo_tlb::Comagicdemoclass::Create();
myobject->mymagic(1,y,size);

But I always get an access violation error in module "ole32.dll", at the
line:

hr = ::CoCreateInstance(rclsid, 0, CLSCTX_SERVER, riid, ppv);

in borland file utilcls.h

The question is: in general must we use the default interface and coclass?
Is my code correct or can anybody explain my errors?

I really appreciate your help! Thanks very much!


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.