Class not registered error (REGDB_E_CLASSNOTREG)
When running a Visual Studio project containing TwainControlX from the IDE, an error message can be encountered as shown in the image below. The full error message is typically ‘Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))’.
This error is most commonly caused by attempting to compile and run a project as a 64-bit application when only the 32-bit version of TwainControlX is installed. While developing the project in the Visual Studio IDE, everything appears to work correctly. This is because Visual Studio itself is a 32-bit application. When compiling, the default option in VS is to compile to 64-bit when working on a 64-bit operating system, so at this point, the execution fails.
The possible solutions are:
- Install and register the 64-bit version of the OCX. If using our installer to install TwainControlX this should be done automatically when installing on a 64-bit OS
- Make sure the project is compiling as 32-bit. In Visual Studio 2017, select ‘Build’ then ‘Configuration Manager...’ from the menu and set the platform for your project to ‘x86’
If you are using a version of TwainControlX older than version 4.0 (released in 2013) please note that there is no 64-bit OCX available. Consider building your application as 32-bit, or upgrading to the latest version of the control.