$SCREENHIDE: Difference between revisions
Jump to navigation
Jump to search
Code by Michael Calkins
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
{{PageDescription}} | |||
* $SCREENHIDE may be used at the start of a program to hide the main program window when using a [[$CONSOLE|console]] window. | * $SCREENHIDE may be used at the start of a program to hide the main program window when using a [[$CONSOLE|console]] window. | ||
* The [[_SCREENHIDE]] statement must be used before [[_SCREENSHOW]] can be used in sections of a program. | * The [[_SCREENHIDE]] statement must be used before [[_SCREENSHOW]] can be used in sections of a program. | ||
Line 13: | Line 14: | ||
{{PageExamples}} | {{PageExamples}} | ||
''Example:'' Hiding a program when displaying a message box in Windows. | ''Example:'' Hiding a program when displaying a message box in Windows. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|$SCREENHIDE}} | {{Cl|$SCREENHIDE}} | ||
{{Cl|DECLARE DYNAMIC LIBRARY}} "user32" | {{Cl|DECLARE LIBRARY|DECLARE DYNAMIC LIBRARY}} "user32" | ||
{{Cl|FUNCTION}} MessageBoxA& ({{Cl|BYVAL}} hWnd%&, {{Cl|BYVAL}} lpText%&, {{Cl|BYVAL}} lpCaption%&, {{Cl|BYVAL}} uType~&) | {{Cl|FUNCTION}} MessageBoxA& ({{Cl|BYVAL}} hWnd%&, {{Cl|BYVAL}} lpText%&, {{Cl|BYVAL}} lpCaption%&, {{Cl|BYVAL}} uType~&) | ||
{{Cl|DECLARE LIBRARY|END DECLARE}} | {{Cl|DECLARE LIBRARY|END DECLARE}} | ||
{{Cl|DECLARE DYNAMIC LIBRARY}} "kernel32" | {{Cl|DECLARE LIBRARY|DECLARE DYNAMIC LIBRARY}} "kernel32" | ||
{{Cl|SUB}} ExitProcess ({{Cl|BYVAL}} uExitCode~&) | {{Cl|SUB}} ExitProcess ({{Cl|BYVAL}} uExitCode~&) | ||
{{Cl|DECLARE LIBRARY|END DECLARE}} | {{Cl|DECLARE LIBRARY|END DECLARE}} | ||
Line 26: | Line 27: | ||
s1 = "Caption" + {{Cl|CHR$}}(0) | s1 = "Caption" + {{Cl|CHR$}}(0) | ||
ExitProcess MessageBoxA(0, {{Cl|_OFFSET (function)|_OFFSET}}(s0), {{Cl|_OFFSET (function)|_OFFSET}}(s1), 0) | ExitProcess MessageBoxA(0, {{Cl|_OFFSET (function)|_OFFSET}}(s0), {{Cl|_OFFSET (function)|_OFFSET}}(s1), 0) | ||
{{CodeEnd}}{{ | {{CodeEnd}} | ||
{{Small|Code by Michael Calkins}} | |||
Latest revision as of 22:58, 27 February 2024
The $SCREENHIDE metacommand can be used to hide the main program window throughout a program.
Syntax
Description
- $SCREENHIDE may be used at the start of a program to hide the main program window when using a console window.
- The _SCREENHIDE statement must be used before _SCREENSHOW can be used in sections of a program.
- QB64 metacommands cannot be commented out with apostrophe or REM.
Examples
Example: Hiding a program when displaying a message box in Windows.
$SCREENHIDE DECLARE DYNAMIC LIBRARY "user32" FUNCTION MessageBoxA& (BYVAL hWnd%&, BYVAL lpText%&, BYVAL lpCaption%&, BYVAL uType~&) END DECLARE DECLARE DYNAMIC LIBRARY "kernel32" SUB ExitProcess (BYVAL uExitCode~&) END DECLARE DIM s0 AS STRING DIM s1 AS STRING s0 = "Text" + CHR$(0) s1 = "Caption" + CHR$(0) ExitProcess MessageBoxA(0, _OFFSET(s0), _OFFSET(s1), 0) |
See also