Results 1 to 2 of 2

Thread: SemdMessage Help PLEASE !!!!

  1. #1

    Thread Starter
    Addicted Member Tiovital's Avatar
    Join Date
    Apr 2000
    Posts
    249

    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


  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    Cool try this.....

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width