"Press any key to continue . . ." for console apps
Posted: Sat Dec 27, 2008 3:26 am
Code: Select all
RunProgram("cmd.exe","/k pause","")
End

http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
RunProgram("cmd.exe","/k pause","")
End
Code: Select all
OpenConsole()
PrintN("test")
RunProgram("cmd.exe","/k pause","")
PrintN("test")
Input()
Code: Select all
OpenConsole()
print("Press any key to continue...")
input()
printn("pressed...")
input() ; to avoid immediate close
CloseConsole()
Try it with any key but enter.graves wrote:Code: Select all
OpenConsole() print("Press any key to continue...") input() printn("pressed...") input() ; to avoid immediate close CloseConsole()
Code: Select all
Procedure WaitAnyKey()
While Not Inkey()
Delay(10)
Wend
EndProcedure
OpenConsole()
PrintN("Press any key to continue...")
WaitAnyKey()
PrintN("ok")
Input()
CloseConsole()
Code: Select all
ImportC "msvcrt.lib"
system(str.p-ascii)
EndImport
OpenConsole()
system("Pause")
Mine has this key...Rook Zimbabwe wrote:But... but... my keyboard doesn't HAVE an ANY key!!!![]()
(command not found)cmd wrote:Der Befehl "P" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
lolz?Mistrel wrote:It's only useful to pause the console as it ends not while it's running.
Thank You MistrelRook Zimbabwe wrote:But... but... my keyboard doesn't HAVE an ANY key!!!![]()
Seriously nice idea Mistrel!
Thank you for this, hallodri. I was actually trying to use the same function "System" which is available in Dev-C++ for calling Pause but could not find something similar in PureBasic. This is it.hallodri wrote:try this :
Code: Select all
ImportC "msvcrt.lib" system(str.p-ascii) EndImport OpenConsole() system("Pause")