简体   繁体   English

如何使用WinAPI将SendMessage发送到Internet Explorer 9

[英]How can i SendMessage to Internet Explorer 9 with WinAPI

environment: 环境:
windows 7 Windows 7的
visual studio 2010 c++ Win32 API visual studio 2010 c ++ Win32 API
Internet Explorer 9 Internet Explorer 9
OpenGL OpenGL的

project objective: 项目目标:
texturing internet explorer9's screen realtime on a 3d-Plane(GL_QUADS). 纹理化internet explorer9在3d平面上的实时屏幕(GL_QUADS)。 and mouse picking on 3d-plane, the click message with relative-mouse position is posted real internet explorer 9. 和鼠标在三维平面上拣选,点击消息与相对鼠标位置发布真正的互联网浏览器9。
the objectvie is 'control other program with 3d texturing and mouse action on my application' objectvie是'在我的应用程序上使用3d纹理和鼠标操作控制其他程序'

code: 码:

HWND target;

//...
//in winmain
target = ::FindWindow("IEFrame",NULL);
glutMouseFunc(MouseEvent);
//...


//in MouseEvent
void MouseEvent(int iButton, int iState, int x, int y)
{
    if(iState == GLUT_DOWN)
    {
        if(iButton == GLUT_LEFT_BUTTON)
        {
             POINT p;
             p.x = x; p.y = y;
             POINT pOut = PickWithPlane(target,p);
             //I don't explain this function. cuz it has very long codes and so complicated and don't important. 
             //it is a simply transform point from my application's Client picking point 'p' to target application(=HWND target)'s relative picking point.

             //send a click message to target. but this SendMessage don't work.
             SendMessage(target, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(pOut.x, POut.y);
        }
    }
}

i used PostMessage insted of SendMessage , but the result is same. 我使用了SendMessage的 PostMessage ,但结果是一样的。
the internet explore don't send any reaction. 互联网探索不发送任何反应。

i watch using Microsoft Spy++ message window. 我看着使用Microsoft Spy ++消息窗口。

// on real-click IE9's window any point
<10972> 000C0F82 S WM_PARENTNOTIFY fwEvent: WM_LBUTTONDOWN xPos:475 yPos:700
<10973> 000C0F82 R WM_PARENTNOTIFY
<10974> 000C0F82 S WM_MOUSEACTIVATE hwndTopLevel:000C0F82 nHittest:HTCLIENT uMsg:WM_LBUTTONDOWN
<10975> 000C0F82 R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
<10976> 000C0F82 S WM_SETCURSOR hwnd:00231438 nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN
<10977> 000C0F82 R WM_SETCURSOR fHaltProcessing:False
//mouseup
<10978> 000C0F82 S WM_SETCURSOR hwnd:00231438 nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<10979> 000C0F82 R WM_SETCURSOR fhaltProcessing:False

and send message using my application code is next: 然后使用我的应用程序代码发送消息:

// on my application's messge
<13106> 000C0F82 S WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1231 yPos:289
<13107> 000C0F82 R WM_LUBTTONDOWN

i guess some more message send. 我猜一些消息发送。 but i don't know what message can do this. 但我不知道什么信息可以做到这一点。
who knows solution of it? 谁知道它的解决方案?
and who knows controlling general application using this way? 谁知道用这种方式控制一般应用?

help me! 帮我!

Some programs don't submit to input faking with PostMessage or SendMessage . 某些程序不提交使用PostMessageSendMessage输入伪造。 Instead you should fake input with SendInput . 相反,你应该使用SendInput伪造输入。 You may find that a higher level approach using UI Automation is easier than faking input. 您可能会发现使用UI Automation的更高级别方法比伪造输入更容易。

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

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