Posted By: sheefo
COM Interface - 08/15/07 13:32
I have a working COM DLL, how do I include it in LiteC? Is there a function to include it or a special directory to put it?

typedef struct _IObject1Vtbl
{
// IUnknown methods
long __stdcall QueryInterface(long, long riid, void *ppvObject);
long __stdcall AddRef(long);
long __stdcall Release(long);
// IObject1 methods
long __stdcall get_GetANum(long, long* pVal);
} IObject1Vtbl;
typedef interface _IObject1 { IObject1Vtbl *lpVtbl; } IObject1;
#include <litec.h>
#include <com.h>
IFoo *pIFoo;
int WinMain()
{
HRESULT hr;
hr = CoInitialize(NULL);
GUID CLSID_MyObject;
IID IID_IFoo;
// I DONT KNOW WHAT TO PUT HERE, NO MATTER WHAT I PUT IT DOESN'T WORK:
IIDFromStr("{????????-????-????-????-????????????}",&CLSID_MyObject); // "{8D72F083-9925-4DCE-94E9-CDBD933DDACB}"???
IIDFromStr("{67E3E462-F3C0-48A6-8758-161CEE83D547}",&IID_IFoo);
if (hr!=S_OK)
{
printf("CoInitialize Failed: %x\n\n", hr);
return 0;
}
else
{
printf("CoInitialize succeeded\n");
}
// THIS RETURNS ERROR CODE 80040154
hr = CoCreateInstance(&CLSID_MyObject, NULL, CLSCTX_ALL,&IID_IFoo, &pIFoo);
if (hr!=S_OK)
{
printf("CoCreateInstance Failed: %x\n\n", hr);
}
else
{
printf("CoCreateInstance succeeded\n");
}
CoUninitialize();
}


