In the project development, in order to make C# call the original C++ developed OLE interface program, the following method was adopted to establish C++CLI project as an intermediate DLL, with the following advantages:
(1) on the one hand, he can better use C++ to access OLE API functions, and the original C++ development of OLE programs better combination;
(2) on the other hand, C# can easily reference C++CLI DLL, so that the implementation of C# code on the old version of OLE program calls quickly;
(3) low coupling, easy to test, about the correctness of OLE interface and C++CLI, you can independently set up a test project to test.
Therefore, C# projects utilize the invocation relationship of C++ OLE as follows:
C # = = & gt; > > C + + the CLR = = & gt; > > C + +, OLE
In the real project, the OLE program is developed by another TEAM, we just call it. But during the testing process, the call to OLE interface in the latest test environment failed. Debug finds that the C++CLI failed to initialize the specified OLE program when calling the OLE interface with the error code 0x80040154, which means the following:
OLE error code 0x80040154. Class is not registered.
The main online solution is to call the RegSVR32 command to register your program. The purpose of registration is to establish the mapping relationship between ProgramID and CLSID in the registry. In my understanding, ProgramID is equivalent to our name. When we use the API to call the COM/OLE interface, we pass a plain string called ProgramID, and the API internally operates on the CLSID based on the mapping stored in the registry. There is a subkey in the registry with CLSID as key and its name is LocalService32. The corresponding key value of this key stores the local full path of the final OLE program. Finally, it is found that this key value in our test environment is wrong and does not point to the real OLE program path, thus causing failure in the initialization of OLE program. Given the wrong program path, the loader must fail.
Modify the CLSID stored in the OLE program full path.
- Unable to find VBScript script engine or error 2738, could not access VBScript runtime
- Error: (2, ‘RegOpenKeyEx’, error resolution
- MDK (keil) debugging often appears flashback phenomenon solution.
- Installation and problems of texlive2017 in win10 system
- Nginx reports 502 error, log connect() failed (111: Connection refused) while connecting to upstream. A personal effective solution
- panic: runtime error: index out of range
- [Handling Notes] Alternative reasons for Configuration system failed to initialize exception
- CMake Error at CMakeLists.txt:5 (PROJECT): The CMAKE_C_COMPILER: cl is not a full path
- Error running Eclipse: failed to load the JNI shared library
- Points for attention in setting up robot framework + Python 3.7.0 environment
- webstorm npm install –save –save-exact –loglevel error react react-dom react-scripts has failed.
- Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test
- Win7_ Dim-00019 appears after x64 installation of Oracle11g
- PHP connection to MySQL database error: call to undefined function MySQL_ connect()
- Solve the problem that the interface between C # WinForm program and Oracle doesn’t respond for a long time
- Error ts1005: ‘;’ expected
- stay web.xml Configure error page in
- Arithmetic overflow error converting numeric to data type numeric.
- Idapython: the solution of importing “site” failed error
- On the problem of QT program open crash