- Create a solution with three projects
- Client: Win32 Cli project
- Proxy/stub DLL: Win32 project, select DLL radio button, and check "Empty project" in last menu
- DLL Server: Win32 project, select DLL radio button
- Exe Server: Empty project
- Follow this tutorial to set up the empty DLL project as the proxy/stub DLL with MIDL
- Add the MIDL
x_h.h
andx_i.c
file as Existing Items to the client and server projects - Add the proxy/stub DLL folder to the "Additional Include Directories" under Project > Properties > C/C++ > General for the client and server projects
- Don't forget to include
<windows.h>
and<initguid.h>
in your client. They aren't included by default but are needed to compile COM code. - When completing the above tutorial you may/will probably have to change the code for the
_WIN32_WINNT
to match your Windows version - The above instructions do not provide scaffold classes and methods necessary to implement COM or a DLL, but you can find them in the commit history
- This repo reuses code from the DLL server for the EXE server. You may wish to refactor the generic code into a fifth project or library.
- The EXE server registers the type library and specifies use of the Automation marshaller, while the DLL server uses the custom marshalling code present in the proxy/stub DLL (and therefore requires you to register the proxy/stub DLL as well as the server)