问题描述
大家好。
现在,我正在尝试开发桌面应用以重新定位窗口。
我使用Global Mouse Hook和SetWindowPos来重置窗口的位置。
首先我通过SetWindowHookEx安装了LowLevel Mouse Hook(WH_MOUSE_LL,MouseProc,Null,Null)
MouseProc是回调函数。
它的声明是这样的: LRESULT CALLBACK MouseProc(int code,WPARAM wParam,LPARAM lParam)
wParam here
与鼠标消息有关。
我在WM_LBUTTONUP中使用了SetWindowPos()函数。只需单击鼠标左键就可以正常工作。
但是当我将鼠标移动和鼠标左键单击组合时,它的效果很奇怪。
问题是窗口捕捉到原始位置,这是在执行SetWindowPos()之前的位置。
我认为这取决于系统窗口的拖动,我不确定。 / p>
请建议您的想法。
感谢您的帮助。
Cris
Hi, Everyone.
Now, I'm trying to develop the desktop app to re-position the window.
I used Global Mouse Hook and SetWindowPos to reset the position of the window.
First I installed LowLevel Mouse Hook by SetWindowHookEx(WH_MOUSE_LL, MouseProc, Null,Null)
MouseProc is callback function.
Its declaration is like this: LRESULT CALLBACK MouseProc( int code, WPARAM wParam, LPARAM lParam)
wParam here
is about Mouse Message.
I've used SetWindowPos() function in WM_LBUTTONUP. It works well when I simply click the mouse left button.
But When I combined mouse move and mouse left button click, it works strange.
The problem is that the window snap into original position which is position before SetWindowPos() was executed.
I think that it's up to system window dragging and I'm not sure.
Please suggest your ideas about it.
Thanks for your kind help.
Cris
这篇关于Global Mouse Hook和SetWindowPos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!