Click to See Complete Forum and Search --> : Hook Message GetText In TextBox
NOV_8x
February 8th, 2010, 10:32 PM
I am writing Hack game Wow.exe,i want get UserName and password when gamer type it,but i dont get hWnd for textbox ,beacause i want hook message WM_GETTEXT for wow.exe,can you help me ?
LRESULT CALLBACK GetMesgProc(int nCode, WPARAM wParam, LPARAM lParam) {
PMSG pmsg;
if (nCode < 0)
return CallNextHookEx(hNextHook, nCode, wParam, lParam);
pmsg = (PMSG)lParam;
switch (pmsg->message) {
case WM_GETTEXT: //i want get text but dont Handle of Textbox password
break;
};
return CallNextHookEx(hNextHook, nCode,wParam, lParam);
}
Krishnaa
February 9th, 2010, 12:27 AM
What do you mean by Hack game ? Are you saying you want to capture the user name & password inside a third party game program ? if so, do you that it is illegal to do so ?
NOV_8x
February 9th, 2010, 12:49 AM
yes,i am sorry,i found on google hook message WM_Gettext dont get text when user input password and username
There is two different ways a window can handle its text. Either let system handle it or handle it themself. If the system handles it it will store the text passed to CreateWindow/CreateWindowEx in a dedicated memory area. This is returned by GetWindowText or by sending WM_GETTEXT. However the window/control can handle it themselfs, which is pretty common for a control to do. In that case the control handles the WM_GETTEXT and WM_GETTEXTLENGTH messages and returns whatever text they want/use.
So when you send a WM_GETTEXT message, if the window/control doesn't handle that message itself, Windows will return the string stored in the dedicated memory area when the window was created, and it will replace it if a WM_SETTEXT message is sent. This is the default behaviour.
Now, if you use the GetWindowText function it will send a WM_GETTEXT message if the window you're requesting the text for have been created by the same process that calls GetWindowText. But if you use GetWindowText on a control in another process it will return the text stored in this special memory area and not send a WM_GETTEXT message. The reason for this is simply because if GetWindowText would send the message to a window that is hung it would never return, hence hanging the process that call the function. That would cause a huge problem for such things as the task switcher that would hang if one window is hung. A hung application/window shouldn't cause problems for other applications/windows.
This is also the reason you can get different values using GetWindowText and sending WM_GETTEXT to a control. The control was created with a call to CreateWindow or CreateWindowEx with one text (that will be returned by GetWindowText) and then handles the WM_GETTEXT message itself and returns something else. So if you want to be sure to get the correct text you should use WM_GETTEXT for other processes, however you should also be aware that if the window/control in question is hung SendMessage will never return. So the best approach is to use SendMessageTimeout instead of SendMessage.
__________________
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.