mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 10:15:09 +00:00
71 lines
No EOL
2.2 KiB
Text
71 lines
No EOL
2.2 KiB
Text
{{DISPLAYTITLE:_TITLE}}
|
|
The [[_TITLE]] statement provides the program name in the title bar of the program window.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[_TITLE]] {{Parameter|text$}}
|
|
|
|
|
|
{{Parameters}}
|
|
* {{Parameter|text$}} can be any literal or variable [[STRING]] or [[ASCII]] character value.
|
|
|
|
|
|
{{PageDescription}}
|
|
* The title can be changed anywhere in a program procedure.
|
|
* The title bar will say "Untitled" if a title is not set.
|
|
* Change the title of the [[$CONSOLE]] windows created using [[_CONSOLETITLE]]
|
|
* '''Note: A [[_DELAY|delay]] may be required before the title can be set.''' See [[_SCREENEXISTS]].
|
|
|
|
|
|
{{PageExamples}}
|
|
''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}}
|
|
* [[_TITLE$]] (function)
|
|
* [[_ICON]]
|
|
* [[_DELAY]]
|
|
* [[ASCII]]
|
|
* [[_CONSOLETITLE]]
|
|
* [[_SCREENEXISTS]]
|
|
|
|
|
|
{{PageNavigation}} |