原程序如下:
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

解决方案 »

  1.   

    PRGpath1 = CurDir()这句有问题
    你是不是想得到应用程序运行路径?
    应该这样写
    PRGpath1 = App.Path
      

  2.   

    在Windows中CurDir是系统当前路径,并不是应用程序运行路径
      

  3.   

    可是在win98/se/me下却运行正常啊?
      

  4.   

    你在每一句话前面加一个MsgBox n
    n=1,2,3...
    然后再运行看看是在那一句出的错
    然后再判断
    先别可是
      

  5.   

    我现在的系统是win me没安装win2000,无法测试。
      

  6.   

    ???!!!!...
    不管怎么说,你写的PRGpath1 = CurDir()这句话是不是想得到应用程序运行路径?
    如果是那肯定没错改成PRGpath1 = App.Path 就行了.
      

  7.   

    路径问题,ctrl+F8或用Debug.Print试一下看看使用时的路径.