我如何获得一个控制台应用程序的窗口的句柄

问题描述:

谁能告诉我怎么去在C#Windows控制台应用程序的处理?在Windows窗体应用程序,我通常会尝试 this.Handle

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.

不知道它的工作原理,但你可以尝试:

Not sure it works, but you can try that :

IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;