scicatur
May 16th, 2005, 10:41 AM
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:
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 :
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??
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:
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 :
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??