Hi,
I know there is an API - SendMessage - to change Title OR Caption of other window-program, I also know That i will need the hWnd. What is the function ? How can i invoke it?
Thanks
Printable View
Hi,
I know there is an API - SendMessage - to change Title OR Caption of other window-program, I also know That i will need the hWnd. What is the function ? How can i invoke it?
Thanks
Hi,
what u'll need to do is first find the handle of the window. For this u can use the FindWindow API. Once u've got the handle use the SendMessage API to change the caption.
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_SETTEXT = &HC
Private Sub Command1_Click()
Dim x, y
x = FindWindow("Notepad", vbNullString)
y = SendMessage(x, WM_SETTEXT, ByVal CLng(0), ByVal Text1.Text)
End Sub
Text1 --> a textbox where the new caption is entered.
-------------------------------------------------
Im changing the caption of a notepad file. U can locate any file u want by changing the parameters of the FindWindow API. If u need, u can check
http://www.vbapi.com/ref/f/findwindow.html
for more info on the FindWindow API.
Hope this is what u want.
Rammy.