[DUG] Error message starting Delphi program on Vista

Max Nilson max at accredo.co.nz
Mon Nov 24 09:54:03 NZDT 2008


John Bird asked:

> I have one program that is prone to getting an exception dialog when
it starts on Vista

You may want to set the current error mode like this before you start
messing about with drive volumes that may be unmounted, or otherwise
unavailable:

ErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS);
try
  // Access dodgly volumes here
finally
  SetErrorMode(ErrorMode)
end 

Have a look at the MSDN documentation on SetErrorMode as it allows you
to alter the default behaviour of various situations so that you can
catch them programmatically rather than have exceptions biffed about
unexpectedly.

Cheers, Max.



More information about the Delphi mailing list