Click here to Skip to main content
15,927,344 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292175-Jan-08 17:45
Member 45292175-Jan-08 17:45 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292177-Jan-08 1:54
Member 45292177-Jan-08 1:54 
GeneralRe: Get the caption (or text) of a running application Pin
Muammar©4-Jan-08 22:27
Muammar©4-Jan-08 22:27 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292175-Jan-08 17:47
Member 45292175-Jan-08 17:47 
GeneralRe: Get the caption (or text) of a running application Pin
Muammar©5-Jan-08 18:33
Muammar©5-Jan-08 18:33 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292176-Jan-08 11:18
Member 45292176-Jan-08 11:18 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292176-Jan-08 11:45
Member 45292176-Jan-08 11:45 
GeneralRe: Get the caption (or text) of a running application Pin
Member 45292176-Jan-08 12:03
Member 45292176-Jan-08 12:03 
Hi again:

Here is the piece of code that I am trying to use for this. This code will get the processes' names and their titles with their corresponding id. I'd like to get to the text of a button of a particular process. I don't even need to click it, I only need the value of the text, so that I can execute some message to be sent to someone or write an entry to the Windows event log (which I can do).

/***** Code starts here *****/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;


namespace ProcessTitle
{
class Program
{

static void Main(string[] args)
{

StringBuilder sb = new StringBuilder();


foreach (Process p in Process.GetProcesses()) //local machine
{
try
{

//try to get a handle on the Windows - Not doing anything with this. I'd like
//to use this to get the text of my button
IntPtr hWnd =
System.Diagnostics.Process.GetProcessById(p.Id).MainWindowHandle;


sb.Append("Windows Title: " + p.MainWindowTitle + Environment.NewLine);
sb.Append("Process Name: " + p.ProcessName + Environment.NewLine);
sb.Append("PID: " + p.Id.ToString() + Environment.NewLine);
}
catch
{
}
}

Console.Write(sb);
Console.Read();

}
}
}
/***** Code ends here ***/

Gbenga
GeneralRe: Get the caption (or text) of a running application Pin
Muammar©6-Jan-08 20:05
Muammar©6-Jan-08 20:05 
QuestionDrag'n Drop from ListViewControl Pin
kozu4-Jan-08 11:56
kozu4-Jan-08 11:56 
GeneralRe: Drag'n Drop from ListViewControl Pin
Patrick Etc.5-Jan-08 3:17
Patrick Etc.5-Jan-08 3:17 
QuestionWebBrowser control only passing cookies on development machine [modified] Pin
Miles4-Jan-08 11:45
Miles4-Jan-08 11:45 
QuestionDrag and drop user control on double buffered panel ??? Pin
conemajstor4-Jan-08 10:54
conemajstor4-Jan-08 10:54 
Questionhow can i get the level of battery and memory in c# code ? Pin
E_Gold4-Jan-08 10:01
E_Gold4-Jan-08 10:01 
Generalconnecting labels on a panel with lines Pin
dfn4-Jan-08 9:46
dfn4-Jan-08 9:46 
GeneralRe: connecting labels on a panel with lines Pin
dfn4-Jan-08 9:49
dfn4-Jan-08 9:49 
GeneralRe: connecting labels on a panel with lines Pin
Christian Graus4-Jan-08 9:52
protectorChristian Graus4-Jan-08 9:52 
GeneralRe: connecting labels on a panel with lines Pin
dfn4-Jan-08 10:38
dfn4-Jan-08 10:38 
QuestionHow to upload heavy duty files Pin
er.ankitsingh4-Jan-08 8:51
er.ankitsingh4-Jan-08 8:51 
GeneralRe: How to upload heavy duty files Pin
Stevo Z4-Jan-08 9:26
Stevo Z4-Jan-08 9:26 
GeneralRe: How to upload heavy duty files Pin
alpha.yu4-Jan-08 14:53
alpha.yu4-Jan-08 14:53 
Generaldesign to an interface Pin
netJP12L4-Jan-08 8:41
netJP12L4-Jan-08 8:41 
GeneralRe: design to an interface Pin
Christian Graus4-Jan-08 9:54
protectorChristian Graus4-Jan-08 9:54 
Generalcannot bind to the new display member Pin
azza1044-Jan-08 8:18
azza1044-Jan-08 8:18 
GeneralRe: cannot bind to the new display member Pin
Dave Kreskowiak4-Jan-08 8:41
mveDave Kreskowiak4-Jan-08 8:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.