I'm trying to convert the following vb code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
End Sub

Into Assembly so that when u click and hold the mouse down on the window you can move it around just like moving it on the title bar.

I know how to convert that API into Assembly but i just dont know how to tell when the user is holding the mouse button down on the window.
Posted on 2002-01-22 13:55:12 by poison
Just simply process the WM_LBUTTONDOWN message in your winproc and call

Posted on 2002-01-22 14:10:09 by Eóin
Ok how do I process the WM_LBUTTONDOWN message in my winproc? :)
Posted on 2002-01-22 14:26:52 by poison
WndProc proc uses ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

..and so an
Posted on 2002-01-22 14:32:43 by Rennsemmel
I just tried this code
.elseif uMsg == WM_LBUTTONDOWN
invoke ExitProcess,0
but the window does not close when i click the left button, which explains why it doesn't move when i hold the left button down, either.
What could I be doing wrong??
Posted on 2002-01-22 14:38:53 by poison
it would be a lot easier to help ya, if you post your whole WndProc, instead of this tiny snippet :)

Posted on 2002-01-22 14:42:56 by bazik
Use this:

.elseif uMsg == WM_LBUTTONDOWN
mov eax, lParam

It works for 100% under Win98/2000/XP.

Posted on 2002-01-22 15:03:43 by stealthFIGHTER
This works perfectly for me:

; code to handle WM_NCHITTEST
invoke DefWindowProc, [hwnd], [msg], [wp], [lp]
.if eax == HTCLIENT
mov eax, HTCAPTION
Posted on 2002-01-22 15:12:13 by f0dder
I have checked over the code a million times and still there is no response when I press the left mouse button.

I tried to make it so when I click the left mouse button the program exits but that doesn't work either, So What Could I be doing wrong??
Posted on 2002-01-22 15:26:44 by poison
post your wndproc and let's have a look. Also, you *are* running
a getmessage/dispatchmessage aren't you?
Posted on 2002-01-22 15:30:00 by f0dder
My wndproc??
is this it?
WndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD

whats a getmessage/dispatchmessage?
Posted on 2002-01-22 15:36:03 by poison
Perhaps you should read through Iczelion's tutorials - it would do you good :)
Posted on 2002-01-22 15:40:14 by f0dder
Already have :)
Posted on 2002-01-22 15:42:10 by poison
Ok then, how about you post your full code. ;)

And if you don't know what a meggage dispatching loop is then you have'nt read the tutorials, at least not tutorial 3 anyway, as that will explain all the basics. And you really need to know them.
Posted on 2002-01-22 17:46:04 by Eóin
Ok This is full code,

.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\wsock32.inc

includelib \masm32\lib\wsock32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib


Error db "Unable to initialize Winsock DLL",0
dlgname db "TESTWIN",0
buffer db ?
hInstance dd ?
invoke GetModuleHandle, NULL
mov hInstance, eax

invoke DialogBoxParam,hInstance,addr dlgname,0,ADDR WndProc,0

invoke ExitProcess,eax

WndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD

invoke WSAStartup,101h,addr WSAData
.if eax != 0
invoke MessageBox,0,addr Error,0,0
invoke ExitProcess,0
invoke gethostbyname, addr buffer
mov eax,
mov eax,
mov eax,
invoke inet_ntoa,eax
invoke SetDlgItemTextA, hWin, 03E8h, eax
invoke WSACleanup
.elseif uMsg == WM_CLOSE
invoke EndDialog,hWin,0

.elseif uMsg == WM_COMMAND
.if wParam == 1
invoke EndDialog,hWin,0
.elseif uMsg == WM_LBUTTONDOWN
invoke ExitProcess,0


xor eax, eax
WndProc endp

end start

With this I'm trying to make it so when You click on the window it exits, But it doesn't work.

Just so ya know, This program puts your ip address into an edit box.
Posted on 2002-01-22 18:05:19 by poison
You're only checking if uMsg == WM_LBUTTONDOWN after you've already confirmed its WM_COMMAND...
Check the nesting of your .if statements then retry!


--- Edit ---
Corrected gramatical error oops!
Posted on 2002-01-22 18:33:33 by Mirno
Thanks Mirno!

I put the .if uMsg == WM_LBUTTONDOWN on the first of that .if statement and it works fine now so I tried what I wanted to do ultimately, Make it so you can move the window around if You hold the left mouse button down, And that works flawlessly also.
Posted on 2002-01-22 18:56:59 by poison