在win32上没有与MASM组装的程序的控制台输出

时间:2011-12-30 01:59:14

标签: winapi assembly masm

我正在运行一些MASM32示例(来自www.masm32.com),我注意到我的命令行框中的控制台输出是空白的(程序编译,链接和运行但没有输出。

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive

    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                       ; Tell MASM where the code starts


start:                          ; The CODE entry point to the program

    print chr$("Hey, this actually works.",13,10)
    exit


end start                       ; Tell MASM where the program ends

1 个答案:

答案 0 :(得分:3)

链接Win32的PE程序时,可以将所需的子系统标记为“GUI”或“Console”。如果您将其作为GUI模式程序链接,那么当您从命令提示符运行EXE时,Windows将不会将控制台附加到您键入的窗口。这听起来像你描述的症状。

确保将可执行文件与“console”子系统标志链接。

相关问题