How to avoid the console from apearing.
John Connors
JohnConnors at mailinator.com
Tue Aug 17 15:27:19 PDT 2010
My small loader is not so small anymore. I've modified it according to the sample
but the console is still showing:
import core.runtime;
import std.c.windows.windows;
import std.process: system;
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
nCmdShow)
{
int result;
void exceptionHandler(Throwable e)
{
throw e;
}
try
{
Runtime.initialize(&exceptionHandler);
result = system(r"bin\someprogram.exe");
Runtime.terminate(&exceptionHandler);
}
catch (Object o) // catch any uncaught exceptions
{
MessageBoxA(null, cast(char*)o.toString(), "Error", MB_OK | MB_ICONEXCLAMATION);
result = 0; // failed
}
return result;
}
NOTE: The sample on the website doesn't compile because exceptionHandler() should
receive a Throwable not an Exception.
I then added a loader.def file that looks like this:
EXETYPE NT
SUBSYSTEM WINDOWS
And to compile I'm using this line:
dmd loader.d loader.def resource.res
The console is still showing. Any ideas why?
Thanks
More information about the Digitalmars-d-learn
mailing list