原程序如下:
Private Declare Function GetWindowsDirectory Lib "Kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function WaitForSingleObject Lib "Kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Sub Main()
ChDrive App.Path
ChDir App.Path
If App.PrevInstance Then
'MsgBox ("不可重复运行!"), vbExclamation
End
End If
Form1.Show 1
Dim PRGpath1
Dim wb As String
Dim wp As Integer
Dim winpath As String
Dim h As Long
Dim I As Long
Dim r As Long
Dim p As Long
Dim sysfile4 As String
PRGpath1 = CurDir()
wb = Space(260)
wp = GetWindowsDirectory(wb, Len(wb))
winpath = Left(wb, wp)
SaveSetting "PFILE", "SET", "PRGpath", PRGpath1
sysfile4 = Dir(PRGpath1 + "\PFILE.exe")
If sysfile4 = "" Then
MsgBox (curpath1 + "目录中缺少系统文件" + Chr(13) + Chr(10) + "PFILE.exe,请与作者联系!" + Chr(13) + Chr(10) + "系统无法运行!!"), vbExclamation
End
End If
I = Shell(winpath + "\PFILE.exe", vbNormalFocus)
p = OpenProcess(SYNCHRONIZE, False, I)
r = WaitForSingleObject(p, INFINITE)
r = CloseHandle(p)
End Sub