Simple GUI test

smithfox ssm.fox at gmail.com
Sun Apr 22 08:34:20 PDT 2007


I wrote a simple GUI test

code:
//=======================
import std.c.windows.windows;
import std.c.stdio;

extern(Windows)
int WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{
/*
    try
    {
        int a = 0;
    }catch (Object o)        // catch any uncaught exceptions
    {
        int b = 0;
    }
*/
    MessageBoxA(null, "aabc", "Error",MB_OK | MB_ICONEXCLAMATION);
    return 0;
}
//=======================

When I compile the code, screen output following Error:
Error 42: Symbol Undefined __acrtused
OPTLINK : Warning 134: No Start Address

But when I uncomment the comment code, the compiler can pass.

My questions is:
1. What's mean  "Symbol Undefined __acrtused" in above codes.
2. Whether all GUI program using D must have WinMain function?
3. If we can write GUI program without WinMain, how to get 
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
??



More information about the Digitalmars-d mailing list