mirror of
https://github.com/QB64Official/qb64.git
synced 2024-09-28 11:17:47 +00:00
70 lines
2.1 KiB
Text
70 lines
2.1 KiB
Text
{{DISPLAYTITLE:_TITLE}}
|
|
The [[_TITLE]] statement sets the program window's title-bar text.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[_TITLE]] {{Parameter|text$}}
|
|
|
|
|
|
{{PageParameters}}
|
|
* {{Parameter|text$}} can be any literal or variable [[STRING]] value.
|
|
|
|
|
|
{{PageDescription}}
|
|
* The title bar will display "Untitled" if a title is not set with this statement.
|
|
* The title of created [[$CONSOLE]] windows can be set using [[_CONSOLETITLE]].
|
|
* Note: A [[_DELAY|delay]] may be required before the title can be set. See [[_SCREENEXISTS]].
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example 1:'' How to set the program window's title-bar text.
|
|
{{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
|
|
{{Cl|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}}
|