开发者

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");
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜