E1M1 Posted August 2, 2012 Share Posted August 2, 2012 I cant find way to read text from notepad. I want to write ControlGetText in C++. I got no errors but for some reason messagebox shows me nothing. I've googled but havent found any good example yet. void CopyDataSend(){ //HWND hWnd = FindWindowW(NULL,L"D4672AD6-EA21-4FFD-88F5-4641A2B33E9F"); HWND hWnd = FindWindowW(NULL,L"Untitled - Notepad"); HWND hEdit = FindWindowEx(hWnd,NULL,"Edit",NULL); printf("%X %X",hWnd,hEdit); char sData[100]; GetWindowTextA(hEdit, sData,100); MessageBoxA(0,sData,"",0); } edited Link to comment Share on other sites More sharing options...
funkey Posted August 2, 2012 Share Posted August 2, 2012 From MSDN:GetWindowText cannot retrieve the text of a control in another applicationTo retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
E1M1 Posted August 2, 2012 Author Share Posted August 2, 2012 Thanks. Didn't notice it on first read. edited Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now