Win32下, 那立一个窗口, 从键盘接收字符, 并将它显示在窗口上;
但是本程序只能实现同一个位置不停输入,而不会移到下一个位置.
如何去确定坐标位置,谢谢
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
WinMain proto :DWORD, :DWORD,:DWORD, :DWORD
.data
ClassName db "WinClass ", 0
AppName db "Simple Window ", 0
char WPARAM 20h ;the character the program receives from keyboard
.data?
hInstance HINSTANCE ?
iX byte ? ;指明下一个字符的x位置, 本想是int型的, 不过, MASM无法识
;别int型
iY byte ? ;指明下一个字符的y位置
.code
start:
mov ebx, offset iX ; 我不知道,这样赋值对不对
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain, hInstance, NULL, NULL, 0
invoke ExitProcess, eax
WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR,
CmdShow:DWORD
local wc:WNDCLASSEX
local msg:MSG
local hwnd:HWND
mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground, COLOR_WINDOW+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset ClassName
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx, 0, addr ClassName, addr AppName, WS_OVERLAPPEDWINDOW or WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, NULL, NULL, hInst, NULL
mov hwnd, eax
.while TRUE
invoke GetMessage, addr msg, NULL, 0, 0
.break .if(!eax)
invoke TranslateMessage, addr msg
invoke DispatchMessage, addr msg
.endw
mov eax, msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local hdc:HDC
local ps:PAINTSTRUCT
.if uMsg == WM_DESTROY
invoke PostQuitMessage, 0
;;When the WM_CREATE Message Arrive
.elseif uMsg == WM_CREATE
.elseif uMsg == WM_CHAR ;接收
push wParam