The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: loki_dre on January 08, 2009, 05:11:03 AM

Title: system("pause");
Post by: loki_dre on January 08, 2009, 05:11:03 AM
Hello I have the following command in C++ and I need to bring it over to MASM:
system("pause");

My include file is:
include \masm32\include\masm32rt.inc
Title: Re: system("pause");
Post by: donkey on January 08, 2009, 05:35:25 AM
WaitForSingleObject can wait for the console input buffer to have unread data, you have only to pass hConsoleInput to it and wait on keyboard events.

http://msdn.microsoft.com/en-us/library/ms684199(VS.85).aspx
Title: Re: system("pause");
Post by: RotateRight on January 08, 2009, 11:53:29 PM
One way of doing it ..

;****************
;* SysPause.asm *
;****************

.386
.model flat,stdcall
option casemap:none

public start

system proto c :dword
ExitProcess proto :dword
Pause proto

includelib kernel32.lib
includelib msvcrt.lib

.data

strCommand db "Pause",13,10,0

.code

start:
        invoke  Pause
        invoke  ExitProcess,0

Pause proc 
        invoke system,addr strCommand
        ret
Pause endp
   
end start