mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 16:44:05 +00:00
6e01fc8dce
Added new _STRCMP and _STRICMP commands for quick string comparisons. Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders. Altered UCASE and LCASE routines to be faster in some situations for us.
61 lines
No EOL
1.9 KiB
Text
61 lines
No EOL
1.9 KiB
Text
The {{KW|_TITLE}} statement provides the program name in the title bar of the QB64 program window.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:<code>{{KW|_TITLE}} {{Parameter|Text$}}</code>
|
|
|
|
|
|
{{PageDescription}}
|
|
* The text can be any literal or variable [[STRING]] or [[ASCII]] character value.
|
|
* The title can be changed anywhere in a program procedure.
|
|
* The title bar will say "Untitled" if a title is not used.
|
|
|
|
|
|
''Example 1:'' How to create the window title bar.
|
|
{{CodeStart}} '' ''
|
|
{{Cl|_TITLE}} "My New Program" '' ''
|
|
{{CodeEnd}}
|
|
|
|
|
|
''Example 2:'' How to find the currently running program module name and current path using a Windows API Library.
|
|
{{CodeStart}} '' ''
|
|
{{Cl|_TITLE}} "My program"
|
|
{{Cl|_DELAY}} 5 '5 second delay
|
|
|
|
{{Cl|_TITLE}} {{Cl|MID$}}(TITLE$, 1, {{Cl|INSTR}}(TITLE$, ".") - 1)
|
|
|
|
{{Cl|PRINT}} PATH$
|
|
|
|
|
|
{{Cl|FUNCTION}} TITLE$ '=== SHOW CURRENT PROGRAM
|
|
{{Cl|SHARED}} PATH$
|
|
{{Cl|DECLARE LIBRARY}} 'Directory Information using KERNEL32 provided by Dav
|
|
{{Cl|FUNCTION}} GetModuleFileNameA ({{Cl|BYVAL}} Module {{Cl|AS}} {{Cl|LONG}}, FileName {{Cl|AS}} {{Cl|STRING}}, {{Cl|BYVAL}} nSize {{Cl|AS}} {{Cl|LONG}})
|
|
{{Cl|DECLARE LIBRARY|END DECLARE}}
|
|
|
|
FileName$ = {{Cl|SPACE$}}(256)
|
|
Result = GetModuleFileNameA(0, FileName$, {{Cl|LEN}}(FileName$))
|
|
{{Cl|IF...THEN|IF}} Result {{Cl|THEN}}
|
|
PATH$ = {{Cl|LEFT$}}(FileName$, Result)
|
|
start = 1
|
|
DO
|
|
posit = {{Cl|INSTR}}(start, PATH$, "\")
|
|
{{Cl|IF...THEN|IF}} posit {{Cl|THEN}} last = posit
|
|
start = posit + 1
|
|
{{Cl|LOOP}} {{Cl|UNTIL}} posit = 0
|
|
TITLE$ = {{Cl|MID$}}(PATH$, last + 1)
|
|
PATH$ = {{Cl|LEFT$}}(PATH$, last)
|
|
{{Cl|ELSE}} TITLE$ = "": PATH$ = ""
|
|
{{Cl|END IF}}
|
|
{{Cl|END FUNCTION}} '' ''
|
|
{{CodeEnd}}
|
|
: ''Note:'' The actual module file name is returned. Not necessarily the Title value. The value returned can be used however.
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
|
|
*[[_ICON]]
|
|
*[[ASCII]]
|
|
|
|
|
|
{{PageNavigation}} |