How Can I Get CurrentWindow?
yes i want to开发者_开发问答 get a child window of another application. Give me Sum Idea or code
Here's how you could use FindWindow to retrieve the handle to a window given its title:
class Program
{
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static void Main(string[] args)
{
var hWnd = FindWindow(null, "Untitled - Notepad");
if (hWnd != IntPtr.Zero)
{
Console.WriteLine("window found");
}
else
{
Console.WriteLine("No window with given title has been found");
}
}
}
精彩评论