i have written a procedure to move a window by using WM_MOUSMOVE, CLienttoScreen and Move window, my problem is that if the coords in in lparam if I get an WM_MOUSEMOVE my be negative, but this causes a problem with win 2k it semes that the window is moved out of the viewable area....
Posted on 2001-02-24 18:35:00 by theNOP
Check out my page for the Custom Window Captions (and shapes too) tutorial. In it I have some code to move the window by hit detecting the mouse in a certain client area. This message was edited by Ernie, on 2/24/2001 10:33:09 PM
Posted on 2001-02-24 22:32:00 by Ernie
well... I'm really unhappy to tell you but the time doesent run under win2k, the UI doesen't respond and it crashed once when I clicked on the caption... I tried you code in my programm, but I have the same probleme like before, but my code was very similar to yours.....
Posted on 2001-02-25 07:00:00 by theNOP
Timer never did run under NT. The registry stuff isn't compatable. However, moving the window just depends basically on SetCapture and MoveWindow, both functions work the same way in any win32.
Posted on 2001-02-25 12:27:00 by Ernie
yea, i know... this is my code for WM_MOUSEMOVE, assuming that GetCapture had been called: wmmm: cmp movin,1 ; if we aren't moving, ie lmousbutton down and caption hit jne rett invoke GetWindowRect,Dlg,addr rec mov eax, lParam and eax, 0FFFFh sub eax, difx mov eax, lParam shr eax, 16 sub eax, dify invoke SetWindowPos, Dlg, 0, rec.left, rec.top, 464, 336, 0 jmp endlgp rett: mov eax,0 mov ebx, ebxbak ret it workes fine with win98 but not with win2k... if the mouse is moved to fast upwards the window disapears.... my explanation for this effect is: if the coords are negative (when the mouse id outside of the window) then they are treated as if they wre positive. I assume the following calculations, correct me if I'm wrong: singned values: -5 = 0FFFFFFFBh 5 = 05h but if the values are unsigned 0FFFFFFFBh = 18446744073709551611 an that is the problem......... but I'm not to sure about it, because everything workes fine with win98.....
Posted on 2001-02-25 13:38:00 by theNOP
sorry i have forgotten a pice of code.... the code must be: wmmm: cmp movin,1 jne rett invoke GetWindowRect,Dlg,addr rec mov eax, lParam and eax, 0FFFFh sub eax, difx add rec.left,eax mov eax, lParam shr eax, 16 sub eax, dify add rec.top,eax invoke SetWindowPos, Dlg, 0, rec.left, rec.top, 464, 336, 0 jmp endlgp rett: mov eax,0 mov ebx, ebxbak ret
Posted on 2001-02-25 13:42:00 by theNOP
Without seeing your code: I ported the sample "Using rectangles" from Win32Hlp and had to define a couple of variables myself as SDWORD. Without Signed DWORDs the behavior of the rectangle was like you describe your problem. hth Vesa
Posted on 2001-02-26 08:09:00 by vesa
i fugured the problem out, the correct code is below, but it is still a mircle for me why it did work on win98
Posted on 2001-02-26 18:56:00 by theNOP
sorry I forgot the code invoke GetWindowRect,Dlg,addr rec mov eax, lParam and eax, 0FFFFh sub eax, difx .IF eax > 07FFh or eax, 0FFFF0000h .ENDIF add rec.left, eax mov eax, lParam shr eax, 16 sub eax,dify .IF eax > 07FFh or eax, 0FFFF0000h .ENDIF add rec.top, eax invoke SetWindowPos, Dlg, 0, rec.left, rec.top, 464, 336, 0
Posted on 2001-02-26 18:58:00 by theNOP
The reason there is no problem in Win9x is -- Win9x uses only 16-bit coordinates.
Posted on 2001-02-26 21:23:00 by tank
ohhh.... that makes everything clear...... :) thx
Posted on 2001-02-27 07:12:00 by theNOP