Alex Rivera | Logout

How do I get the handle of a console application's window

Asked 2009-08-14T12:23:28.210
56

Can someone tell me how to get the handle of a Windows console application in C#? In a Windows Forms application, I would normally try this.Handle.

Edit
Report

1 Answer

72

Not sure it works, but you can try that :

IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;
answered 2009-08-14T12:33:36.217

Your Answer