` Printed Icetips Article

Icetips Article



Par2: Preventing windows hardware error checking - API call
1998-04-15 -- Jeff Slarve
 
>In CW 4a 16 it using 2.003 templates I'm trying to use floppy disks for
>some functions. I'm looking for a way to find out if there is a way to
>trap the Cancel - Retry  when the user has not got a floppy in the
>drive. Even _DOSACCESS will pop up that error if there is no floppy in
>the drive unless you have used the drive before hand.

Use SetErrorMode():
      Module('WinAPI')
       SetErrorMode(UNSIGNED),UNSIGNED,PASCAL
      end

  Here is a snippet:

    If (( DriveType = Drive_Removable) and LOC:NoFloppy )|
       or (( DriveType = DRIVE_CDROM ) and LOC:NOCD )
        Return
    end
    DummyLong = SetErrorMode(1)        !Get control from Windows
    SETPATH( Clip( DQ:Drive ) & ':\')
    IF ~ERRORCODE()
       Add( DriveQ )
    End
    DummyLong = SetErrorMode(0)        !Give control back to Windows



Printed November 21, 2024, 6:59 am
This article has been viewed/printed 35197 times.