I'm trying to write a dll for the Microsoft cmak, which we will use for a VPN connection. It's supposed to have this signature: HRESULT WINAPI function [IN] HWND hWndParent [IN] HINSTANCE hinstDll [IN] LPCSTR pszCommandLine [IN] DWORD dwReserved But it still uses the DllMain of my console win32 c++ dll-file. Cmak can only run DLLs synchronously. I want it to run two .exe files after each other. I start them from the DLL. It may not go on establishing the connection until both of them has executed successsfully. It has to stop after starting each .exe. That's why it has to be a DLL. It doesn't stop otherwise. No matter what function name I use in the [Pre-Connect Actions] section of the .cms-file it uses DllMain anyway. Do you have to export the function names for automation like an ActiveX-DLL? Is there a working source code project that I can look at somewhere on the web?