Masm32 auf Windows 7 64bit - verstehe nicht, warum Code nicht läuft



  • Hallo!

    Bin absoluter Überneuling und habe mir von zwei Webseiten Code kopiert, um zu üben. Der eine Code:

    http://michael-hielscher.de/cgi-bin/ii02_2/site.cgi?site=asm/tut1

    ;==============================================================
      .386
      .model flat,stdcall
      option casemap:none
    ;==============================================================
    
     include \masm32\include\windows.inc
     include \masm32\include\masm32.inc
     include \masm32\include\kernel32.inc
    
     includelib \masm32\lib\kernel32.lib
     includelib \masm32\lib\masm32.lib
    
    .data
     szLine db 80 DUP("="),0
     szCaption db "Mein erstes Consolen Programm:",10,0
     szEingabe db "Bitte eine Zahl eingeben:",0
     szAusgabe db "Deine Zahl:",0
     Zahl      db 20 DUP(0)
    .code
    
    start:
     push offset szLine
     call StdOut
     push offset szCaption
     call StdOut
     push offset szLine
     call StdOut
     push offset szEingabe
     call StdOut
     push 20
     push offset Zahl
     call StdIn
     push offset szAusgabe
     call StdOut
     push offset Zahl
     call StdOut
    
     push 0
     push 0
     call StdIn
     push 0
     call ExitProcess
    end start
    

    Der andere Code:

    .386 
    .model flat,stdcall 
    option casemap:none 
    include \masm32\include\windows.inc 
    include \masm32\include\kernel32.inc 
    includelib \masm32\lib\kernel32.lib 
    include \masm32\include\user32.inc 
    includelib \masm32\lib\user32.lib 
    
    .data 
    MsgBoxCaption	db "An example of Cancel,Retry,Continue",0 
    MsgBoxText	db "Hello Message Box!",0 
    
    .code 
    start:
    	invoke MessageBox,
    			NULL,
    			addr MsgBoxText,
    			addr MsgBoxCaption,
    			MB_ICONERROR OR MB_ABORTRETRYIGNORE
    
    	.IF eax==IDABORT
    		; Abort was pressed
    
    	.ELSEIF eax==IDRETRY
    		; Retry was pressed
    
    	.ELSEIF eax==IDCANCEL
    		; Cancel was pressed
    	.ENDIF
    
    	invoke ExitProcess,NULL
    end start
    

    Der untere Code funktioniert, beim oberen tut sich nix, wenn ich auf die exe Drücke. Kann mir jemand sagen, wieso? Was übersehe ich?

    Danke!



  • beim linken /SUBSYSTEM:CONSOLE angegeben?



  • linker_cmd schrieb:

    beim linken /SUBSYSTEM:CONSOLE angegeben?

    Hallo!

    ALso diese Option vertsehe ich nicht. Ich habe mit das masm32 runtergeladen, das der typ hier im tutorial auch verwendet:
    https://www.youtube.com/watch?v=gklpZIVuTBY

    und zum ausführen gehe ich immer auf project -> build all.

    ich sehe nicht, wo ich da beim Linken noch was einstellen kann.



  • PeterSchmeter schrieb:

    und zum ausführen gehe ich immer auf project -> build all.

    Dann klick mal auf Project-Console Build All. Für ein Konsolenprogramm brauchst Du ein Konsolen-Build.

    viele grüße
    ralph



  • DANKE DANKE!! Jetztz hats geklappt! Douh, auf die Idee häzze ich auch kommen können 😃 Sorry für diesen nicht ganz so nützlichen Beitrag! Und Danke noch mal!


Anmelden zum Antworten