make D windows-aware
Regan Heath
regan at netwin.co.nz
Wed Mar 22 18:09:10 PST 2006
On Wed, 22 Mar 2006 20:42:57 -0500, Jarrett Billingsley
<kb3ctd2 at yahoo.com> 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.
Yeah, though if you add 1 more layer, i.e.
extern(C) main(..)
int WinMain(..)
{
return main(1, &cmdline);
}
void main()
{
try
{
real_main();
}
catch(Exception e)
{
MessageBox("oh man" ~ e.toString());
}
}
void real_main()
{
..crap..
}
it's not so bad.
Regan
More information about the Digitalmars-d
mailing list