求助:第一次独立完成一个win32汇编,但在GetDlgItemInt处卡壳,希望各位指导
一个简单的creakme,主要是预定义一个密码,然后由用户在对话框中输入密码,如果与预定义密码相同,则弹出"正确"的提示,反之提示"错误".但写出来的程序不论如何总是直接跳转到"正确"提示...期望各位指导.原码如下.期待各位大虾指导~~~
[bo]CheckMe.asm:[/bo]
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;ID_IN为输入框的id,ID_OK为“CheckME!”按键的ID
DLG_MAIN equ 101
IDC_IN equ 1000
ID_OK equ 1001
IDC_STATIC equ -1
.data?
hInstance dd ?
hWinMain dd ?
.const
szMessage1 db 'Sorry,wrong.',0 ;消息框内容
szMessage2 db 'YES,Right!',0
szCaption db 'Warn',0 ;弹出消息框的标题
.code
;**********************************************************
;验证注册码子程序
;**********************************************************
_Check proc
local @lpNO[128]:dword
pushad
invoke GetDlgItemInt,hWinMain,IDC_IN,addr @lpNO,FALSE
mov eax, @lpNO
;若输入为123则弹出“正确”的提示,否则弹出“错误”的提示
.if eax == 123
invoke MessageBox,NULL,offset szMessage2,\
offset szCaption,MB_OK
.elseif ;程序总是直接跳到该句...
invoke MessageBox,NULL,offset szMessage1,\
offset szCaption,MB_OK
.endif
popad
ret
_Check endp
;***********************************************************
_ProcMain proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
mov eax,uMsg
.if eax==WM_COMMAND
mov eax,wParam
.if ax==ID_OK
call _Check
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWnd,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcMain endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,\
NULL,offset _ProcMain,NULL
invoke ExitProcess,NULL
end start
[bo]CheckMe.rc:[/bo]
#include <resource.h>
#define DLG_MAIN 101
#define IDC_IN 1000
#define IDC_OK 1001
#define IDC_STATIC -1
DLG_MAIN DIALOG DISCARDABLE 0, 0, 177, 73
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "CheckMe!!!"
FONT 10, "System"
BEGIN
LTEXT "输入注册码:",IDC_STATIC,7,23,49,11
EDITTEXT IDC_IN,66,22,104,12,ES_AUTOHSCROLL
PUSHBUTTON "CHECKME!",IDC_OK,46,44,83,14
END