Connecting Tech Pros Worldwide Forums | Help | Site Map

get the text from a window in an external program

Newbie
 
Join Date: Oct 2008
Posts: 3
#1: Oct 16 '08
Hi

Is it possible via C# to capture content of a window in a windows application?

I have an application(mp3 player) with several windows and in one of them there are lines of text(names of the mp3 files). I want to to capture what filename is selected and activated(played).

I have some hunch that it might be the process class I have to use, but how do I tell it what window to capture from and what filename is selected and activated?

joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#2: Oct 16 '08

re: get the text from a window in an external program


Well if it's an application you created then I think there are ways you can create to communicate the information with each other, but if its just an external program, then I don't think it's possible.

joedeene
Newbie
 
Join Date: Oct 2008
Posts: 3
#3: Oct 16 '08

re: get the text from a window in an external program


It is a program that I haven't created and I don't have the source code.

I know it is possible with a console application. But what about a windows application?
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#4: Oct 16 '08

re: get the text from a window in an external program


There exists some win32_API that can do that. You would need to check with the c++ folks for the details though
joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#5: Oct 16 '08

re: get the text from a window in an external program


Well, what's some of the code that you can do it for the console app, because a windows app's code is not much different from the console's...And I can help you translate it, if you are running into problems coding spefically any section...?

joedeene
Newbie
 
Join Date: Oct 2008
Posts: 3
#6: Oct 16 '08

re: get the text from a window in an external program


well, this article nicely shows how to capture output from a console program.

http://www.codeproject.com/KB/cs/ProcessStartDemo.aspx

But it doesn't work with a windows application. No output is done.
Reply