Jump to content

Recommended Posts

Posted

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

Posted

From MSDN:

GetWindowText cannot retrieve the text of a control in another application

To 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 to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...