[Qt-interest] How to find a key presence in regedit?

Santhosh Y santhosh at softjin.com
Tue Sep 14 10:57:01 CEST 2010


Hi,

When I build a com server as part of post-build event it gets registered 
in the registry.

I can see the CLSIDs specific to COM gets registered in the registry in 
the following path.
*My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\*

And the above com server is invoked in some other exe. /*Before one 
invokes the com server, if somebody unregister the above server,
then some unknown exceptions are happening.*/

I would like to detect whether the keys specific to classes exposed as  
COM objects are present in the above path, before user invokes com 
server in the second application.

How to do this?

I have written following code snippet for detecting it; But it is not 
working. Can you help me how to do the same.

===================================
bool     isApplicationRegistered ()
{
     QSettings s;
     s.beginGroup("My 
Computer\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\");

     bool toolbar = s.contains 
(QString("{3F3C28E3-5A54-4ec2-81C0-D2FC3B10253D}")); *// class 
DatToolBarObj*
     bool menubar = s.contains 
(QString("{D71F00BA-45E9-493c-98EE-DB5DEEBE1BE3}")); *// class 
DatMenuBarObj*
     bool configObj = s.contains 
(QString("{DADB29F8-E91F-4974-8787-6262653CF828}")); *// class DatConfigObj*
     bool handlerObj = s.contains 
(QString("{FC76AF01-5A8C-41ef-A941-237F6B930803}")); *// class 
DatHandlerObj*

     s.endGroup ();

     return (toolbar && menubar && configObj && handlerObj);
}
=================================================
When I do the above, it is returning false for all the keys when they 
are present. Why this is happening?
Please tell me any better or correct way,  to know whether a key is 
present in the registry.

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/20100914/7ea09e11/attachment.html 


More information about the Qt-interest-old mailing list