How to fix ActiveX controls shown as "Unknown" Tech Note 263
Transcription
How to fix ActiveX controls shown as "Unknown" Tech Note 263
Tech Note 263 How to fix ActiveX controls shown as "Unknown" All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more information. Topic#: 001043 Created: June 27, 2002 Updated September, 2003 This Tech Note explains why an ActiveX control is displayed as 'Unknown' in the wizard selection panel after it has been installed in WindowMaker through Special/Configure/Wizard/ActiveX Installation. It also provides a procedure for fixing this "Unknown" issue. OCX.INI is an index file for InTouch to keep track of the ActiveX controls installed in InTouch. For InTouch 7.x versions, it is located in InTouch directory. For InTouch 8.0, however, it is located in [drive]:\Documents and Settings\All Users\Application Data\Wonderware\InTouch. The content of this file includes the count of all the ActiveX controls installed in InTouch, GUID (Globally Unique IDentifier) and description of each installed ActiveX control. Whenever an ActiveX control is installed/uninstalled in InTouch through Special/Configure/Wizard and ActiveX Installation, OCX.INI file will be updated by InTouch to incorporate the changes made. However, there are special circumstances that this file can be incorrectly modified during ActiveX control install/uninstall process. Corrupted OCX.INI File To demonstrate how OCX.INI file can be corrupted, the following steps illustrate a typical example. 1. Let's use Microsoft Visual Basic, for example, to create a new ActiveX control. Use the default project and user control names, "Project1" and "UserControl1" for its Project and UserControl names respectively. 2. Add any necessary controls and code to UserControl1, and save the Project and UserControl. Make an ocx file, Project1.ocx for example, by compiling it. Move the ocx file to a test directory and register it. 3. Start InTouch WindowMaker, and install the ActiveX control, Project1.UserControl1. 4. Open the OCX.INI file in the InTouch directory. Check the registry entry for the ActiveX control. If UserControl1 is added to an InTouch window and the window saved, the WIZ.INI file in the InTouch directory will also be edited by InTouch. 5. Close Microsoft Visual Basic and restart it. Make a new ActiveX control project, and use the same default project and user control names, "Project1" and "UserControl1" for its Project and UserControl names. 6. Add whatever controls and code necessary to UserControl1, and save the Project and UserControl using different names from the first one. Make an ocx file, Project2.ocx for example. Move the ocx file to a test directory and register it. 7. In WindowMaker, if you create a new instance of UserControl1 ActiveX control in a window, you will find that the ActiveX control is actually Project2.ocx. All existing instances in the window will also be updated to Project2.ocx if the window is updated or InTouch restarted. 8. Remove the ActiveX control from WindowMaker, and close Wizard/ActiveX Installation window. 9. Open OCX.INI file. Normally, it should read as: However, it actually reads as: The reason behind this is that the Project1.UserControl1 ActiveX control, before Project2.ocx is registered, is linked to Project1.ocx file with GUID "{0A682CEFE8F5-4072-86F6-41740BCD0693}" in the system registry database. After Project2.ocx is registered, Project1.UserControl1 is re-linked to Project2.ocx file with a new GUID "{74A3DFE8-FB00-4041-9F3E75C99AB4D76A}", because both Project1.ocx and Project2.ocx files share the same project and user control names. This confuses InTouch when the program is uninstalling the ActiveX control by matching the GUID and description information from the OCX.INI file with that from the system registry. What InTouch will do is to add the latest information of the ActiveX control found in the registry database to the OCX.INI file, leaving the original entry in OCX.INI intact. This, in turn, will cause the corruption of this file when later on the ActiveX control is reinstalled in WindowMaker. 10. In WindowMaker, Project1.UserControl1 might still show up in the installed ActiveX controls list even though there is no 'ActiveX Control' shown in the wizard selection panel. If this is the case, you will not be able to remove the ActiveX control from WindowMaker no matter how many times you try to remove it. 11. Restart Microsoft Visual Basic, and open the first project. Rename the Project and UserControl names to "Project1a" and "UserControl1a" respectively, and recompile the ocx file by replacing Project1.ocx. Move the Project1.ocx to a test directory and register it. 12. Restart WindowMaker. You will find Project1.UserControl1 has been removed. Both Project1.UserControl1 and Project1a.UserControl1a should appear in the 'Available ActiveX Controls' list. 13. If you reinstall Project1a.UserControl1a in WindowMaker, it will be shown as 'Unknown' in the wizard select panel. The OCX.INI file will read as: If you reinstall Project1.UserControl1 in WindowMaker, it will also be shown as 'Unknown' in the wizard selection panel, though the OCX.INI will read different. For both cases, the cause of 'Unknown' ActiveX controls is from the orphaned "Itemxxxx" line left over from the uninstalling process, in this case, "Item0001={0A682CEF-E8F5-4072-86F6-41740BCD0693}, Project1.UserControl1". Solution To correct this: 1. Remove all ActiveX controls from InTouch windows. 2. Remove all ActiveX controls from installed ActiveX controls list located in WindowMaker. 3. Shutdown WindowMaker. 4. Open the OCX.INI file and delete all 'itemxxxx=….' lines, and save the file. Or, simply delete the OCX.INI file. It will be recreated the next time WindowMaker starts. 5. Open WIZ.INI and modify the ActiveX control section if it has not been deleted by InTouch, or simply delete this section. Note -- [Group0022] is just an example, it could be any [Group00xx]). 6. In the same WIZ.INI file, update the total group count if the whole section has been deleted in step 5, which should be the second line from the top. Save the file. 7. Restart WindowMaker. Reinstall all needed ActiveX controls. If a clean registry concerning these ocx files are desired, run regsvr32 /u "FilePath" command to remove them. Or, open the registry editor using 'regedit', and use either the description or the GUID information of the ActiveX controls to find each entry and manually delete it. Conclusion 1. To develop an ActiveX control, it is always a good practice to use a unique and pertinent Project and UserControl name for each application. 2. If possible, always uninstall the concerned ActiveX control in WindowMaker before making any modification to it. Reinstall the ActiveX control in WindowMaker after the modification. 3. Once the ActiveX control has been modified, be it Project/UserControl name change, or User Interface change, or file location change, always make sure the new version of ActiveX control is registered properly in the system registry. Note -- For other references on this topic, refer to TN 96, 117, and 242. Chuan He Tech Notes are published occasionally by Wonderware Technical Support. Publisher: Invensys Systems, Inc., 26561 Rancho Parkway South, Lake Forest, CA 92630. There is also technical information on our software products at www.wonderware.com/support/mmi back to top