COM Server Registration

L

Lamefif

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
 
G

Guest

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.

Microsoft COM programming is off-topic in this group you should try a
one of the microsoft.public.* groups (I think there is one specific for
COM programming, but I do not know which).
 
V

Victor Bazarov

Lamefif said:
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.

"Com" is beyond the scope of this newsgroup. Please post to the forum
with "OLE" or "Windows" such in its name.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top