SetConsoleCursorPosition调用无效
SetConsoleCursorPosition调用无效,向高手请教SetConsoleCursorPosition都是正确的传入的,在OD下看也没有看出什么问题,能正常调用和返回。
我用FormatMessage获得错误信息 为:参数不正确
完整源代码:
.386
.model flat,stdcall
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
stCursor COORD <> ;结构变量
stdHandle dword ? ;控制台输出句柄
messageID dword ? ;消息ID
pErroMsg dword ? ;保存系统分配的缓冲区指针
.code
start:
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov stdHandle,eax
;设置光标位置
mov stCursor.x,5
mov stCursor.y,10
invoke SetConsoleCursorPosition,stdHandle, addr stCursor
call GetLastError
mov messageID,eax ;返回消息ID
invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER + FORMAT_MESSAGE_FROM_SYSTEM,NULL,messageID,0,addr pErroMsg,0,0
; invoke Sleep,2000 ;挂起2秒,观看效果
end start