Simple GUI test

Lionello Lunesu lionello at lunesu.remove.com
Sun Apr 22 10:46:33 PDT 2007


You should just keep using "main" (instead of WinMain), but you should 
instruct  the compiler that you don't want a console window by adding a .def 
file for your project. The DMD distribution ZIP contains a sample, if I'm 
not mistaken.

L.

"smithfox" <ssm.fox at gmail.com> wrote in message 
news:f0fv9s$1baf$1 at digitalmars.com...
>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