[Qt-interest] How to know whether an instance of a COm object is already running
Santhosh Y
santhosh at softjin.com
Thu Jul 8 13:58:12 CEST 2010
Hi,
How to know, whether an instance of a COM object is already
existing/running?
In following main(), I am reading a factory instance. Using Factory
instance I am creating an instance of the COM object for invoking few
methods on it.
I would like to know, when an instance of COM object is already
existing/running, I should not be creating a one more instance /*instead
I should use the same one*/.
How to ensure this?
int main ()
{
IClassFactory* factory = 0;
// Getting the factory
HRESULT res =
CoGetClassObject(QUuid("{084EF014-6C9B-4d50-8756-263CDAC6DE4B}"),
CLSCTX_ALL, 0, IID_IClassFactory, (void**)&factory);
if (factory) {
// I would like to know here whether an instance is already
present/running on machine
// If YES, I should get that instance for invoking few methods
on it. Else I should be doing this.
// creating instance
* res = factory->CreateInstance(0, IID_IUnknown, (void**)&ptr);*
//Creating a QAxObject that wraps the COM object referenced by
IUnknown.
QAxObject* comObj= new QAxObject (ptr);
comObj->dynamicCall("setPath",
"C:\\cygwin\\home\\JNK\\aera2GUI\\bin_dbg\\aera2gui.exe");
comObj->property("renewIAState").toInt();
}
}
Please help me in this regard.
Regards,
--
----------------------------------------------------
Y Santhosh Kumar -
Senior Software Engineer,
SoftJin Technologies Pvt Ltd,
www.softjin.com
----------------------------------------------------
Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for the use of the individual or entity to which they are addressed. It
may contain confidential, proprietary or legally privileged information.
If you are not the intended recipient please be advised that you have
received this message in error and any use is strictly prohibited. Please
immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender by return mail. You must not,
directly or indirectly, use, disclose, distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100708/60c279bd/attachment.html
More information about the Qt-interest-old
mailing list