Adding missing COM controls to your project
Previous Top Next


The first step to determine which COM controls are missing from your project is to try running your Thinstall packaged application on a clean version of Windows. You should use the lowest version of Windows you plan to support, because later versions of Windows ship with controls pre-installed that are not installed on earlier versions. You need to test on a clean version of Windows (i.e. just installed with nothing else on the machine), because other applications may install controls that wouldn't normally be on the end-user's computer.
We recommend using VMWare or Virtual PC to keep various versions of Windows available. VMWare is superior to Virtual PC, and the slightly higher price is we justified. The steps to locate a missing COM control include:

1. Build your application using Thinstall, making to enable " Log Major Errors"
2. Copy your EXE to the "clean Windows" machine and run it there
3. When your program quits or crashes, inspect the resulting file thinstall.log, you might see a line that looks something like this:

000019 f4 CoCreateInstanceEx {0713E8A2-850A-101B-AFC0-4210102A8DA7}.(no such class) context=5(CLSCTX_INPROC_SERVER CLSCTX_LOCAL_SERVER ) (finish) -> 80040154 (REGDB_E_CLASSNOTREG) *** failed

This means the application tried to create a COM object with the Class ID of {0713E8A2-850A-101B-AFC0-4210102A8DA7} and it failed. The most likely reason is that control is not registered on this computer and you have not added the file and associated .threg file to your Thinstall project.


Now, switch back to your development computer and look at your registry to see what COM control is associated with this DLL. You can use the program regedit.exe to find this information. After running regedit.exe, look under the location:

HKEY_CLASSES_ROOT\CLSID\ {0713E8A2-850A-101B-AFC0-4210102A8DA7}
\InProcServer32

Note your Class ID, (abbreviated as CLSID) will be different from {0713E8A2-850A-101B-AFC0-4210102A8DA7} depending on the control that is missing.

The default value tells you the name of the OCX or DLL responsible for providing this COM Object.

clip0348

Adding the COM control to your project
Now, that we've determined that comctl32.ocx is the control that is responsible for the missing Class ID Object, we need to add it to our Thinstall project and record a .threg file. To add the control to your project, locate the file using explorer and drag it onto your Thinstall project window. You will be prompted with a list of possible virtual path locations, select the shortest one which should look like %InstallPath%\comctl32.ocx.

Recording a registry script for your COM control
After the COM control has been added to your project, right-click on the file and select the option DLL/OCX Registration -> Record Registry script now. This should create a file in the same directory as the original control with the extension .threg, for example c:\windows\system32\comctl32.ocx.threg. This .threg file will also be automatically added to your Thinstall project. If you inspect the .threg file using a text editor, you should see the missing Class ID and the virtual location of your .OCX file.

HKEY_CLASSES_ROOT\CLSID\ {0713E8A2-850A-101B-AFC0-4210102A8DA7}
{
...
subkey InprocServer32
{
lastwrite 80e1a19f7797c301
value "" 01 %InstallPath%\COMCTL32.OCX
value ThreadingModel 01 Apartment
}
...
}

Finally, rebuild your EXE using Thinstall. The new EXE will contain the missing control and should be able to use the control without registration or system modifications. Copy the EXE to the "clean Windows" machine and run it again. If there are other COM controls missing, you may need to repeat this process again.