Using ActiveX in C++

I’m trying to write an application in c++ that connect to an XProtect server.

I think to use the EngineManager activex and the ImageViewer ActiveX component. So i tried to compile the ActiveXandWindowsCredential sample project with Visual Studio 2015 on a Windows7 64 bit operating system.

I registered ImageViewerDotNet.dll and EngineManager.dll running regsvr32 as an administrator.

If I compile for x64 the sample starts but tell me that EngineManager.dll is not registered.

If I compile for x86 the sample crashes.

Could someone explain how can I successfull use this sample project?

This is the one sample you must run as 32 bit, the EngineManager.dll is only 32 bit. Do you have some information from the crash that could be a clue on what is the cause?

This is the output debug log: ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Program](file:C:/Program) Files\Milestone\MIPSDK\ComponentSamples\ActiveXandWindowsCredentials\Debug\ActiveXandWindowsCredentials.exe’. Symbols loaded. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\ntdll.dll’.](file:C:/Windows/SysWOW64/ntdll.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\kernel32.dll’.](file:C:/Windows/SysWOW64/kernel32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\KernelBase.dll’.](file:C:/Windows/SysWOW64/KernelBase.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\mfc140ud.dll’.](file:C:/Windows/SysWOW64/mfc140ud.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\advapi32.dll’.](file:C:/Windows/SysWOW64/advapi32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\msvcrt.dll’.](file:C:/Windows/SysWOW64/msvcrt.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\sechost.dll’.](file:C:/Windows/SysWOW64/sechost.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\rpcrt4.dll’.](file:C:/Windows/SysWOW64/rpcrt4.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\sspicli.dll’.](file:C:/Windows/SysWOW64/sspicli.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\cryptbase.dll’.](file:C:/Windows/SysWOW64/cryptbase.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\vcruntime140d.dll’.](file:C:/Windows/SysWOW64/vcruntime140d.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\ucrtbased.dll’.](file:C:/Windows/SysWOW64/ucrtbased.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-timezone-l1-1-0.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-timezone-l1-1-0.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-file-l2-1-0.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-file-l2-1-0.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-localization-l1-2-0.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-localization-l1-2-0.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-synch-l1-2-0.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-processthreads-l1-1-1.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-processthreads-l1-1-1.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\api-ms-win-core-file-l1-2-0.dll’.](file:C:/Windows/SysWOW64/api-ms-win-core-file-l1-2-0.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\user32.dll’.](file:C:/Windows/SysWOW64/user32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\gdi32.dll’.](file:C:/Windows/SysWOW64/gdi32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\lpk.dll’.](file:C:/Windows/SysWOW64/lpk.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\usp10.dll’.](file:C:/Windows/SysWOW64/usp10.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\ole32.dll’.](file:C:/Windows/SysWOW64/ole32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\oleaut32.dll’.](file:C:/Windows/SysWOW64/oleaut32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\shlwapi.dll’.](file:C:/Windows/SysWOW64/shlwapi.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\imm32.dll’.](file:C:/Windows/SysWOW64/imm32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\msctf.dll’.](file:C:/Windows/SysWOW64/msctf.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\uxtheme.dll’.](file:C:/Windows/SysWOW64/uxtheme.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d\comctl32.dll’.](file:C:/Windows/winsxs/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d/comctl32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23508_none_5c028c09a01213b0\GdiPlus.dll’.](file:C:/Windows/winsxs/x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23508_none_5c028c09a01213b0/GdiPlus.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\apphelp.dll’.](file:C:/Windows/SysWOW64/apphelp.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\cmd.exe’.](file:C:/Windows/SysWOW64/cmd.exe’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Unloaded ‘[C:\Windows\SysWOW64\cmd.exe’](file:C:/Windows/SysWOW64/cmd.exe’) ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\shell32.dll’.](file:C:/Windows/SysWOW64/shell32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\dwmapi.dll’.](file:C:/Windows/SysWOW64/dwmapi.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\clbcatq.dll’.](file:C:/Windows/SysWOW64/clbcatq.dll’.) Cannot find or open the PDB file. [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occsite.cpp(529)](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/occsite.cpp(529)) : AppMsg - CoCreateInstance of OLE control {B86E5A61-3F0D-4EFD-A040-A68A301A1BFA} failed. [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occsite.cpp(530)](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/occsite.cpp(530)) : AppMsg - >>> Result code: 0x80040154 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occsite.cpp(531)](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/occsite.cpp(531)) : AppMsg - >>> Is the control is properly registered? [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp(919)](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/occcont.cpp(919)) : AppMsg - Warning: Resource items and Win32 Z-order lists are out of sync. Tab order may be not defined well. Debug Assertion Failed! Program: [C:\Windows\system32\mfc140ud.dll](file:C:/Windows/system32/mfc140ud.dll) File: [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/occcont.cpp) Line: 925 For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. (Press Retry to debug the application) ‘ActiveXandWindowsCredentials.exe’ (Win32): Loaded ‘[C:\Windows\SysWOW64\ole32.dll’.](file:C:/Windows/SysWOW64/ole32.dll’.) Cannot find or open the PDB file. ‘ActiveXandWindowsCredentials.exe’ (Win32): Unloaded ‘[C:\Windows\SysWOW64\ole32.dll’](file:C:/Windows/SysWOW64/ole32.dll’) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dlgcore.cpp(714)](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/dlgcore.cpp(714)) : AppMsg - Warning: CreateDlgControls failed during dialog init. Debug Assertion Failed! Program: [C:\Windows\system32\mfc140ud.dll](file:C:/Windows/system32/mfc140ud.dll) File: [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\winocc.cpp](file:f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/winocc.cpp) Line: 377 For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. (Press Retry to debug the application) The program ‘[3524] ActiveXandWindowsCredentials.exe’ has exited with code 0 (0x0). I think that ImageViewerDotNet.dll (version 10.2.vNext [x64]) found in Bin folder is a 64 bit dll so CoCreateInstance of OLE control {B86E5A61-3F0D-4EFD-A040-A68A301A1BFA} failed.

Try to download and install the 32-bit MIP SDK redistributable and register the 32-bit versions of the ImageViewerDotNet and EngineManager.

https://www.milestonesys.com/my-milestone/msp/mip-sdk/

BTW. Release or debug build?

Thank you! With the 32 bit version of ImageViewerDotNet.dll the sample project compiles and runs perfectly as expected.