-
October 22nd, 2009, 11:13 AM
#1
VB open new program on cd rom
I have a small quesiton here -
I have found a lot of info on opening another program from VB6, however, I have an addition that I need some advice on......
I have a small VB6 program that when the user puts the CD into the disk drive then my .exe file will be called from the autorun.inf file. When this occurs my vb program will ask what the user would like to do.
There will be 3 options, however, 2 of the 3 will be calling another program located to the disk. This other program will actually be a VB.NET 2008 project.
Is there anyway to call another program located on the disk not knowing what drive the user will have set as there CD-ROM?
Example: if I call the program from the D: drive and the user has the disk in the E: drive then the program can't find the next one.....
Hope this makes sense......
Thanks in advanced
daveofgv
-
October 22nd, 2009, 07:18 PM
#2
Re: VB open new program on cd rom
How about this?
Code:
Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998 - modified by dglienna
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Path As String, strSave As String, strSave2 As String
'Create a buffer string
strSave = String(200, Chr$(0))
strSave2 = String(200, Chr$(0))
'Get the windows directory and append 'REGEdit.exe' to it
MsgBox Left$(strSave, GetWindowsDirectory(strSave, Len(strSave)))
MsgBox Left$(strSave2, GetSystemDirectory(strSave2, Len(strSave)))
End Sub
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
|