Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
outlook C#加载项中的sendmessage不工作_C#_Outlook_Vsto_Outlook Addin - Fatal编程技术网

outlook C#加载项中的sendmessage不工作

outlook C#加载项中的sendmessage不工作,c#,outlook,vsto,outlook-addin,C#,Outlook,Vsto,Outlook Addin,我正在尝试使用SendMessage获取Outlook C#加载项以滚动左侧导航窗格。这似乎没有效果。外接程序是否在低于Outlook的权限级别下运行,从而由于UIPI而阻止SendMessage工作 我使用EnumChildWindows(递归)迭代以查找左侧导航窗格子窗口的句柄(使用Spy++标识),使用GetWindowText按类名查找它。“workerBeeFunc”是EnumChildWindows调用的我的委托。Spy++告诉我导航窗格窗口是第二个窗口的子窗口,该窗口的类名为“NU

我正在尝试使用SendMessage获取Outlook C#加载项以滚动左侧导航窗格。这似乎没有效果。外接程序是否在低于Outlook的权限级别下运行,从而由于UIPI而阻止SendMessage工作

我使用EnumChildWindows(递归)迭代以查找左侧导航窗格子窗口的句柄(使用Spy++标识),使用GetWindowText按类名查找它。“workerBeeFunc”是EnumChildWindows调用的我的委托。Spy++告诉我导航窗格窗口是第二个窗口的子窗口,该窗口的类名为“NUIDocumentWindow”(我将所有WinAPI DLLImport语句都放在这里):

SendMessage会因为UIPI而自动失败吗


谢谢。

加载项与Outlook本身在相同的安全上下文中运行


不要求任何控件使用WM_VSCROLL消息。你真的在Spy++中看到了吗?

不,我对Spy++不太熟悉,但我在表面上看到了什么。它能够显示应用程序响应的事件吗?当然可以,在Spy++中显示“Spy | Log Messages”。谢谢!我不知道。当我尝试时,日志显示什么都没有。不知道为什么,除非这些消息被删除。作为跟进:是否有任何消息可以发送给Outlook控件,它将响应这些消息并导致所需的行为?我研究了使用SendInput发送一系列向下箭头消息,但还没有尝试过。
private const int WM_VSCROLL = 277; // Vertical scroll
private const int SB_PAGEDOWN = 3; // Scrolls one page down
static StringBuilder childWindowNames = new StringBuilder();
private int NUIWindowCounter = 0;
private stopIterating as bool = false;

public delegate int EnumChildProc(IntPtr hWnd, IntPtr lParam);  //Declare the delegate

public int workerBeeFunc(IntPtr hwndChild, IntPtr Param) //The function the delegate of EnumChildWindows goes to to get the work done.
{
   int a;
   a = WinAPIs.GetWindowText(hwndChild, childWindowNames, 100); //childWindowNames gets cleared on each iteration of this function

   if (childWindowNames.ToString() == "NUIDocumentWindow")
   { 
      NUIWindowCounter++;


      if (NUIWindowCounter == 2)  //The NEXT window is the Navigation Pane
      {
         stopIterating = true;
      }
   return 1;  //Keep iterating
   }

   if (stopIterating == true)
   {
      SendMessage(hwndChild, WM_VSCROLL, (IntPtr)SB_PAGEDOWN, IntPtr.Zero);
      return 0;   //Stop iterating
   }
}