Get WPF window by hWnd

后端 未结 4 841
臣服心动
臣服心动 2020-12-17 16:42

I am looking to get a WPF window and traverse it\'s controls. I\'m able to get the hWnd and i\'ve found other posts on traversing the controls using a DependencyObject. How

4条回答
  •  被撕碎了的回忆
    2020-12-17 17:02

    As far as I know WPF completely replaces WinApi model with all that HWNDs. Main window has HWND of course, because it servers as container between WinApi and WPF. You can access HWND using WindowInteropHelper Class, like this. But you will not be able to traverse controls the same way you would do it with native or WinForms app. Check VisualTreeHelper for traversing control trees in WPF.

提交回复
热议问题