How to dynamically load a registration-free COM DLL in C++?

RL Chen 250 Reputation points
2023-10-12T11:03:36.78+00:00

With the previous question I figured out how to use the registration free COM with everyone's help. (Previous Question) But a new problem has arisen. The current situation is that the program needs to be in the same directory as the DLL generated by the COM library in order to run, and if the DLL is missing the program will not start and will report an error.

[Window Title]
C:\Users\AlanCRL\Desktop\CSRegFreeComServer.exe

[Content]
C:\Users\AlanCRL\Desktop\CSRegFreeComServer.exe
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

[OK]

At present it seems that Activation Context API can solve my problem, probably dynamic loading COM components, at that time I would like to ask you to help me write a sample code, or modify my project has reached the requirements, thank you. Download the project here.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,122 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,787 questions
{count} votes

Accepted answer
  1. RLWA32 46,111 Reputation points
    2023-10-12T17:28:07.19+00:00

    I'm glad that my guidance to use the Activation Context API solved the problem. And it was especially good to read that you implemented the solution yourself. Good job!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.