borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincani
:: 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

:: Navigation

Home

Miscellaneous API Tips

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 13-09-2003 Re: Set Focus to Access application by Goran
icon 16-08-2003 Re: Got a handle to a window-can I find if the path/filename of the window's file has changed? by Goran
icon 29-07-2003 Re: Help on Building a "Yahoo! 5.5 Booter" by JLRodgers
icon 18-07-2003 Help on Building a "Yahoo! 5.5 Booter" by Afshin_Zavar
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder