SendMessageString ...Maybe !!??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a Window ( Button Class) using the ' CreateWindowEx ' API and
would like to dinamically change its Caption .

I have been trying the ' Send MessageString' API but without any luck :(

Here is part of my code :

Sub CreateButton()
lngBtnHndl = CreateWindowEx(0, "Button", "Test !", WS_CHILD, _
ActiveWindow.Width * 3 / 4, 0, 50, 25, Application.hwnd, 0, 0, 0)
SetParent lngBtnHndl, Application.hwnd
ShowWindow lngBtnHndl, SW_NORMAL
End Sub


Any one any ideas ?

Thanks.
 
Hi,

Have you tried the SetWindowText API?

Declare Function SetWindowText& Lib "user32" Alias "SetWindowTextA" (
ByVal hwnd as Long,
ByVal lpString As String
)

then

Dim result as long
result = SetWindowText( lngBtnHndl , "Hello" )
if result = 0 then
msgbox "cannot set caption"
end if
 
Back
Top