CodeItBetter Programming Another VB Programming Blog

How to bring an external window to top using its caption

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'System & API - How to bring an external window to top using its caption
Option Explicit
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
 
Private Sub Command1_Click()
    Dim lHandle As Long
    'First we're going to retrieve the handle of this window
    lHandle = FindWindow(vbNullString, "Untitled - Notepad")
    'Set this window to the foreground
    lHandle = BringWindowToTop(lHandle)
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.