| :: How to get the handle of a window knowing his caption |
Author |
Andrea Tincani |
Language |
VB5, VB6 |
Operating
Systems |
Windows 95, 98 and NT |
| API
Declarations |
Option Explicit
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long |
| Module |
'Retrive the window's handle of the specified window's
title
Public Function WindowHandle(sTitle As String) As Long
WindowHandle = FindWindow(vbNullString, sTitle)
End Function |
| Usage |
Private Sub Command1_Click()
MsgBox WindowHandle("WindowTitle") 'Specify the exact caption of the window
End Sub |
|
 |
|
 |