Sub Main ()
if app.Preveinstance then end
End Sub

解决方案 »

  1.   

    Sub Main ()
    if app.Preveinstance=true then end
    End Sub
      

  2.   

    如果是本程序则:
    if app.Preveinstance=true then end
    如果是外部程序则:Public Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long  dim hdl_ep as long
    sub form_load()
       If hdl_ep = 0 Then
         Shell Winpath & "\explorer.exe c:\", vbNormalFocus
        Do While hdl_ep = 0
           hdl_ep = FindWindow("CabinetWClass", " (C:)")
            DoEvents
         Loop
       Else
           
          bool = OpenIcon(hdl_ep)
          bool = SetWindowPos(hdl_ep, HWND_TOP, 0, 0, 1024, 768, 0) 
          If bool = 0 Then
              Shell Winpath & "\explorer.exe c:\", vbNormalFocus
              hdl_ep = 0
              Do While hdl_ep = 0
                hdl_ep = FindWindow("CabinetWClass", " (C:)")
                DoEvents
              Loop
               SetWindowPos hdl_ep, HWND_TOP, 0, 0, 800, 600, 0
           End If
        End If
    end sub
      

  3.   

    如果是本程序则:
    if app.Preveinstance=true then end
    如果是外部程序则:Public Declare Function OpenIcon Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long  dim hdl_ep as long
    sub form_load()
       If hdl_ep = 0 Then
         Shell Winpath & "\explorer.exe c:\", vbNormalFocus
        Do While hdl_ep = 0
           hdl_ep = FindWindow("CabinetWClass", " (C:)")
            DoEvents
         Loop
       Else
           
          bool = OpenIcon(hdl_ep)
          bool = SetWindowPos(hdl_ep, HWND_TOP, 0, 0, 1024, 768, 0) 
          If bool = 0 Then
              Shell Winpath & "\explorer.exe c:\", vbNormalFocus
              hdl_ep = 0
              Do While hdl_ep = 0
                hdl_ep = FindWindow("CabinetWClass", " (C:)")
                DoEvents
              Loop
               SetWindowPos hdl_ep, HWND_TOP, 0, 0, 800, 600, 0
           End If
        End If
    end sub