Autor Beitrag
Daffke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
MS Visual C# 2005 Express Edition
BeitragVerfasst: Mi 23.05.07 18:26 
Hallihallo!

Ich schon wieder... ;-)

Kann man zur Laufzeit eigentlich ermitteln, welche anderen Anwendungen (oder geöffneten Fenster) neben der eigenen Anwendung noch laufen? Gibt's da 'ne Möglichkeit das abzufragen?

Danke.

Gruß,
Daffke

PS: Ich würde zur Abwechslung ja auch mal gerne Fragen beantworten; Hab' aber leider zu wenig Ahnung... :-(
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 23.05.07 18:49 
Auf Anhieb: Hier wird gezeigt, wie man Prozesse auflistet. Ich weiß gerade nicht so aus dem Stehgreif, ob man da auch irgendwie Fenster ermitteln kann :gruebel:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
John Sanson
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72

WinXP,WinVista
Delphi(BDS2006, 5), C#(VS2005, BDS2006), VB6
BeitragVerfasst: Mi 23.05.07 20:05 
Mit einer API Funktion geht das


Hiermit kannst du eine Fensteraufzählung abrufen:

ausblenden C#-Quelltext
1:
2:
[DllImport("user32")]
        public extern static int EnumWindows(EnumWindowsCallback lpEnumFunc, int lParam);


oder wenn du nur alle laufenden Prozesse brauchst guck mal unter ob

ausblenden C#-Quelltext
1:
System.Diagnostics.Process.GetProcesses()					


reicht.

Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
John Sanson
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72

WinXP,WinVista
Delphi(BDS2006, 5), C#(VS2005, BDS2006), VB6
BeitragVerfasst: Mi 23.05.07 20:10 
jo so gehts

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
 foreach (Process p in Process.GetProcesses())
            {
                if (p.MainWindowHandle != IntPtr.Zero)
                    listBox1.Items.Add(p.ProcessName)
            }
Daffke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
MS Visual C# 2005 Express Edition
BeitragVerfasst: Mi 23.05.07 22:04 
Hey, Klasse! :-)
Hat bestens funktioniert! *freu*
Vielen Dank!
Gruß,
Daffke
Daffke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
MS Visual C# 2005 Express Edition
BeitragVerfasst: Fr 25.05.07 15:24 
Hmmm...

Ich möchte aber ein Fenster erscheinen lassen, sobald ein Process gestartet oder beendet wird:
MessageBox.Show("Process xyz wurde gestartet/beendet") beispielsweise.
Oder eine Methode, die nur aufgerufen wird, wenn ein Process gestartet oder beendet wird.
*grübel*
Was kann man da machen?

Daffke.
John Sanson
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72

WinXP,WinVista
Delphi(BDS2006, 5), C#(VS2005, BDS2006), VB6
BeitragVerfasst: Fr 25.05.07 15:32 
Dann erstell die am besten eine Klasse mit einem Ereignis was aufgerufen wird wenn sich was ändert.
Daffke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
MS Visual C# 2005 Express Edition
BeitragVerfasst: Fr 25.05.07 19:39 
Ups... Da hab' ich mich wohl "zu weit vorgewagt".
Ich sollte mich wohl doch besser mit den Grundlagen vertraut machen.
Das mit den Klassen und Ereignissen hab' ich nämlich noch nich' ganz kapiert. :(
War ja nur so 'ne Idee...

Trotzdem danke! :)

Gruß,
Daffke.