读取 MainWindowHandle 来了解进程
我尝试阅读 MainWindowHanlde For Acrobat Reader 10 Process,以便我可以 SetParent API 我尝试了这个
private Process pDocked;
private IntPtr hWndDocked;
pDocked = Process.Start(path, PDFPath);
while (hWndDocked == IntPtr.Zero)
{
pDocked.WaitForInputIdle(1000);
pDocked.Refresh();
if (pDocked.HasExited)
{
return;
}
hWndDocked = pDocked.MainWindowHandle;
}
,结果是 hWndDocked = 0 即使我在 acrobat reader 9 上尝试过这个,我得到了 MainWindowHandle 但它在 acrobat reader 10 上不起作用,
请帮忙 谢谢
i tried to read MainWindowHanlde For Acrobat Reader 10 Process so i can SetParent API
i tried this
private Process pDocked;
private IntPtr hWndDocked;
pDocked = Process.Start(path, PDFPath);
while (hWndDocked == IntPtr.Zero)
{
pDocked.WaitForInputIdle(1000);
pDocked.Refresh();
if (pDocked.HasExited)
{
return;
}
hWndDocked = pDocked.MainWindowHandle;
}
and the result is hWndDocked = 0
even i tried this on acrobat reader 9 and i got the MainWindowHandle but it didn't work on acrobat reader 10
please help
And Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了同样的问题,发现当以下属性为 true 时,没有 MainWindowHandle,并且如果“主窗体”有子窗口,则进程的 MainWindowHandle 将是子窗口句柄而不是预期的主窗口。诡异的!!!希望我能理解为什么。但一旦我发现这个,我就会用另一种方式解决我的问题(在我的例子中,我并不真正需要 MainWindowHandle)!
当出现以下情况时:
No MainWindowHandle (=0)!!
如果您创建子窗口,在这种情况下,进程的 MainWindowHandle 将是 frmLogon 的句柄:
关闭 frmLogon 并将进程的 MainWindowHandle 归零(=0)!
希望这些信息有帮助!
I had same issue, and find that when the following properties are true,there is no MainWindowHandle, and if the "main form" have child window, then the MainWindowHandle of process will be the child window handle rather than the expected main window. WEIRD!!! wish I can understand why. but once I find this I solve my problem in another way (in my case I not really need the MainWindowHandle)!
When the following:
No MainWindowHandle (=0)!!
if you create sub window, in this case the MainWindowHandle of the process will be the handle of frmLogon :
Close the frmLogon and the MainWindowHandle of the process back to zero (=0)!!
Hope this info is helpful!