Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Check for removable disk an images ! how

Question posted by: Per Juul Larsen (Guest) on July 20th, 2008 06:15 PM
Hi
my VB program must always start from a removable disk. In addition, on
the removable media to be images of the type *. jpg *. tips.
If not the two conditions are present, the programme will end with a
message.

How do I write this little control function in Visual Basic

regards pjl
myford100@yahoo.com's Avatar
myford100@yahoo.com
Guest
n/a Posts
July 22nd, 2008
02:55 AM
#2

Re: Check for removable disk an images ! how
On Sun, 20 Jul 2008 20:09:13 +0200, Per Juul Larsen <juul@larsen.dk>
wrote:
Quote:
>Hi
>my VB program must always start from a removable disk. In addition, on
>the removable media to be images of the type *. jpg *. tips.
>If not the two conditions are present, the programme will end with a
>message.
>
>How do I write this little control function in Visual Basic
>
>regards pjl


Is there a requirement that this be done in Visual Basic? Go to
http://irfanview.com/ and look at the first item in the FAQ.

It is possible this is not what you are wanting to do. If not,
perhaps someone else can help.


Per Juul Larsen's Avatar
Per Juul Larsen
Guest
n/a Posts
July 22nd, 2008
09:35 AM
#3

Re: Check for removable disk an images ! how
Join Bytes! skrev:
Quote:
On Sun, 20 Jul 2008 20:09:13 +0200, Per Juul Larsen <juul@larsen.dk>
wrote:
>
Quote:
>Hi
>my VB program must always start from a removable disk. In addition, on
>the removable media to be images of the type *. jpg *. tips.
>If not the two conditions are present, the programme will end with a
>message.
>>
>How do I write this little control function in Visual Basic
>>
>regards pjl

>
Is there a requirement that this be done in Visual Basic? Go to
http://irfanview.com/ and look at the first item in the FAQ.
>
It is possible this is not what you are wanting to do. If not,
perhaps someone else can help.
>

irfanview is free and a super program, though I want to make a small vb
program instead, which do not have to fill much.
Perhaps it can be done as a Dos Batch program instead.
Thank you for your reply
mvh pjl

Raoul Watson's Avatar
Raoul Watson
Guest
n/a Posts
July 27th, 2008
06:35 PM
#4

Re: Check for removable disk an images ! how

"Per Juul Larsen" <juul@larsen.dkwrote in message
news:26609$48837f50$57486c0a$18986@news.comxnet.dk ...
Quote:
Hi
my VB program must always start from a removable disk. In addition, on the
removable media to be images of the type *. jpg *. tips.
If not the two conditions are present, the programme will end with a
message.
>
How do I write this little control function in Visual Basic
>
regards pjl


When you start the program, simply check the current app.path drive
type. If it is not removable, terminate.


Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Const DRIVE_REMOVABLE = 2
Const DRIVE_REMOTE = 4
Const DRIVE_RAMDISK = 6
Const DRIVE_FIXED = 3
Const DRIVE_CDROM = 5

'syntax: MyDriveType("a:") or MyDriveType(dir1.path) etc..,

Function MyDriveType(ByVal DR As String) As String
DR = Left$(DR, 2)
x% = GetDriveType(DR)
Select Case x%
Case DRIVE_REMOVABLE
MyDriveType = "REMOVABLE " & DR
Case DRIVE_FIXED
MyDriveType = "FIXED " & DR
Case DRIVE_REMOTE
MyDriveType = "REMOTE " & DR
Case DRIVE_RAMDISK
MyDriveType = "RAMDISK " & DR
Case DRIVE_CDROM
MyDriveType = "CDROM " & DR
Case Else
MyDriveType = "UNKNOWN " & DR
End Select
End Function



Per Juul Larsen's Avatar
Per Juul Larsen
Guest
n/a Posts
July 27th, 2008
06:55 PM
#5

Re: Check for removable disk an images ! how
Raoul Watson skrev:
Quote:
"Per Juul Larsen" <juul@larsen.dkwrote in message
news:26609$48837f50$57486c0a$18986@news.comxnet.dk ...
Quote:
>Hi
>my VB program must always start from a removable disk. In addition, on the
>removable media to be images of the type *. jpg *. tips.
>If not the two conditions are present, the programme will end with a
>message.
>>
>How do I write this little control function in Visual Basic
>>
>regards pjl

>
When you start the program, simply check the current app.path drive
type. If it is not removable, terminate.
>
>
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Const DRIVE_REMOVABLE = 2
Const DRIVE_REMOTE = 4
Const DRIVE_RAMDISK = 6
Const DRIVE_FIXED = 3
Const DRIVE_CDROM = 5
>
'syntax: MyDriveType("a:") or MyDriveType(dir1.path) etc..,
>
Function MyDriveType(ByVal DR As String) As String
DR = Left$(DR, 2)
x% = GetDriveType(DR)
Select Case x%
Case DRIVE_REMOVABLE
MyDriveType = "REMOVABLE " & DR
Case DRIVE_FIXED
MyDriveType = "FIXED " & DR
Case DRIVE_REMOTE
MyDriveType = "REMOTE " & DR
Case DRIVE_RAMDISK
MyDriveType = "RAMDISK " & DR
Case DRIVE_CDROM
MyDriveType = "CDROM " & DR
Case Else
MyDriveType = "UNKNOWN " & DR
End Select
End Function
>
>


Thank you
A very good solution which I now use it.
best regards
pjl

 
Not the answer you were looking for? Post your question . . .
189,870 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors