单文档视图中需要发送字符消息,发送不成功 错误码 5(拒绝访问) ,
尝试网上2种方案均告失败:
1.以管理员运行
<requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
也不管用,
2.提升权限
      typedef BOOL (WINAPI *_ChangeWindowMessageFilter)( UINT , DWORD); 
       BOOL CMyApp::AllowMeesageForVista(UINT uMessageID, BOOL bAllow)//注册Vista全局消息,在
 在CMyApp 中添加以上函数,在initinstance中 添加:_ChangeWindowMessageFilter(WM_CHAR |WM_KEYDOWN,1);发送消息函数如下:
BOOL Message(HWND hWnd, char* command)
{
if(hWnd==NULL)
return FALSE;
SetFocus(hAnsMultiWin);
char*p =command;
while(*p!='\0')
{
int ret = SendMessage(hWnd, WM_CHAR, *p, 0xC0000001);
  ret = GetLastError();
p++;
}
SendMessage(hWnd, WM_KEYDOWN, VK_RETURN, 0x001c0001);
return TRUE;
}