[Qt-interest] How to kill the COM Process invoked from a tester application
Santhosh Y
santhosh at softjin.com
Thu Jul 29 12:34:18 CEST 2010
Hi,
I am able to invoke a COM server from a tester application as written
below. My COM server is a GUI object, so when I close the last window of my
server it is not exiting the process from task manager (I am a MS
Windows user).
==============================================
int main(int /*argc*/, char** /*argv*/)
{
// To initialize COM.
CoInitialize(NULL);
IUnknown* ptr = NULL;
// Getting instance by giving NewGUICOmObj class id
HRESULT hres =
CoCreateInstance(QUuid("{084EF014-6C9B-4d50-8756-263CDAC6DE4B}"),
0, CLSCTX_SERVER, IID_IUnknown, (LPVOID*)&ptr);
if (hres == S_OK && ptr !=NULL ) { //success
//Creating a QAxObject that wraps the COM object referenced by
IUnknown.
QAxObject* comObj= new QAxObject (ptr);
comObj->dynamicCall("setPath", "");
comObj->property("renewIAState");
} else { //failure
std::cout << "Failed to start; Reason is CoCreateInstance
failure " << std::endl;
}
// cleanup COM after you're done using its services
//CoUninitialize(); *//This I can't write here. If I do that, it is
killing the COM server before I work on it.*
}
==============================================
For your information, the event loop is on Server side. Please see below
code.
==============================================
int main(int argc, char **argv)
{
QtApplication app(argc, argv);
QAxFactory::startServer(QAxFactory::SingleInstance);
return app.exec (); *// Event loop is started here*
}
==============================================
Please tell me how to kill the COM server invoked by the tester
application, in such a scenario.
Regards,
Santhosh
----------------------------------------------------
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/20100729/5f908698/attachment.html
More information about the Qt-interest-old
mailing list