Reputation: 752
Scenario:
We're busy wrapping up a 3rd party's C++ SDK as a DLL to make it simpler for other developers in our organisation to integrate this functionality into their own apps (be it, .net, delphi, etc)
The underlying system sends Windows messages to signal events that occur in the system. These events need to be dealt with, as they could potentially signal the state of the system and what can be done next.
Question:
What would the best way be to handle these messages within the context of the approach we are taking (i.e a DLL that wraps up the 3rd party SDK)? Some ideas that come to mind:
All sample code given for the SDK uses a single Win32 app that implements a message pump and handles the messages within the context of the application.
Its been ages since I have done Windows development using native Win32 and would appreciate some advice.
Upvotes: 0
Views: 495
Reputation: 1031
The easiest way is to make a proxy DLL. The basic idea is to replace the API DLL with your own, replace the functions you want to and forward the rest to the original API DLL. You rename the original DLL and put in your with the original name of the API DLL. To do this you need to export the functions. Microsoft has made this fairly simple using Visual Studio.
Here's how to export the functions: http://msdn.microsoft.com/en-us/library/z4zxe9k8%28v=VS.100%29.aspx
If you dont know the function calls of the API they are using, there is a utility called PE Explorer that can tell you all about the functions. It costs $229 for a single business license but it looks like it's worth it's money: http://pe-explorer.com/peexplorer-tour-function-view.htm
There are ways to replace the API calls in memory but it's complex, requires the API to already be active (unless you are closely monitoring the system) and may set off an antivirus programs.
Upvotes: 2