0

As of now in C#n we can get listener for on exit for any process running in the system. But I would like to know any listener or is there any listener we can custom develop to listen a process when it is focused.

Ex. My C# app should trigger a function when the listening process(application) is on focus.

Ed B
  • 6,028
  • 3
  • 26
  • 35
Suresh Balaji
  • 109
  • 2
  • 12
  • Check similar thread - http://stackoverflow.com/questions/2183541/c-detecting-which-application-has-focus – Nitin Rastogi Dec 02 '11 at 09:12
  • Thanks it s great and worked. – Suresh Balaji Dec 02 '11 at 09:40
  • const int WM_ACTIVATEAPP = 0x001C; protected override void WndProc(ref Message m) { if ((m.Msg == WM_ACTIVATEAPP) && (m.WParam == IntPtr.Zero)) { MessageBox.Show("HI HRU"); //OnDeactivateApp(EventArgs.Empty); } else base.WndProc(ref m); } – Suresh Balaji Dec 02 '11 at 09:43

0 Answers0