GetWindowText not returning all values

Mar 5, 2015 at 3:35pm
Hi I'm having trouble understanding why my GetWindowText method is only returning titles of certain windows.

Using CBT hook, I'm able to detect the active window, then I use the GeetWindowTextA method to obtain the window title.
1
2
3
HWND hWnd = (HWND) wParam;
char wnd_title[256];
GetWindowTextA(hWnd, wnd_title, 256);


However it only prints out the title name for specific windows and ignores processes like NotePad or Microsoft word.

I have tried using GetClassName aswell however I want to retrieve the window title and not the processor name.

Any ideas on why this is happenning?
Last edited on Mar 5, 2015 at 3:36pm
Mar 5, 2015 at 3:45pm
Read this:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx

To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
Mar 5, 2015 at 4:05pm
@coder777
Thanks for the quick response and answer,

GetWindowText cannot retrieve the text of a control in another application

What exactly does it mean by that?

Edit: It still doesnt return the title name of some windows (Microsoft Word, NotePad
Last edited on Mar 5, 2015 at 4:39pm
Topic archived. No new replies allowed.