Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As _ Long, lpdwProcessId As Long) As Long Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As _ Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Longaa = FindWindow(vbNullString, "文件名")
GetWindowThreadProcessId aa, pID phandle = 0 phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pID) If (phandle = 0) Then MsgBox "Unable to open process!" End If phandle 为进程句柄.
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As _
Long, lpdwProcessId As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As _
Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Longaa = FindWindow(vbNullString, "文件名")
GetWindowThreadProcessId aa, pID
phandle = 0
phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pID)
If (phandle = 0) Then
MsgBox "Unable to open process!"
End If
phandle 为进程句柄.