当前位置: 代码迷 >> 汇编语言 >> 各位帮帮小弟我吧 小弟我真的快崩溃了
  详细解决方案

各位帮帮小弟我吧 小弟我真的快崩溃了

热度:9215   发布时间:2013-02-26 00:00:00.0
各位帮帮我吧 我真的快崩溃了!
下面是一个win32汇编的例子
他有一个Menu.asm和Menu.rc
我用的Radasm但是 不管我怎么编译都不能把他们两连在一起
说是要makefile,但是这个makefile到底怎么用的啊
望大家的帮助啊,最好用Radasm的编程环境解释
Assembly code
.386.model flat,stdcalloption casemap:noneWinMain proto :DWORD,:DWORD,:DWORD,:DWORDinclude \masm32\include\windows.incinclude \masm32\include\user32.incinclude \masm32\include\kernel32.incincludelib \masm32\lib\user32.libincludelib \masm32\lib\kernel32.lib.dataClassName db "SimpleWinClass",0AppName  db "Our First Window",0MenuName db "FirstMenu",0Test_string db "You selected Test menu item",0Hello_string db "Hello, my friend",0Goodbye_string db "See you again, bye",0.data?hInstance HINSTANCE ?CommandLine LPSTR ?hMenu HMENU ?.constIDM_TEST equ 1IDM_HELLO equ 2IDM_GOODBYE equ 3IDM_EXIT equ 4.codestart:    invoke GetModuleHandle, NULL    mov    hInstance,eax    invoke GetCommandLine    mov CommandLine,eax    invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT    invoke ExitProcess,eaxWinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD    LOCAL wc:WNDCLASSEX    LOCAL msg:MSG    LOCAL hwnd:HWND    mov   wc.cbSize,SIZEOF WNDCLASSEX    mov   wc.style, CS_HREDRAW or CS_VREDRAW    mov   wc.lpfnWndProc, OFFSET WndProc    mov   wc.cbClsExtra,NULL    mov   wc.cbWndExtra,NULL    push  hInst    pop   wc.hInstance    mov   wc.hbrBackground,COLOR_WINDOW+1    mov   wc.lpszMenuName,NULL    mov   wc.lpszClassName,OFFSET ClassName    invoke LoadIcon,NULL,IDI_APPLICATION    mov   wc.hIcon,eax    mov   wc.hIconSm,0    invoke LoadCursor,NULL,IDC_ARROW    mov   wc.hCursor,eax    invoke RegisterClassEx, addr wc    invoke LoadMenu, hInst, OFFSET MenuName    mov    hMenu,eax    INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\           WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\           CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,hMenu,\           hInst,NULL    mov   hwnd,eax    INVOKE ShowWindow, hwnd,SW_SHOWNORMAL    INVOKE UpdateWindow, hwnd    .WHILE TRUE                INVOKE GetMessage, ADDR msg,NULL,0,0                .BREAK .IF (!eax)                INVOKE DispatchMessage, ADDR msg    .ENDW    mov     eax,msg.wParam    retWinMain endpWndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM    .IF uMsg==WM_DESTROY        invoke PostQuitMessage,NULL    .ELSEIF uMsg==WM_COMMAND        mov eax,wParam        .IF ax==IDM_TEST            invoke MessageBox,NULL,ADDR Test_string,OFFSET AppName,MB_OK        .ELSEIF ax==IDM_HELLO            invoke MessageBox, NULL,ADDR Hello_string, OFFSET AppName,MB_OK        .ELSEIF ax==IDM_GOODBYE            invoke MessageBox,NULL,ADDR Goodbye_string, OFFSET AppName, MB_OK        .ELSE            invoke DestroyWindow,hWnd        .ENDIF    .ELSE        invoke DefWindowProc,hWnd,uMsg,wParam,lParam        ret    .ENDIF    xor    eax,eax    retWndProc endpend start

Assembly code
************************************************************************************************************************** Menu.rc ************************************************************************************************************************** #define IDM_TEST 1 #define IDM_HELLO 2 #define IDM_GOODBYE 3 #define IDM_EXIT 4 FirstMenu MENU {  POPUP "&PopUp"         {          MENUITEM "&Say Hello",IDM_HELLO          MENUITEM "Say &GoodBye", IDM_GOODBYE          MENUITEM SEPARATOR          MENUITEM "E&xit",IDM_EXIT         }  MENUITEM "&Test", IDM_TEST } 

Assembly code
NAME=menu$(NAME).exe: $(NAME).obj $(NAME).res        Link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib $(NAME).obj $(NAME).res$(NAME).res: $(NAME).rc        rc $(NAME).rc$(NAME).obj: $(NAME).asm        ml /c /coff /Cp $(NAME).asm
  相关解决方案