· Начало · Статистика · WASM.RU · Noir.Ru ·

 WASM Phorum (Оффлайн - 24.11.2003) —› WASM.ASSEMBLER —› How to move a Window?

Посл.отвђт Сообщенiе


Дата: Янв 19, 2003 04:36:37

I know it must be simple thru MOUSEOMVE etc. but it doesn't work smoothly. The window jumps around the screen.


Дата: Янв 19, 2003 12:41:42

.data?
ptDown POINT <>
pt POINT <>
.code
...
WM_LBUTTONDOWN:
movsx eax, word ptr [lParam]
movsx ecx, word ptr [lParam+2]
mov [ptDown.x], eax
mov [ptDown.y], ecx
invoke SetCapture, [hWnd]
WM_MOUSEMOVE:
call GetCapture
cmp eax, [hWnd]
jne @F
movsx ecx, word ptr [lParam]
movsx edx, word ptr [lParam+2]
mov [pt.x], ecx
mov [pt.y], edx
invoke ClientToScreen, eax, ADDR pt
mov eax, [pt.x]
mov ecx, [pt.y]
sub eax, [ptDown.x]
sub ecx, [ptDown.y]
invoke MoveWindow, [hWnd], eax, ecx, dwWidth, dwHeight, 1
@@:
WM_LBUTTONUP:
call ReleaseCapture


Дата: Янв 26, 2003 04:54:09

Hey, now I'm answering myself.
Got it from an example.

cmp eax,WM_LBUTTONDOWN
jne @mm
call ReleaseCapture ;I'm not sure I need this
invoke SendMessage,hWnd,WM_NCLBUTTONDOWN, HTCAPTION,0
jmp @default

It's faster and Windows does the most work for you. You just assure it that you have clicked in Caption area of the window (even if there is no caption).

Thanks to comrade. I'll try this way as well.


Дата: Янв 27, 2003 06:06:26 · Поправил: comrade

Если через HTCAPTION то нельзя быть увереным как будет двигатся окно - с рамкой или сразу (зависит от настроик системы). Через код который дал я, окно будет всё время двигатся сразу.


Powered by miniBB 1.6 © 2001-2002
Время загрузки страницы (сек.): 0.089