I'm trying to start an *.exe-file with the help of a *.dll-file instead of calling the *.exe-file directly. It will be used for a program that is able to start *.dll-files, but not *.exe-files.
In this case: The browser.exe is written in vb.NET and the browser.dll file in C++ (I could not find any dll snippet for vb.NET).
The code-snippet for the browser.dll (MFC-DLL) that has been generated by VS2008 and has been modified a little bit by me looks as follows:
[...]
CBrowserStartApp::CBrowserStartApp()
{
system("start .\\browser.exe");
}
CBrowserStartApp theApp;
BOOL CBrowserStartApp::InitInstance()
{
CWinApp::InitInstance();
system("start .\\browser.exe");
return TRUE;
}
I can compile it without errors.
The funny thing is that there's an error message if I start the dll with Rundll32.exe and add any parameter. Then the program starts, but the error message is still there. It says something as "Error in browser.dll. Missing Content v
" if I start it with "Rundll32.exe browser.dll v
". If I leave out the parameter "v", nothing happens. Neither an error appears nor the actual application. What am I doing wrong here?
The next question I have is as follows: Usually I start the *.exe-File with parameters such as a URL (e.g., "browser.exe http://www.google.com
"). How can I add such URLs to the *.dll-file? The same trick as for usual program (e.g., args = Environment.GetCommandLineArgs()
)? How can I access them and take them forward to the actual *.exe-file then?
Thx, Markus G.
Since you're alrady using WinApi, use the native
CreateProcess
.