鱼C论坛

 找回密码
 立即注册
查看: 2309|回复: 5

大家看看我照着罗云彬书上敲的一个代码怎么就报这么多错尼

[复制链接]
发表于 2013-10-31 19:38:27 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
.386                                                            ;1
.model flat,stdcall      ;2   
option casemap:none      ;3
;/////////////////////////////////////////////   ;5
include  windows.inc     ;6
include  gdi32.inc     ;7
includelib gdi32.lib     ;8
include  user32.inc     ;9
includelib user32.lib     ;10
include  kernel32.inc     ;11
includelib kernel32.lib     ;12
;////////////////////////////////////////////////////
  .const
szClassName db 'FirstWindow',0
szCaption db 'Hello Window',0
szText  db 'haha',0
;/////////////////////////////////////////////////////
  .data?
hWinMain dd ?     ;20
hInstance dd ?     ;21
;////////////////////////////////////////////////////
_ProcWinMain proc uses eax ebx edi esi,hWnd,uMsg,wParam,lParam
  local @stPs:PAINTSTRUCT   ;24
  local @stRect:RECT    ;25
  local @hDc     ;26
   mov eax,uMsg    ;27
  .if eax==WM_PAINT    ;28
  invoke BeginPaint,hWnd,addr @stPs  ;29
   mov @hDc,eax    ;30
  invoke GetClientRect,hWnd,addr @stRect  ;31
  invoke DrawText,@hDc,addr szText,-1,addr @stRect,DT_SINGLELINE or DT_CENTER or DT_VCENTER
  invoke EndPaint,hWnd,addr @stPs  ;33
        ;34
  .elseif eax ==WM_CLOSE    ;35
  invoke DestroyWindow,hWinMain   ;36
  invoke PostQuitMessage,NULL   ;37
  .else       ;38
  invoke DefWindowProc,hWnd,uMsg,wParam,lParam ;39
   ret     ;40
  .endif      ;41
   xor eax,eax
   ret
   
_ProcWinMain endp      ;45
;///////////////////////////////////////////////////////////////
_WinMain proc
  local @stWndClass:WNDCLASSEX   ;49
  local @stMsg:MSG    ;50
  invoke GetModuleHandle,NULL   ;51
   mov hInstance,eax   ;52
  invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
        ;54
  invoke LoadCursor,0,IDC_ARROW   ;55
   mov @stWndClass.hCursor,eax  
   push hInstance
   pop @stWndClass.hInstance
   mov @stWndClass.cbSize,sizeof WNDCLASS
   mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
   mov @stWndClass.lpfnWndProc,offset _ProcWinMain
   mov @stWndClass.hbrBackground,COLOR_WINDOW+1
   mov @stWndClass.lpszClassName,offset szClassName
  invoke ResgisterClassEx,addr @stWndClass ;64
   ;mov hWinMain,eax   ;65
  invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaption,\
   WS_OVERLAPPEDWINDOW,100,100,600,400,NULL,NULL,hInstance,NULL
   mov hWinMain,eax   ;68
  invoke ShowWindow,hWinMain,SW_SHOWNORMAL ;69
  invoke UpdateWindow,hWinMain   ;70
  .while TURE     ;71
  invoke GetMessage,addr @stMsg,NULL,0,0
   .break .if eax==0
  invoke TranslataMessage,addr @stMsg  ;74
  invoke DispatchMessage,addr @stMsg
  .endw      ;76
   ret
_WinMain endp
;////////////////////////////////////////////////////////////
start:  call _WinMain     ;81
  invoke ExitProcess,NULL
  end start
   
  
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2013-10-31 19:39:18 | 显示全部楼层
1.asm(35) : error A2108: use of register assumed to ERROR
1.asm(38) : error A2108: use of register assumed to ERROR
1.asm(41) : error A2108: use of register assumed to ERROR
1.asm(64) : error A2006: undefined symbol : ResgisterClassEx
1.asm(71) : error A2108: use of register assumed to ERROR
1.asm(74) : error A2006: undefined symbol : TranslataMessage
1.asm(76) : error A2108: use of register assumed to ERROR
1.asm(81) : error A2108: use of register assumed to ERROR
1.asm(28) : error A2107: cannot have implicit far jump or call to near label
1.asm(30) : error A2107: cannot have implicit far jump or call to near label
1.asm(32) : error A2107: cannot have implicit far jump or call to near label
1.asm(33) : error A2107: cannot have implicit far jump or call to near label
1.asm(34) : error A2107: cannot have implicit far jump or call to near label
1.asm(35) : error A2107: cannot have implicit far jump or call to near label
1.asm(37) : error A2107: cannot have implicit far jump or call to near label
1.asm(40) : error A2107: cannot have implicit far jump or call to near label
1.asm(51) : error A2107: cannot have implicit far jump or call to near label
1.asm(53) : error A2107: cannot have implicit far jump or call to near label
1.asm(55) : error A2107: cannot have implicit far jump or call to near label
1.asm(66) : error A2107: cannot have implicit far jump or call to near label
1.asm(69) : error A2107: cannot have implicit far jump or call to near label
1.asm(70) : error A2107: cannot have implicit far jump or call to near label
1.asm(73) : error A2107: cannot have implicit far jump or call to near label
1.asm(76) : error A2006: undefined symbol : TURE
1.asm(82) : error A2107: cannot have implicit far jump or call to near label
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-10-31 19:40:26 | 显示全部楼层
大家帮小弟看下啊,,我看这本书时间不长,,今天照着敲书上的代码咋就出现这么多错  
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-10-31 19:42:37 | 显示全部楼层
.386                                                            ;1
.model flat,stdcall                                                ;2                               
option casemap:none                                                ;3

;/////////////////////////////////////////////                        ;5
include                windows.inc                                        ;6
include                gdi32.inc                                        ;7
includelib        gdi32.lib                                        ;8
include                user32.inc                                        ;9
includelib        user32.lib                                        ;10
include                kernel32.inc                                        ;11
includelib        kernel32.lib                                        ;12
;////////////////////////////////////////////////////       
                .const
szClassName        db        'FirstWindow',0
szCaption        db        'Hello Window',0
szText                db        'haha',0
;/////////////////////////////////////////////////////
                .data?
hWinMain        dd        ?                                        ;20
hInstance        dd        ?                                        ;21
;////////////////////////////////////////////////////
_ProcWinMain        proc        uses eax ebx edi esi,hWnd,uMsg,wParam,lParam
                local        @stPs:PAINTSTRUCT                        ;24
                local        @stRect:RECT                                ;25
                local        @hDc                                        ;26
                        mov eax,uMsg                                ;27
                .if        eax==WM_PAINT                                ;28
                invoke        BeginPaint,hWnd,addr @stPs                ;29
                        mov @hDc,eax                                ;30
                invoke        GetClientRect,hWnd,addr @stRect                ;31
                invoke        DrawText,@hDc,addr szText,-1,addr @stRect,DT_SINGLELINE or DT_CENTER or DT_VCENTER
                invoke        EndPaint,hWnd,addr @stPs                ;33
                                                                ;34
                .elseif        eax ==WM_CLOSE                                ;35
                invoke        DestroyWindow,hWinMain                        ;36
                invoke        PostQuitMessage,NULL                        ;37       
                .else                                                 ;38
                invoke        DefWindowProc,hWnd,uMsg,wParam,lParam        ;39
                        ret                                        ;40
                .endif                                                ;41
                        xor eax,eax
                        ret
                       
_ProcWinMain        endp                                                ;45

;///////////////////////////////////////////////////////////////
_WinMain        proc       
                local        @stWndClass:WNDCLASSEX                        ;49
                local        @stMsg:MSG                                ;50
                invoke        GetModuleHandle,NULL                        ;51
                        mov hInstance,eax                        ;52
                invoke        RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
                                                                ;54
                invoke        LoadCursor,0,IDC_ARROW                        ;55
                        mov @stWndClass.hCursor,eax               
                        push hInstance
                        pop @stWndClass.hInstance
                        mov @stWndClass.cbSize,sizeof WNDCLASS
                        mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
                        mov @stWndClass.lpfnWndProc,offset _ProcWinMain
                        mov @stWndClass.hbrBackground,COLOR_WINDOW+1
                        mov @stWndClass.lpszClassName,offset szClassName
                invoke        ResgisterClassEx,addr @stWndClass        ;64
                        ;mov hWinMain,eax                        ;65
                invoke        CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaption,\
                        WS_OVERLAPPEDWINDOW,100,100,600,400,NULL,NULL,hInstance,NULL
                        mov hWinMain,eax                        ;68
                invoke        ShowWindow,hWinMain,SW_SHOWNORMAL        ;69
                invoke        UpdateWindow,hWinMain                        ;70
                .while        TURE                                        ;71
                invoke        GetMessage,addr @stMsg,NULL,0,0
                        .break .if eax==0
                invoke        TranslataMessage,addr @stMsg                ;74
                invoke        DispatchMessage,addr @stMsg
                .endw                                                ;76
                        ret
_WinMain        endp

;////////////////////////////////////////////////////////////
start:                call _WinMain                                        ;81
                invoke        ExitProcess,NULL
                end start
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-11-1 16:13:48 | 显示全部楼层
不会吧,看你不是你哪里抄错了呢。我运行怎么没有事。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-1 17:54:58 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-7 12:25

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表