views:

44

answers:

1

With C#, i use this code to list main window processes titles

Process[] ProcessArray = Process.GetProcesses();
try {
    foreach (Process proc in ProcessArray) {
        Console.WriteLine(proc.MainWindowTitle);
    }
} catch (Exception ex) {
    Console.WriteLine(ex.Message);
}

but this doesn't work to see mainwindowtitle of processes reduced in the taskbar. How to do this ?

A: 

Instead of looping through the processes you can probably use the EnumWindows api function through the P/Invoke layer.

Once you have the window handles, you can call the GetWindowText to get the title of the window.

casperOne
thank's it works perfectly :-)
eka808
@eka808: Glad to hear it. Convention on Stack Overflow is to accept an answer if it is the correct answer to your question. This rewards the person who gave it, as well as places it at the top of the responses for better indexing as well as better visibility for those that have the same question.
casperOne
My creepy code sample to demonstrate how it works :-)http://pastebin.com/b8pu1VWv
eka808