| Код | Option Explicit
Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) Private Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" (ByVal hWndParrent As Long, ByValhWndChildren As Long, ByVal lpClassName As String, ByVal lpWindowName As String)
Dim hw As Long
Private Declare Function GetWindowThreadProcessId _ Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Sub Command1_Click()
Dim sCaption As String
sCaption = "Безымянный - Блокнот"
hw = FindWindow(vbNullString, sCaption)
Dim pID As Long
MsgBox "Хэндл = " & hw MsgBox "pID = " & GetWindowThreadProcessId(hw, pID)
End Sub
|
|