What technique does Snoop uses to inspect a WPF application

前端 未结 4 1800
一向
一向 2021-02-06 01:15

Snoop, the spy utility, uses some powerful technique (probably some sort of reflection) to inspect a running WPF application. Most interesting is the fact, that Snnop is able to

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-06 01:57

    The answer above doesn't work for me. It seems a bit vague. I expanded on accepted answer a little with this code:

        var allProcesses = Process.GetProcesses();
        var filteredProcess = allProcesses.Where(p => p.ProcessName.Contains(ProcessSearchText)).First();
        var windowHandle = filteredProcess.MainWindowHandle;
        var hwndSource = HwndSource.FromHwnd(windowHandle);
    

    This answer seems more complete and will work for others if the accepted answer works for anyone. However, this the last line of this code returns null for me.

提交回复
热议问题