Connecting Tech Pros Worldwide Help | Site Map

Check for removable disk an images ! how

  #1  
Old July 20th, 2008, 07:15 PM
Per Juul Larsen
Guest
 
Posts: n/a
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
  #2  
Old July 22nd, 2008, 03:55 AM
myford100@yahoo.com
Guest
 
Posts: n/a

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.

  #3  
Old July 22nd, 2008, 10:35 AM
Per Juul Larsen
Guest
 
Posts: n/a

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
  #4  
Old July 27th, 2008, 07:35 PM
Raoul Watson
Guest
 
Posts: n/a

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


  #5  
Old July 27th, 2008, 07:55 PM
Per Juul Larsen
Guest
 
Posts: n/a

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