|
Hello,
I want to create an Apartment threaded compoent server which will be used by the main thread client.How do i go about doing this?Any tips will be of help!1
Best Regards,
R Acharya
|
|
|
|
|
Hi,
I don't understand what problems do you have... To create an Apartment threaded component just select the Attributes page of the ATL Object Wizard Properties and make sure that Threading Model is set to Apartment. It's a default value, so usually you don't have to change anything.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
HI
I was wondering how a Client can see if a COM server that belongs to him exists in the registry. If an server exists I would like to add an item in the Client's menu.
Thank you for your time.
|
|
|
|
|
First you need to know either the CLSID or the ProgID of the server. If you know the CLSID then convert the CLSID to a string using StringFromCLSID. Then attempt to open the following registry key:
HKEY_CLASSES_ROOT\CLSID\"Your server's CLSID as a string"
If the key exists then the server has been installed on this machine.
If you have the ProgID, you can use CLSIDFromProgID() to get the CLSID and then proceed as indicated above.
The other option, is to use CoCreateInstance() to see if you can actually create the object and then shut it down. However, that might affect performance of your app unacceptably.
|
|
|
|
|
Call CoGetClassObject() and test to see if it fails with the REGDB_E_CLASSNOTREG error:
IClassFactory* pCF = NULL;
HRESULT hResult = CoGetClassObject(CLSID_TheObject, NULL,
CLSCTX_WHATEVER_YOU_WANT_TO_USE, (void**)&pCF);
if (FAILED(hResult))
{
if (hResult == REGDB_E_CLASSNOTREG)
{
// the server's not registered properly...
}
}
|
|
|
|
|
Hi,
I'm writing an add-in in Visual C++. I'd like to attach my own docking dialog bar and child window
to Visual C++ so it will look like an intergral part of it. I haven't been able to do that, and even though
MSDN says that you can create modeless dialogs (because they don't have their own message pump),
I HAVE seen an add-in called RadVC which similated a Visual Basic environment in Visual C++ - which
indicates that it IS possible to do what I want.
How can I do it then? Is there a specific COM interface for doing that?
Thanks.
|
|
|
|
|
Hi
I've implemented some code that adds an item to the context menu , but I need to add two subitems for that item.
Can you please help me ?
Thanks
|
|
|
|
|