Shoutbox

Change window caption, not with SetWindowText!!! - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Change window caption, not with SetWindowText!!! (/showthread.php?tid=64689)

Change window caption, not with SetWindowText!!! by Shondoit on 08-09-2006 at 11:05 AM

I want to change the caption of a chatwindow, where it says who you are talking to (Contact name)
It is just a label, so I can't change it with SetWindowText
But how do I get the handle of this label, and change it?


RE: Change window caption, not with SetWindowText!!! by RaceProUK on 08-09-2006 at 02:42 PM

You'll have to use Active Accessibility to obtain, not a handle, but an interface to the caption. You can get an IAccessible interface from an HWND, and from that, obtain the IAccessible for the caption. Accessibility Explorer will help you here (it's an MS development tool).
Once you have the caption's IAccessible, I believe the method is called acc_SetText(). As it's a COM interface, it'll require you to pass a BSTR. A hack is to pass a wchar_t pointer, but be warned: as a wchar_t* isn't a fully-defined BSTR, the code may not be perfectly stable.

Of course, if this is going to be entirely in JScript, all strings are BSTR by default ;)


RE: Change window caption, not with SetWindowText!!! by Shondoit on 08-09-2006 at 02:50 PM

@Matty, because I was talking about a ChatWindow, changing the caption in realtime
@RaceProUK could you give me an example, I'm completely lost, or at least a link where I can find 'Accessibility Explorer'