CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    May 2005
    Posts
    10

    Question about COM QueryInterface

    Before my question I explain my situation.

    Situation:
    I have a microsoft dll that I wish to use from my mingw C++ project. The dll is a microsoft COM creature. Means the following:

    1) I have an IDL (Interface Description Language) file which is a text file describing all the interfaces found inside the dll.
    2) All the interfaces are inherited from IUnknown.
    3) The IDL file tells me the IID (some identification) of every interface and also the names and parameters of all the functions found inside the dll

    Here is how I try to make use of the dll:

    1. I initialize the COM with "hr = CoInitialize();" So far so good.
    2. I load the dll with "hdll = LoadLibrary("litgen.dll"); No problem.
    3. Now to some real work:
    Code:
         typedef HRESULT (*CreateWriterFType)(IUnknown**);
         CreateWriterFType CreateWriter;
         CreateWriter = (CreateWriterFType)GetProcAddress( hdll, "CreateWriter" );
         hr = CreateWriter( &pUnkLitWriter );
    which also compiles and executes nicely.
    4. In order to eventually use the functions in the dll I should load some interface with QueryInterface... like this :
    Code:
         hr = pUnkLitWriter->QueryInterface( IID_ILITWriter, &pLitWriter );
    but here is the trouble. In my code the IID_ILITWriter is just placeholder without real value. It's type is REFIID, but this tells me nothing. I can see that it defines the COM interface that I wish to load but how can I initialize it?

    So the QUESTION:
    How do I get valid REFIID parameter for QueryInterface function??
    Last edited by scicatur; May 16th, 2005 at 10:44 AM.

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

Featured