SHELL (function) - mkilgore/QB64pe GitHub Wiki
The SHELL function displays the console and returns the INTEGER code value sent when the external program exits.
- return_code = SHELL(DOScommand$)
- The literal or variable STRING command parameter can be any valid external command or call to another program.
- A SHELL to a QB64 EXE program with an exit return code parameter after END or SYSTEM will return that code value.
- The return_code is usually 0 when the external program ends with no errors.
- The console window may appear when using the SHELL function. The _SHELLHIDE function will hide the console from view.
[[CONST|CONST]] SM_CXSCREEN = 0 [[CONST|CONST]] SM_CYSCREEN = 1 [[DECLARE LIBRARY|DECLARE LIBRARY]] [[FUNCTION|FUNCTION]] GetSystemMetrics& ([[BYVAL|BYVAL]] n [[AS|AS]] [[LONG|LONG]]) [[DECLARE LIBRARY|END DECLARE]] [[PRINT|PRINT]] trimstr$(GetSystemMetrics(SM_CXSCREEN)); "X"; trimstr$(GetSystemMetrics(SM_CYSCREEN)) s& = [[_SCREENIMAGE|_SCREENIMAGE]] [[PRINT|PRINT]] [[_WIDTH (function)|_WIDTH]](s&); "X"; [[_HEIGHT|_HEIGHT]](s&) [[END|END]] 3 '<<<<<< add a code to return after END or SYSTEM in any program [[FUNCTION|FUNCTION]] trimstr$ (whatever) trimstr = [[LTRIM$|LTRIM$]]([[RTRIM$|RTRIM$]]([[STR$|STR$]](whatever))) [[END FUNCTION|END FUNCTION]] '' '' |
- Explanation: To set a program exit code use an INTEGER parameter value after END or SYSTEM in the called program.
- After compiling DesktopSize.EXE run the following code in the QB64 IDE. After 1st program is done 3 will appear on screen:
PRINT returncode% 'prints code sent by called program after it is closed END '' '' |
3 |
See also:
Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page