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....
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
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.....
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.
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.....
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
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
i fugured the problem out, the correct code is below, but it is still a mircle for me why it did work on win98
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
The reason there is no problem in Win9x is -- Win9x uses only 16-bit coordinates.
ohhh....
that makes everything clear......
:)
thx