shell 一个程序,并且获得它的HWND.

解决方案 »

  1.   

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Const SW_SHOWNORMAL = 1Private Sub Form_Load()
      Dim hwdApp                            As Long  hwdApp = ShellExecute(0, vbNullString, "Notepad.exe", vbNullString, "C:\", SW_SHOWNORMAL)
      MsgBox hwdApp
    End Sub
      

  2.   

    我用SETWINDOWPOS 怎么切换不过去呢?
    lngww = GetWindowLong(hwdApp, -16)
    If lngww And &H20000000 Then
        x = ShowWindow(hwdApp, 9)
    End If
    x = SetWindowPos(hwdApp, 0, 0, 0, 0, 0, &H40)