Connecting Tech Pros Worldwide Help | Site Map

Check for removable disk an images ! how

Per Juul Larsen
Guest
 
Posts: n/a
#1: Jul 20 '08
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
Guest
 
Posts: n/a
#2: Jul 22 '08

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
Guest
 
Posts: n/a
#3: Jul 22 '08

re: Check for removable disk an images ! how


myford100@yahoo.com 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
Guest
 
Posts: n/a
#4: Jul 27 '08

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
Guest
 
Posts: n/a
#5: Jul 27 '08

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
Closed Thread