Click to See Complete Forum and Search --> : How does one detect if an ActiveX control is installed?


hiltonc
April 8th, 1999, 11:57 AM
I have an application which uses an ActiveX control in CMainFrame (not a dialog). I create it in the OnCreate function and then proceed to use it. If the control (MS Agent) isn't installed, it works fine (just doesn't do anything, but no errors). How can I test to see if it (the control) is installed so that I can disable menu items that use the control?

Jay Buckman
April 8th, 1999, 01:31 PM
1. Examine the return value from CreateControl().
2. Look in the registry for HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID or the CLSID of the control. Then check if the file under InprocServer32 exists.
3. Look in the registry for HKEY_CLASSES_ROOT\<prog ID> for the prog Id of the control and then look up the CLSID as in 2 above for the CLSID in in the CLSID key.

By the way, do you know how to set read-only at run-time properties of controls that you create in the frame or view windows?

Jay Buckman
jayb@nida.com