Hi all . could any one show me how i can change the caption of external window?Thanks
Printable View
Hi all . could any one show me how i can change the caption of external window?Thanks
You use the FindWindow API to get the handle of the window you want and then the SetWindowText API to change the text. If you search for these two APIs you'll find more than enough examples :)
thank u for reply. I do not want to change the text i mean change caption. Could u show me how ? i have no experince one changing caption of window.Quote:
Originally Posted by manavo11
Open a notepad window and try the following :
VB Code:
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Sub Form_Load() Dim hNotepad As Long hNotepad = FindWindow("notepad", vbNullString) SetWindowText hNotepad, "test" End Sub
Only, instead of using the "notepad" classname, you need to either change the classname to that of the window you want to change or use the caption of the window to find it's handle :)
Thank u for u reply . It worked perfectly. Is there away to bring a window in front baced on its caption ?Thanks
VB Code:
AppActivate "Untitled - Notepad"