I am new to assembly, and am trying to write a program that will output data in the center of the screen. However, I have not been able to find anything on how to move the cursor.

Any help would be appreciated.
Posted on 2001-09-23 20:23:17 by singletrackmind
the SetConsoleCursorPosition should be what you need. if you need some sample code, i'll post back, or someone else probably will.
Posted on 2001-09-23 22:03:43 by Sloat
I could be totaly missing the point here, as im dont know how ConsoleWindows get into this problem? But I suspect your looking for something more basic:
WM_MOUSEMOVE

fwKeys = wParam; // key flags
xPos = LOWORD(lParam); // horizontal position of cursor
yPos = HIWORD(lParam); // vertical position of cursor


The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.

If you place this code in your message loop:


.elseif( uMsg == WM_MOUSEMOVE )
mov eax, lParam ; Get x,y data of mouse position
and eax, 0FFFFh ; Get LowWord (16bits) == xPos

mov ecx, lParam ; Get x,y data again in ECX
shl ecx, 16 ; Get the highWord (upper 16bits) == yPos

; Now eax == mouse x Position and ecx == mouse y Position
; So store them in a Global Variable, and then force a
; repaint of your window (where you would also paint a message
; saying the x,y position).

; This will force a WM_PAINT message to follow this WM_MOUSEMOVE message
invoke InvalidateRect, hWnd, NULL, TRUE


Then whent the WM_PAINT message comes along, place code to output a text message, using the stored x and y values.

Hope this is what you were looking for..
NaN
Posted on 2001-09-24 00:32:07 by NaN