|
-
Aug 22nd, 2002, 10:06 AM
#1
Thread Starter
Lively Member
Checking Whether Disk is in Floopy Drive
Hi all,
How can i check whether disk is in floppy drive?
Thanks
-
Aug 22nd, 2002, 10:13 AM
#2
-
Aug 22nd, 2002, 10:16 AM
#3
Hyperactive Member
Originally posted by Mc Brain
The easiest way is to try to read it an trap its error.
Thats a great idea..............
!!!NobodyisPerfect......IamNOBODY!!!
How's your wife and my kids?.....
Never argue with an idiot. They drag you down to their level then beat you with experience!
Child says : Mummy mummy, can i play with grandpa ?
Mum says : NO, you have already dug him up twice.
Galahtec The VB Forum
-
Aug 22nd, 2002, 10:17 AM
#4
Need-a-life Member
For example:
VB Code:
Option Explicit
Public Function IsDriveReady(Drive As String) As Boolean
Dim cDir As String
On Error GoTo NotReady
IsDriveReady = True
If Len(Drive) = 1 Then Drive = Drive & ":"
'Save the current dir
cDir = CurDir
'Change the current dir to the drive we want to test
ChDir Drive
'Change back to the path we were before
ChDir cDir
On Error GoTo 0
Exit Function
NotReady:
If Err = 75 Then
'Path/File access error
IsDriveReady = False
Resume Next
End If
End Function
Private Sub Form_Load()
MsgBox IsDriveReady("A")
'or
MsgBox IsDriveReady("A:")
End Sub
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jan 6th, 2005, 11:44 PM
#5
Banned
Re: Checking Whether Disk is in Floopy Drive
 Originally Posted by Mc Brain
For example:
VB Code:
Option Explicit
Public Function IsDriveReady(Drive As String) As Boolean
Dim cDir As String
On Error GoTo NotReady
IsDriveReady = True
If Len(Drive) = 1 Then Drive = Drive & ":"
'Save the current dir
cDir = CurDir
'Change the current dir to the drive we want to test
ChDir Drive
'Change back to the path we were before
ChDir cDir
On Error GoTo 0
Exit Function
NotReady:
If Err = 75 Then
'Path/File access error
IsDriveReady = False
Resume Next
End If
End Function
Private Sub Form_Load()
MsgBox IsDriveReady("A")
'or
MsgBox IsDriveReady("A:")
End Sub
How much of that code is really needed?
 Originally Posted by Mc Brain
For example:
VB Code:
Option Explicit
Public Function IsDriveReady(Drive As String) As Boolean
Dim cDir As String
On Error GoTo NotReady
IsDriveReady = True
On Error GoTo 0
Exit Function
NotReady:
If Err = 75 Then
'Path/File access error
IsDriveReady = False
Resume Next
End If
End Function
statement
Somthing like that?
-
Jan 7th, 2005, 03:19 AM
#6
Re: Checking Whether Disk is in Floopy Drive
You still need to read the disk.
Dir(Drive) would do it.
-
Jan 7th, 2005, 04:28 AM
#7
Need-a-life Member
Re: Checking Whether Disk is in Floopy Drive
 Originally Posted by the_inferno
How much of that code is really needed?
Somthing like that?
Two things:
a) I did not post the second snippet. I don't know why it says I originally posted.
b) You stripped out all the lines which actually "checks" if the drive is ready.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jan 7th, 2005, 02:47 PM
#8
Banned
Re: Checking Whether Disk is in Floopy Drive
 Originally Posted by Mc Brain
Two things:
a) I did not post the second snippet. I don't know why it says I originally posted.
b) You stripped out all the lines which actually "checks" if the drive is ready.
Lol, damn!
So how much do I really need?
-
Jan 7th, 2005, 02:58 PM
#9
Need-a-life Member
Re: Checking Whether Disk is in Floopy Drive
 Originally Posted by the_inferno
Lol, damn!
So how much do I really need?
Could be...
VB Code:
Public Function IsDriveReady(Drive As String) As Boolean
Dim cDir As String
On Error GoTo NotReady
IsDriveReady = True
If Len(Drive) = 1 Then Drive = Drive & ":"
cDir = Dir(Drive)
On Error GoTo 0
Exit Function
NotReady:
If Err.Number = 75 Then
'Path/File access error
IsDriveReady = False
Resume Next
ElseIf Err.Number = 52 Then
'Bad file name or number
IsDriveReady = False
Resume Next
End If
End Function
Private Sub Form_Load()
MsgBox IsDriveReady("A")
'or
MsgBox IsDriveReady("A:")
End Sub
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|