make D windows-aware

Sean Kelly sean at f4.ca
Wed Mar 22 19:44:31 PST 2006


Jarrett Billingsley wrote:
> "Chris Miller" <chris at dprogramming.com> wrote in message 
> news:op.s6uctr1mpo9bzi at moe...
>> Can just use GetModuleHandleA(null)
> 
> Why thank you.  I was wondering if there was an API call to get that.
> 
> Now the only problem is that exceptions are displayed on the command line 
> instead of popping up.. which may be a problem for the other programmers in 
> my little group.. 

Why not catch all exceptions in main, display them as appropriate, and 
then rethrow:

void main( char[][] args ) {
     try {
         ...
     }
     catch( Exception e ) {
         // display dialog
         throw e;
     }
     catch( Object o ) {
         // display dialog
     }
}

Passing exceptions completely through the runtime would be a bit weird, 
as by the time the exception reached WinMain module dtors would have 
been called, the GC would have been terminated, etc.


Sean



More information about the Digitalmars-d mailing list