开发者

Open Event of Window and Handle of Window

开发者 https://www.devze.com 2023-02-23 13:58 出处:网络
How do I get a window handle (IntPtr) from the Outlook window I have just opened? OutLook.Items items = oFolder.Items;

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;

I am new to C sharp.


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.

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;
                        }

                    }
0

精彩评论

暂无评论...
验证码 换一张
取 消