![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Check for removable disk an images ! how
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
|
|||
|
|||
|
Re: Check for removable disk an images ! how
On Sun, 20 Jul 2008 20:09:13 +0200, Per Juul Larsen <juul@larsen.dk>
wrote: >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
|
|||
|
|||
|
Re: Check for removable disk an images ! how
myford100@yahoo.com skrev:
> On Sun, 20 Jul 2008 20:09:13 +0200, Per Juul Larsen <juul@larsen.dk> > wrote: > >> 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
|
|||
|
|||
|
Re: Check for removable disk an images ! how
"Per Juul Larsen" <juul@larsen.dk> wrote in message news:26609$48837f50$57486c0a$18986@news.comxnet.dk ... > 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
|
|||
|
|||
|
Re: Check for removable disk an images ! how
Raoul Watson skrev:
> "Per Juul Larsen" <juul@larsen.dk> wrote in message > news:26609$48837f50$57486c0a$18986@news.comxnet.dk ... >> 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 |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|