Newbie: Client calling a server but what CLSID
I am doing a tutorial on COM. I have created a server object (beepServer)
with ATL. I want to call that object from a client. My question is where do
I get the CLSID and the IID from? The tutorial has the following code for
the client:
const IID IID_IBeepObj =
{0x89547ECD,0x36F1,0x11D2,{0x85,0xDA,0xD7,0x43,0xB2,0x32,0x69,0x28}};
const CLSID CLSID_BeepObj =
{0x89547ECE,0x36F1,0x11D2,{0x85,0xDA,0xD7,0x43,0xB2,0x32,0x69,0x28}};
int main(int argc, char* argv[])
{
HRESULT hr; // COM error code
IBeepObj *IBeep; // pointer to interface
hr = CoInitialize(0); // initialize COM
if (SUCCEEDED(hr)) // macro to check for success
{
hr = CoCreateInstance(
CLSID_BeepObj, // COM class id
NULL, // outer unknown
CLSCTX_INPROC_SERVER, // server INFO
IID_IBeepObj, // interface id
(void**)&IBeep ); // pointer to interface
if (SUCCEEDED(hr))
{
hr = IBeep->Beep(800); // call method
hr = IBeep->Release(); // release interface
}
}
CoUninitialize(); // close COM
return 0;
}
What I don't understand is where did they get the values for CLSID_BeepObj
and IID_IBeepObj. If I look in the registry I find BeepServer.BeepObj has a
CLSID of
{E3829EAD-F1BC-4ECF-B14B-687D3EC2A63D}
I think that when it compiled on my machine it would have generated a
different CLSID to what the author's had, but the format is completely
different.
I know it is probably in the manual somewhere but I can't find it.