Exemplo n.º 1
0
 public void AddNewWindow(IntPtr hwnd)
 {
     this.Dispatcher.Invoke(() =>
     {
         if (windows.Exists(x => x.hWnd == hwnd))
         {
             return;
         }
         Window_Control temp = GetNewControl(hwnd);
         windows.Add(temp);
         WindowsPanel.Children.Add(temp);
     });
 }
Exemplo n.º 2
0
        public Window_Control GetNewControl(IntPtr hwnd)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            Window_Control temp = new Window_Control();

            temp.hWnd = hwnd;
            //temp.ProcessName = WindowHelper.GetProcessName(temp.hWnd);//耗时
            temp.WindowName      = WindowHelper.GetWindowName(temp.hWnd);
            temp.WindowClassName = WindowHelper.GetClassName(temp.hWnd);
            sw.Stop();
            System.IO.File.AppendAllText(@"e:\GetNewControl.txt", $"GetNewControl:time:[{sw.Elapsed.TotalMilliseconds}]{Environment.NewLine}");
            return(temp);
        }