COM Server Registration
hi, im reading this book on com and need some help with the examples.
i have compiled the server, and to register it i have
written a .reg file as instructed.
-----.reg file--
REGEDIT
HKEY_CLASSES_ROOT\CarInProcServer.CoCar\CLSID = {6F0BA608-CDA6-44ba-
AC80-F2B31B8A496C}
HKEY_CLASSES_ROOT\CLSID\{6F0BA608-CDA6-44ba-AC80-F2B31B8A496C} =
CarInProcServer.CoCar
\InprocServer32 = C:\Documents and Settings\Leonardo\My Documents
\Visual Studio 2005\Projects\CarInProcServer\Debug\CarInProcServer.dll
------
when run the file above works, it adds to registry the server.
hr = CoGetClassObject(CLSID_CoCar, CLSCTX_INPROC_SERVER,
NULL, IID_IClassFactory, (void**)&pCF);
here however CovetClassObject returns a "Class not registered" and i
get access violation at run time.
--client---
int main()
{
CoInitialize(NULL);
HRESULT hr = NULL;
IClassFactory* pCF = NULL;
ICreateCar* pICreateCar = NULL;
IStats* pStats = NULL;
IEngine* pEngine = NULL;
// Get the class factory pointer of CoCar.
hr = CoGetClassObject(CLSID_CoCar, CLSCTX_INPROC_SERVER,
NULL, IID_IClassFactory, (void**)&pCF);
// Make a CoCar & get ICreateCar.
hr = pCF->CreateInstance(NULL, IID_ICreateCar,
(void**)&pICreateCar);
.........
thanks