masm中资源和代码怎么个链接起来
文件.asm
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
IDD_DIALOG equ 1
.data?
hInstance dd ?
.const
szText db '你点击了确定!',0
szCaption db '提示!',0
.code
_ProcWinMain proc uses ebx ecx esi edi,hWnd,uMsg,wParam,lParam
mov eax,uMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_COMMAND
mov eax,wParam
movzx eax,ax
.if eax == IDC_BTN_OK
invoke MessageBox,NULL,addr szText,addr szCaption,MB_OK
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,IDI_APPLICATION
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == IDC_BTN_CLOSE
invoke EndDialog,hWnd,NULL
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcWinMain endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,offset _ProcWinMain,NULL
invoke ExitProcess,NULL
end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
资源文件:
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include "resource.h"
#define IDD_DIALOG 1
#define IDC_BTN_OK 1000
#define IDC_BTN_CLOSE 1001
#define IDC_STATIC -1
IDD_DIALOG DIALOG 0, 0, 187, 94
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 10, "System"
BEGIN
LTEXT "win32汇编测试",IDC_STATIC,67,16,58,12
PUSHBUTTON "确定",IDC_BTN_OK,33,50,48,16
PUSHBUTTON "取消",IDC_BTN_CLOSE,102,50,48,16
END
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MakeFile文件
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NAME = DialogWinow
OBJS = DialogWinow.obj
RES = DialogWinow.res
LINK_FLAG = /subsystem:windows
ML_FLAG = /c /coff
$(NAME).exe: $(OBJS) $(RES)
Link $(LINK_FLAG) $(OBJS) $(RES)
.asm.obj:
ml $(ML_FLAG) $<
.rc.res:
rc $<
clean:
del *.obj
del *.res
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
编译链接的时候说找不到:
IDC_BTN_CLOSE和IDC_BTN_OK
这个是为什么啊?
源文件中缺少
IDC_BTN_OK equ 1000
IDC_BTN_CLOSE equ 1001