环境:
windows 7
visual studio 2010 c++ Win32 API
Internet Explorer 9
OpenGL
项目目标:
在 3d 平面(GL_QUADS)上实时纹理化 Internet Explorer9 的屏幕。和鼠标在 3d 平面上拾取,具有相对鼠标位置的点击消息发布在真正的 Internet Explorer 9.
目标是“控制其他程序在我的应用程序上使用 3d 纹理和鼠标动作”
代码:
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);
}
}
}
我使用了SendMessage的PostMessage,但结果是一样的。
互联网探索不发送任何反应。
我使用 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
接下来是使用我的应用程序代码发送消息:
// on my application's messge
<13106> 000C0F82 S WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1231 yPos:289
<13107> 000C0F82 R WM_LUBTTONDOWN
我想还有一些消息发送。但我不知道什么消息可以做到这一点。
谁知道它的解决方案?
谁知道用这种方式控制一般应用程序?
帮我!