make D windows-aware

Hasan Aljudy hasan.aljudy at gmail.com
Wed Mar 22 18:01:59 PST 2006


Jarrett Billingsley wrote:
> "Regan Heath" <regan at netwin.co.nz> wrote in message 
> news:ops6uelhqc23k2f5 at nrage.netwin.co.nz...
> 
>>Can you catch them all in WinMain i.e.
>>
>>try {
>>  ..main..
>>} catch(Object o) {
>>  MessageBox(...
>>}
> 
> 
> If I use the method proposed by Sean, I'd have to catch the exceptions in my 
> own main function, as the dmain catches them and prints them to the console. 
> i.e.
> 
> extern(C) main(..)
> 
> int WinMain(..)
> {
>     return main(1, &cmdline);
> }
> 
> void main()
> {
>     try
>     {
>         crap
>     }
>     catch(Exception e)
>     {
>         MessageBox("oh man" ~ e.toString());
>     }
> }
> 
> Pretty ugly. 
> 
> 

I think you can use the new scope(failure) construct!



More information about the Digitalmars-d mailing list