0

I have a Visual C++ Program that needs to use another program to run some specific functions to communicate with my USB device. This second program is provided by the company of by USB Device.

The company also provides the DLL and Library to access the communication module.

The program runs just fine. I can communicate very well with the USB Device.

The problem is that the communication with the USB Device is not the only function of my Visual C++ program, so it should be able to open the program even if the communication module is not installed.

Using the method RegOpenKeyEx, I succeeded to check if the communication module is installed or not. Therefore I can just avoid calling the functions to access the usb device if the communication module is not available.

The problem is that my program is still not opening in a computer without the communication module. I appears the error: "The Appication was unable to start correctly(0x000007b). Click OK to close the application."

Is it possible to solve my problem?

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186

1 Answers1

2

Instead of statically linking to the DLL, you need to dynamically load it. Then you can choose to load it or not based on whether it's installed. Here is an article showing how to do this, and Here is an SO question with some more detailed info on accessing the contents of a dynamically loaded DLL.

Community
  • 1
  • 1
Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186