Anita Mallya
2009-03-05 06:43:56 UTC
I am a Visual Foxpro Programmer. I have understood lately that Windows API calls can be given using Visual Foxpro 9.0 Professional Edition.
Is there a Visual Foxpro programmer using VFP 9.0 Professional Edition in this forum or elsewhere on the net (whom u know) who has good knowledge of Visual Foxpro as well as Win32 API and who could help me?
I wish to know what is the small VFP program (function) I have to write in Visual Foxpro such that my program will understand what are the various drives that are present on the user's PC (without physically accessing those drives)
What I mean by physically accessing is -> For example if I give command SET DEFA TO E:\ (believing that Foxpro will give an error to me 'Invalid Path" if this drive doesn't exists on my PC I found two problems here:
Problem # 1: My computer doesn't have A:\ drive (that is floppy). But when I gave SET DEFA TO A:\ nothing happened for a while and then Windows gave its own message "Drive Not Ready" with three command buttons "Cancel; Try Again; Continue" and then if I pressed Cancel in Windows Error Dialog I was shown by Foxpro Invalid Path. Which means Foxpro or Windows actually physically tried to access the drive.
What I want is internally some Windows command should tell me whether a particular drive is present on users PC. For example suppose there is a Windows call
isdrivexists("A:") where A: Drive letter is passed as parameter then that Windows call will return some value which will tell me whether A:\ exists on users PC or not. So physically that drive is not accessed (and so no error "Drive Not Ready" is generated and flashed in a window by Windows). But internally I get to know that A: doesn't exist.
Problem # 2: My computer has DVD RW drive. But when I gave SET DEFA D:\ (which is DVD RW) Foxpro gave me error "Invalid drive". So immediately I understood that SET DEFA TO >>drive letter>> is useless to ascertain what drives are present on user's computers. Because in this case athough D:\ existed on my PC Foxpro gave me "Invalid drive or path" error (just because it didn't find a DVD in that drive). Now, while I am checking which drives exists the user may not be having a DVD put into his DVD Writer and so foxpro will return "Invalid drive or path" (so this SET DEFA TO command is not good to detect whether a drive exists on a user's PC).
Basically, In my Foxpro program I wish to show Drive Letters of Valid drives that are present on user's PC. So if some user has C:\ and D:\ but doesn't have A:\ then only C:\ and D:\ will be shown in drop box list. Got It!
For that I need a Windows call to internally ascertain what drives are present on user's PC. And I wish to know how to use that call from within Foxpro. So only a person who knows both Foxpro as well as Windows programming can tell me how to go about it.
Thanks & Regards,
Anita Mallya.