Reputation: 3
I am using C#. I intend my program can get label text from another application by click. For an example: - When I click on the File Menu in Notepad program, my console application will show "File" text. - When I click on the title of Calculator in Windows, my console application will show "Calculator". I don't know how to do that? Can some one help??
Upvotes: -4
Views: 845
Reputation: 201
First,you have to know the Handle(IntPtr) of 'another application',to do this,you can use FindWindow and FindWindowEx,both of them can be found in user32.dll. Second,you can get the text of the control that the Handel refered by sending a WM_GETTEXT message using SendMessage which can also be found in user32.dll. The syntax,usage,examples etc of SendMessage,FindWindow,FindWindowEx can all be found on MSDN.
Upvotes: 0