Retrieving ActiveX classID from the system registry with C++ - c++

I am working on a windows application that has a shockwave flash player embedded in it.The C++ part should be able to call Flash movie methods and vice versa.Initial experiment was done using MFC.It works.But now I want to port it to Qt as it allows easier UI development.Qt has got QAxObject which holds the ActiveX control you assign to it via setCotrol() method which should get a classID of the ActiveX or its name.Because the classID is more reliable than a name and because I have not found an example where flash player ActiveX is accessed using a name ,now I want to know how to retrieve that classID from the system registry of the OS.I suppose that for every machine some specific activeX classID may vary (correct me if I am wrong on it) .If it is true then I need to access the registry ,find shockwave activeX classid and then pass it into QaxObject::setControl() method.How do I do that?
Forgot to mention that in MFC application the ActiveX control gets the requested ActiveX automatically once you select the ActiveX type from the list of available system controls.In Qt you have no such an option.
Reading this http://www.nirsoft.net/utils/acm.html I understand that the CLASSID is constant on any machine.Is it true ? If yes then please discard my question as there is no reason searching for the ActiveX key on specific machine by the ProgID if it is the same always.
Thanks.

It would be better to query from the registry by mime type. You can find details on where that is stored here:
http://msdn.microsoft.com/en-us/library/aa751976%28v=vs.85%29.aspx
You can look up the mimetype in the registry and get the CLSID from that. You can look it up by name as well; the locations of both registry keys are explained in that document.

Related

How to discover display name and icon location for a Windows Notification AppUserModelId

I need to find out the display name and icon location for the subkeys entries under this Windows Registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings
These subkeys are entries in Windows 10/11 "Notifications & Actions". In there, they have a Display Name and an Icon representation.
I believe these subkeys are AppUserModelId and there is also some are like this:
Microsoft.Explorer.Notification.{0FAD3B9E-911D-13AC-5879-28F3EFEECE6E} which are regular applications that had fire some notifications and Windows Explorer has capture them.
Anyway, I can't find a way to discover how to get their information (display name and icon path).
Windows "Notifications & Actions" does display their name and icon. So I need to do the same.
I have already spent hours trying to find out an Win32 API or WinRT class to retrieve this information but I haven't been able to sort this out.
Does anybody know where I can't get this information from?
Preferably in C++ using RoInitialize to use WinRT.
Thank you!

ActiveX Property Persistance

I have a question about an ActiveX Control I am developing. I have hashed my way through most problems but I am stuck at a real road block. This ActiveX is being imorted into other software so I have to have a good implementation of the Property Pages. I have managed to get some persistant properties working with one issue. When I make a change in the property page it is updated and persists as long as the application that is development app that is using it is open but it reverts back when I reload the app. I have narrowed this down to the fact that the development app doesnt realize the ActiveX has changed and therfore doesnt save. If i make a unrelated change and save the program all is good and the values persist as expected. I have tried everything and cant seem t get the application that imports my ActiveX to realize when it has changed via the property page. I am wondering if anyone has some work arounds for this type of problem. It seems to me if I could force the DoPropExchange() it would work but I dont know how to call this explicitly.
Thanks in advance
Matt
Thanks for the input. I did have the SetModifiedFlag() but it wasnt working. After poking at it I solved that problem but now I am redirecting my question. I had removed the property above in question from the idl files dispinterface in order to prevent the application that loads the activex from displaying the property in its "Connection List"(3rd party application specific"). It appears that the app loads all the interface into this list but this is not good as some properties should be persistant and only modifiable through the proppages. I tried all the flags like hidden and local but still were displayed in the list. When I removed it from the dispinterface it was how I wanted it but would not signal the IsModified. My new question is in there another way to define properties for an instance like this or is it possible to have a secondary interface(I have not tested if the application would see this interface because I am not sure how I would go about defining this inteface)or to have a property only between the proppage and control. Or is there another way to signal the dirty. The OnMemberVariable of the control was properly executing I know from testing it just seems SetModifiedFlag() doesnt do anything if the property is not in the dispinterface
Thanks Again
You need to mark your control as "modified", so that its host could detect it and re-save persistent properties. In this case IPersistXxx::IsDirty implemented by your control would indicate dirty state.
MFC based control has COleControl::SetModifiedFlag for this purpose:
Call this function whenever a change occurs that would affect your control's persistent state. For example, if the value of a persistent property changes, call this function with bModified TRUE.
Update: To hide a property from property browser you can use nonbrowsable attribute.
Use the [nonbrowsable] attribute to tag an interface or dispinterface member that should not be displayed in a properties browser.

Custom toolbar compatible for IE Protected Mode

I have created a custom toolbar for IE. I am placing my COM DLL in System32 folder. IE is able to load my toolbar in protected mode. My toolbar should read some data from ini file which is created in InternetCache folder. I am not registering my COM component to any category (e.g. CATID_AppContainerCompatible).
My question is
1) Is it compulsory to place the my DLL in sub folder of program files?
2) Do I need to register to app container category?
3) How can I make sure that my toolbar is compatible with protected mode.
Thanks in advance.
Regards,
Santhosh
I used to develop a BHO for IE6+ before and hope you'll find those answers useful.
1) Is it compulsory to place the my DLL in sub folder of program files?
Don't remember exactly but if it's both signed and placed under a trusted location the more chances IE will pick it up.
2) Do I need to register to app container category?
Just registering a COM DLL module should be enough.
3) How can I make sure that my toolbar is compatible with protected mode.
It is by default but in protected mode you'll receive 'access denied' error on attempts of reading from or writing to many locations both on file system and in registry.
In registry you can use HKEY_CURRENT_USER\Software\AppDataLow and %USERPROFILE%\AppData\LocalLow on file system.

How can I allow only flash activeX but others disallow in my webcontrol used IWebBrowser2?

I am working on my webcontrol used IWebBrowser2.
I want it play flash movie but disallow other ActiveX controls.
I found disallow all ActiveX contorls using DLCTL_NO_DLACTIVEXCTLS | DLCTL_NO_RUNACTIVEXCTLS flags
in implements of invoke.
but I've searching msdn for IWebBrowser and related Interfaces, I can't found any solution.
I expect catch a event before ActiveX loaded or allow only flash ActiveX ways.
please help. thanks.
Hosts of the Web Browser can control how it behaves by implementing IOleClientSite and responding to DISPID_AMBIENT_DLCONTROL with a set of desired behavior flags. One important caveat: the flag DLCTL_NO_RUNACTIVEXCTLS only blocks OBJECT tags within the document itself. It has no impact on the use of calls to new ActiveXObject(“…”) from script, if DLCTL_NO_SCRIPTS was not set.
In order to prevent ActiveX execution in a Web Browser host, supply an IInternetSecurityManager and return URLPOLICY_DISALLOW and S_FALSE when your ProcessURLAction implementation is called with URLACTION_ACTIVEX_RUN. To permit only a specified “allow list” of controls to run, the ProcessURLAction implementation can examine the CLSID of the requested control; that CLSID is passed in using the pContext parameter.

How can save Application Settings in the Registry via MFC?

I have a MFC application created by the MFC Project Wizard. I wanted to save/read application settings in the registry and so asked this question to find a C++ Registry wrapper as the Windows API is very messy. However, I have now heard that the MFC provides a way to do this. Is this true? If so, how can I read/write values, see whether a key exists and get a list of all the keys?
MFC provides an easy way to read/write Windows registry.
In your project you'll have a global CMyProjectName theApp; object.
CMyProjectName inherits CWinApp class which provides the SetRegistryKey() method.
That method sets theApp to write in the registry instead of an "ini" file.
In the documentation check out
CWinApp::GetProfileInt
CWinApp::GetProfileString
CWinApp::WriteProfileInt
CWinApp::WriteProfileString
methods on how to read and write integers and strings in the registry.