|
-
August 20th, 2005, 09:46 AM
#1
Is it possible to throw mouse messages to behind window?
Hello.
Can the mouse message be passed to the window in the back?
I made the window with the TOPMOST attribute. This has the same size
as the screen. Moreover, it is half transparent window.
OS delivers the mouse message to this window when the mouse is moved or
it clicks. Therefore, the user cannot operate other windows hidden in the
window.
I tried.
It threw out some mouse message using PostMessage functions. The
window handle used and acquired the WindowFromPoint function.
However, it did not operate well.
Please teach something a good idea.
-
August 20th, 2005, 10:08 AM
#2
Re: Is it possible to throw mouse messages to behind window?
Because it won't operate well, since WindowFromPoint will always return your huge window. For WindowFromPoint() to operate will you need to minimize your huge window, so it can find the windows behind yours. Or you keep a track of the windows (by hooking or enuming them and store them somewhere) and then operate on them. But this is pretty much reinwenting the wheel.
-
August 21st, 2005, 08:36 AM
#3
Re: Is it possible to throw mouse messages to behind window?
Thank you for advice.
I tried and looked at the following codes.However, it did not operate as expected.
I'll try using EnumWindows API.
if(WM_MOUSEFIRST <= message && message <= WM_MOUSELAST)
{
POINT pt = { LOWORD(lParam), HIWORD(lParam) };
ClientToScreen(hWnd, &pt);
SetWindowPos (hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOREDRAW);
HWND hTarget = WindowFromPoint(pt);
SetWindowPos (hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOREDRAW);
if(hTarget && hTarget != hWnd)
{
ScreenToClient(hTarget, &pt);
PostMessage(hTarget, message, wParam, MAKELPARAM(pt.x, pt.y));
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|