Results 1 to 2 of 2

Thread: Need help with using COM dll in C++

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Need help with using COM dll in C++

    Can someone show me how to use COM dll in C++? Here is my code so far:

    Code:
    #import "C:\\ComObject.dll"
    #include "stdafx.h"
    #include <objbase.h>
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
    	CLSID  Clsid;
    	HRESULT a = ::CoInitialize(NULL);
    	HRESULT b = ::CLSIDFromProgID(L"ComObject.ComMethod.1", &Clsid);
    	
    	IComObject * p;
    	HRESULT c = ::CoCreateInstance(Clsid, NULL, CLSCTX_ALL, IID_IUnknown, (LPVOID*)&p);
    	
    	return 0;
    }
    I keep getting an "IComObject is an undeclared identifier." I used OleView and it shows that IComObject is an interface of that COM object. Any ideas?

  2. #2
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Re: Need help with using COM dll in C++

    You're in the wrong place, mate.

    Go to a C++ forum.
    "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein

    It's turtles! And it's all the way down

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