# Re: 执行档在光碟上,用VB如何呼叫??(内文)

Posted by j on August 24, 1999 at 17:00:31:

In Reply to: Re: 执行档在光碟上,用VB如何呼叫??(内文) posted by 阿雄 on August 24, 1999 at 15:26:46:

: : : 有一个执行档GAME.EXE在光碟上,用VB的Command_chick时,如何呼叫光碟上GAME.EXE执行,谢谢!

: : 可以使用 Shell() 来执行

: 它好像固定磁碟机代号,但换别台可以出错误问题,
: 我意思是说如何自动光碟上执行......请教,谢谢!

小弟不明白你的意思？？？你的意思好像是说
光碟机代号不是固定的？如果让小弟猜到那时
在是太"赛"了！

Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long

Private Sub Command1_Click()
On Error Resume Next
Dim nDrive As String

For i = 67 To 90
nDrive = Chr(i) & ":\"
DoEvents
If GetDriveType(nDrive) = 5 Then
a = Dir(nDrive & "GAME.EXE")
If a <> "" Then
Shell nDrive & "GAME.EXE", vbNormalFocus
Exit For
End If
End If
Next i
End Sub

Follow Ups: