|
import std.c.windows.windows;
extern (C) void gc_init(); extern (C) void gc_term(); extern (C) void _minit(); extern (C) void _moduleCtor(); extern (C) void _moduleDtor(); extern (C) void _moduleUnitTests();
extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int result;
gc_init(); // initialize garbage collector
_minit(); // initialize module constructor table
try { _moduleCtor(); // call module constructors
_moduleUnitTests(); // run unit tests (optional)
result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
_moduleDtor(); // call module destructors
}
catch (Object o) // catch any uncaught exceptions
{ MessageBoxA(null, cast(char *)o.toString(), "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; // failed
}
gc_term(); // run finalizers; terminate garbage collector
return result; }
int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { /* ... insert user code here ... */ MessageBoxA(null, "HelloWorld", "MSG",MB_OK | MB_ICONEXCLAMATION); //就这行是我写的,其他都是英文说明上的
return 1; }
|