简体   繁体   English

C ++向Internet Explorer发送消息

[英]c++ postmessage to internet explorer

I'm writing an OCX control loaded in internet explorer 8. It used to send alt+(arrow down key ) messages to IE8 web page using postmessage function 我正在写一个加载到Internet Explorer 8中的OCX控件。它曾经使用postmessage函数将alt +(向下箭头键)消息发送到IE8网页。

::PostMessage(hWnd_IE,WM_SYSKEYDOWN,VK_MENU,0);
::PostMessage(hWnd_IE,WM_KEYDOWN,VK_DOWN, 0);
::PostMessage(hWnd_IE,WM_KEYUP,VK_DOWN, 0);
::PostMessage(hWnd_IE,WM_KEYUP,VK_MENU,0);

hWnd_IE is found by: 通过以下方式找到hWnd_IE:

hwnd1 = m_hWnd;
while(1)
{
    hwnd0 = ::GetParent(hwnd1);
    ::GetClassName(hwnd0, (LPTSTR)&buf, 100 ); 
    if ( _tcscmp( buf, _T("Internet Explorer_Server") ) == 0 )
    {
        hwnd0 = ::GetParent(hwnd0);
        return hwnd0;
    }

    hwnd1 = hwnd0;
    if(hwnd0 == NULL)
        break;
}

I think it can work. 我认为可以。 However html web pages only have single key effect(arrow down key),not mutiple key effect(alt+ arrow down key). 但是html网页仅具有单键效果(箭头向下键),而没有多键效果(alt +箭头向下键)。 I don't know why. 我不知道为什么

i resoule this problem by meself,use sendinput function instead. 我自己解决这个问题,改用sendinput函数。 .postmessage,sendmessage,keybd_event are all no effect. .postmessage,sendmessage,keybd_event均无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM