首页
社区
课程
招聘
[求助]嵌套宏定义不匹配
发表于: 2014-1-2 15:01 5410

[求助]嵌套宏定义不匹配

2014-1-2 15:01
5410
这个是在学习《罗云彬的win32汇编教程》的时候
之四编写一个简单的窗口的时候出现的提示

fatal error A1008: unmatched macro nesting

这是源码:

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        Programmed by 罗云彬, bigluo@telekbird.com.cn
;        Website: d8fK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8X3q4K6L8g2)9J5k6i4W2W2j5h3S2Q4x3X3g2F1k6i4b7`.
;        LuoYunBin's Win32 ASM page (罗云彬的编程乐园)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                .386
                .model flat, stdcall
                option casemap :none   ; case sensitive

include                windows.inc
include                user32.inc
include                kernel32.inc
include                comctl32.inc
include                comdlg32.inc
include                gdi32.inc

includelib        user32.lib
includelib        kernel32.lib
includelib        comctl32.lib
includelib        comdlg32.lib
includelib        gdi32.lib

IDI_MAIN        equ                1000                ;icon

IDM_MAIN        equ                4000                ;menu
IDM_EXIT        equ                4001

                .data?

hInstance        dd                ?
hWinMain        dd                ?
hMenu                dd                ?
szBuffer        db        256 dup        (?)

                .data

szClassName        db        "Windows Template",0
szCaptionMain        db        '窗口模板',0

                .code

start:
                call        _WinMain
                invoke        ExitProcess,NULL

_WinMain        proc
                local        @stWcMain:WNDCLASSEX
                local        @stMsg:MSG

                invoke        InitCommonControls
                invoke        GetModuleHandle,NULL
                mov        hInstance,eax
                invoke        LoadIcon,hInstance,IDI_MAIN
                mov        hIcon,eax
                invoke        LoadMenu,hInstance,IDM_MAIN
                mov        hMenu,eax
;*************** 注册窗口类 *****************************************
                invoke        LoadCursor,0,IDC_ARROW
                mov        @stWcMain.hCursor,eax
                mov        @stWcMain.cbSize,sizeof WNDCLASSEX
                mov        @stWcMain.hIconSm,0
                mov        @stWcMain.style,CS_HREDRAW or CS_VREDRAW
                mov        @stWcMain.lpfnWndProc,offset WndMainProc
                mov        @stWcMain.cbClsExtra,0
                mov        @stWcMain.cbWndExtra,0
                mov        eax,hInstance
                mov        @stWcMain.hInstance,eax
                mov        @stWcMain.hIcon,0
                mov        @stWcMain.hbrBackground,COLOR_WINDOW + 1
                mov        @stWcMain.lpszClassName,offset szClassName
                mov        @stWcMain.lpszMenuName,0
                invoke        RegisterClassEx,addr @stWcMain
;*************** 建立输出窗口 ***************************************
                invoke        CreateWindowEx,WS_EX_CLIENTEDGE,\
                        offset szClassName,offset szCaptionMain,\
                        WS_OVERLAPPEDWINDOW OR WS_VSCROLL OR WS_HSCROLL,\
                        0,0,550,300,\
                        NULL,hMenu,hInstance,NULL

                invoke        ShowWindow,hWinMain,SW_SHOWNORMAL
                invoke        UpdateWindow,hWinMain
;*************** 消息循环 *******************************************
                .while        TRUE
                        invoke        GetMessage,addr @stMsg,NULL,0,0
                        .break        .if eax        == 0
                        invoke        TranslateMessage,addr @stMsg
                        invoke        DispatchMessage,addr @stMsg
                .endw
                ret

_WinMain        endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
WndMainProc        proc        uses ebx edi esi, \
                hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

                mov        eax,uMsg
                .if        eax ==        WM_CREATE
                        mov        eax,hWnd
                        mov        hWinMain,eax
                        call        _Init
;********************************************************************
                .elseif        eax ==        WM_COMMAND
                   .if        lParam == 0
                        mov        eax,wParam
                        .if        ax == IDM_EXIT
                                call        _Quit
                        .endif
                   .endif
;********************************************************************
                .elseif        eax ==        WM_CLOSE
                        call        _Quit
;********************************************************************
                .else
                        invoke        DefWindowProc,hWnd,uMsg,wParam,lParam
                        ret
                .endif
                xor        eax,eax
                ret

WndMainProc        endp

_Init                proc

                invoke        SendMessage,hWinMain,WM_SETICON,ICON_SMALL,hIcon

                ret

_Init                endp
;********************************************************************
_Quit                proc

                invoke        DestroyWindow,hWinMain
                invoke        PostQuitMessage,NULL
                ret

_Quit                endp
;********************************************************************
                end        start

[培训]科锐逆向工程师培训第53期2025年7月8日开班!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 100
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
用的是MASMPlus1.2
2014-1-2 15:02
0
雪    币: 100
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
OK,已解决,谢谢。
2014-1-2 15:22
0
游客
登录 | 注册 方可回帖
返回