Results 1 to 5 of 5

Thread: Creating Instance

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130

    Creating Instance

    Goodday everybody...

    I'm not sure this is the right forum to put in....

    I've a COM DLL created in VB and I'm linking it from an EXE created in VC++. I created a COM object of 'Connection' in VC++, which is the equivalent of 'adodc.Connection' in VB.

    Following is the code on how I created my object:

    _ConnectionPtr m_pConnect;
    HRESULT hr = m_pConnect.CreatedInstance(__uuidof(Connection));

    after that I pass a reference of this object to the COM DLL using the class function available from the COM DLL.

    Now the problem is, it seems that the 'm_pConnect' object has not been allocated a memory space. In other words, the instance of the object has not been created because the following error occur when I try to use the 'm_pConnect' object:

    'Object variable or with block variable not set'

    Of course, I can overcome this by creating an instance of the object using 'New' in VB. But I do not want to do that. So, is there any code or function that I can use in VC++ to overcome this problem?

    Thanks...

  2. #2
    jim mcnamara
    Guest
    Do you know about CoInitialize?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    more or less... yes...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    so, what do i do next?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    Please... anybody...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width