ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SendMessageString ...Maybe !!?? (https://www.excelbanter.com/excel-programming/334829-sendmessagestring-maybe.html)

RAFAAJ2000[_2_]

SendMessageString ...Maybe !!??
 
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.

sebastienm

SendMessageString ...Maybe !!??
 
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

--
Regards,
Sébastien


"RAFAAJ2000" wrote:

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.



All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com