Page 2 of 3
Posted: Tue Apr 01, 2008 3:19 pm
by nageswaragunupudi
In xHarbour, these two function bypass the OS messages. I have not tested on Vista
1) DiskReady( cDisk, .F. )
2)
SetErrorMode(1)
IsDisk( cDisk )
I do not know if Harbour has similar functions
Posted: Tue Apr 01, 2008 4:02 pm
by Otto
Hello NagesWaraRao,
thank you.
Yes, Set ErrorMode(1) with xHarbor is working.
local cDisk := "m"
// msginfo(DiskReady( cDisk, .F. ) )
Unresolved external '_HB_FUN_DISKREADY' referenced from
SetErrorMode(1)
msginfo(IsDisk( cDisk ) )
Regards,
Otto
Posted: Tue Apr 01, 2008 4:34 pm
by Maurizio
Hello Otto
Why you don't use
nFile := fCreate( cDrive + 'TEST.TXT',0)
if nFile == -1
lReturn := FALSE
MsgInfo("Driver not present " )
else
fClose(nFile)
endif
Maurizio
Posted: Tue Apr 01, 2008 5:40 pm
by Otto
Maurizio, with your code I get the same error msg.
Regards,
Otto
Posted: Tue Apr 01, 2008 6:14 pm
by Antonio Linares
Otto,
> Antonio, the result is the same
Then the error may come from GetDriveType()
Posted: Wed Apr 02, 2008 4:00 am
by nageswaragunupudi
Otto wrote:Hello NagesWaraRao,
thank you.
Yes, Set ErrorMode(1) with xHarbor is working.
local cDisk := "m"
// msginfo(DiskReady( cDisk, .F. ) )
Unresolved external '_HB_FUN_DISKREADY' referenced from
SetErrorMode(1)
msginfo(IsDisk( cDisk ) )
Regards,
Otto
All the functions I gave are working here with xHarbour.
With Harbour IsDisk( "A" ) is returning .t. or .f. without giving any OS message on XP. I do not know if this works with Vista too with Harbour.
Posted: Wed Apr 02, 2008 7:43 am
by StefanHaupt
Otto,
why don´t you use the function aDrives(), that comes with Fwh ? It collects all mounted drives. See sample testdrvs.prg in the sample dir.
You can easily check if a drive is available
Code: Select all | Expand
FUNCTION IsDrive (cDrive) // cDrive -> a:, c:, ....
LOCAL aDrv := aDrives()
RETURN (AScan (aDrv, cDrive)!=0)
It´s working in XP and Vista without any exception dialog
Posted: Wed Apr 02, 2008 10:39 am
by Otto
Hello Stefan, hello NagesWaraRao,
The aDrives-function executes the same exception dialog.
At the moment only xHarbour with ErrorMode(1) as NagesWaraRao suggested is working.
DiskReady( cDisk, .F. ) here gives a:
Unresolved external '_HB_FUN_DISKREADY' referenced from
But I don't use xHarbour in my project.
Regards,
Otto
Posted: Wed Apr 02, 2008 11:32 am
by StefanHaupt
Otto wrote:The aDrives-function executes the same exception dialog.
I can´t undestand this, here it´s working fine (with harbour and xHarbour), did you try the sample testdrvs.prg ?
What OS do you use ?
Re: How to check if a drive exists
Posted: Sun May 02, 2010 1:23 pm
by mgsoft
Otto,
I have the same problem as you with Card readers.
How did you solve it?.
As this error, I have problems with protect.prg
thanks
Re: How to check if a drive exists
Posted: Sun May 02, 2010 2:34 pm
by Otto
Hello, if I remember well I have reinstalled the card reader.
Best regards,
Otto
Re: How to check if a drive exists
Posted: Sun May 02, 2010 2:39 pm
by mgsoft
Hi,
Thanks for the reply.
It is not a question of drivers.
When a card reader is installed, it creates an USB letter drive for each slot. When there is NO card inserted, you can see the unit in My PC. If you click on it, the OS gives an error that there is not disk inserted in.
If you use GetDiskFreeSpaceEx of If file refering to the that Unit, the OS gives an error that there is not disk inserted in.
http://img40.imageshack.us/i/errorusb.png/How did you solve that?.
thanks
Re: How to check if a drive exists
Posted: Sun May 02, 2010 3:30 pm
by Enrico Maria Giordano
Re: How to check if a drive exists
Posted: Sun May 02, 2010 10:29 pm
by mgsoft
Hi Entico,
Seterrormode and DiskReady() are only in xHarbour, but I use Harbour.
Thanks
Re: How to check if a drive exists
Posted: Sun May 02, 2010 11:19 pm
by Enrico Maria Giordano
It is called WAPI_SETERRORMODE() in Harbour.
EMG