[Qt-interest] Equivalent call for setControl() of QAxWidget in ActiveX control [COM Object handling]
Santhosh Y
santhosh at softjin.com
Wed Jun 30 07:06:21 CEST 2010
Hi ,
With the following main() in my tester application, I am able to launch
my QMenus object.
============================================================================
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QAxWidget *window = new QAxWidget();
* window->setControl("{4dc3f340-a6f7-44e4-a79b-3e9217695fbd}"); //
ClassID of the COM object*
window->show();
return a.exec();
} // end of my main ()
/// * Following is the code snippet from
"C:\Qt\4.5.2\src\activeqt\container\qaxbase.cpp"*, which is called
from above *setControl()*
bool QAxBase::initialize(IUnknown **ptr)
{
if (*ptr || control().isEmpty())
return false;
.....................................................
.....................................................
*ptr = 0;
if (!res) { // standard
* HRESULT hres = CoCreateInstance(QUuid(ctrl), 0, CLSCTX_SERVER,
IID_IUnknown, (void**)ptr);* // This is where actually the object is
being instantiated
res = S_OK == hres;
}
return *ptr != 0;
}
============================================================================
Alternatively, I am trying to do similarly in my main() as below to
avoid using Qt based objects in my main()
--------------------------------------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
QApplication a(argc, argv);
IUnknown* ptr = NULL;
* HRESULT hres =
CoCreateInstance(QUuid("{4dc3f340-a6f7-44e4-a79b-3e9217695fbd}"), 0,
CLSCTX_SERVER, IID_IUnknown, (LPVOID*)&ptr);*
* // My doubt is that how to get QMenus* from IUnknown**
* // If I solve this, I'll be able to invoke an object from axserver
without using Qt.*
* // If any Q_PROPERY() was there i'll invoke from here*
if (hres == S_OK && ptr !=NULL ) {
//success
} else {
//failure
}
return a.exec();
}
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/20100630/8a938d77/attachment.html
More information about the Qt-interest-old
mailing list