窗口打开事件和窗口的句柄 [英] Open Event of Window and Handle of Window
本文介绍了窗口打开事件和窗口的句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何从我刚才打开Outlook窗口获取窗口句柄(IntPtr的)?
How do I get a window handle (IntPtr) from the Outlook window I have just opened?
OutLook.Items items = oFolder.Items;
foreach (OutLook.MailItem mail in items)
{
mail.Display();
//IntPtr a = (System.IntPtr)mail.GetInspector.Parent;
我是新的C锋利。
I am new to C sharp.
推荐答案
我想我会用这个解决方案来解决。我希望的东西很多比较扎实,但是这是大约80%的固体。有兴趣的看看别人怎么想。
I think I'll have to settle with this solution. I was hoping for something a lot more solid, but this is about 80% solid. Interested to see what others think.
通过窗口标题其标准的get窗口:
Its standard get window by window title:
Process[] processes = Process.GetProcessesByName("OUTLOOK");
foreach (Process p in processes)
{
if (p.MainWindowTitle == mail.GetInspector.Caption)
{
handle = p.MainWindowHandle;
break;
}
}
这篇关于窗口打开事件和窗口的句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文