Glenn Linderman wrote:

> On approximately 6/27/2005 4:44 PM, came the following characters from 
> the keyboard of Glenn Linderman:
> 
>>The code in the message below is great stuff as far as it goes... it'll 
>>detect the drive type, and it'll tell the stats of DRIVE_FIXED (hard) 
>>drives, but is there an easy, Perl, way to tell whether a Removable 
>>drive, and/or a CD-ROM drive actually contain media?  That doesn't 
>>prompt the user with a dialog box?
> 
> 
> OK, I must have finally stumbled on the right keywords for my search.
> Here is a subroutine to access the Windows SetErrorMode API.

This is what I use:

use Win32::API;

Win32::API->Import('kernel32', 'UINT SetErrorMode(UINT uMode)') or
  die "import SetErrorMode: $! ($^E)";

use constant SEM_FAILCRITICALERRORS => 1;
use constant SEM_NOGPFAULTERRORBOX => 2;
use constant SEM_NOOPENFILEERRORBOX => 0x8000;

# set

my $new = SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS;
my $prev = SetErrorMode ($new);
printf "prev=%u (%04X), new=%u (%04X)\n", $prev, $prev, $new, $new;

# restore

$prev = SetErrorMode ($prev);
printf "prev=%u (%04X), new=%u (%04X)\n", $prev, $prev, $new, $new;


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to