Difference between revisions of "Lua:getWindowCaption"
Jump to navigation
Jump to search
(Created page with "<p><b>getWindowCaption(windowhandle)</b> : string - Returns the caption of the window</p> <p></p> <pre> local hwnd = findWindow("WTWindow", "Game") print( getWindowCaption(hwn...") |
m (Syntax Highlighting.) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | [[Category:Lua]] | |
| − | + | {{CodeBox|'''function''' getWindowCaption(''windowhandle'') ''':''' string}} | |
| − | < | + | |
| − | local | + | Returns the caption text of a window. |
| − | print( getWindowCaption( | + | |
| − | </ | + | The window is identified by its window handle. |
| + | |||
| + | ===Function Parameters=== | ||
| + | {|width="85%" cellpadding="10%" cellspacing="0" border="0" | ||
| + | !align="left"|Parameter | ||
| + | !align="left"|Type | ||
| + | !style="width: 80%;background-color:white;" align="left"|Description | ||
| + | |- | ||
| + | |windowhandle | ||
| + | |Integer | ||
| + | |The handle of the window whose caption should be returned. | ||
| + | |} | ||
| + | |||
| + | ===Returns=== | ||
| + | String — The caption text of the specified window. | ||
| + | |||
| + | ===Examples=== | ||
| + | <syntaxhighlight lang="lua" line> | ||
| + | local form = createForm() | ||
| + | form.Caption = "Example Window" | ||
| + | |||
| + | local caption = getWindowCaption(form.Handle) | ||
| + | |||
| + | print(caption) | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | <syntaxhighlight lang="lua" line> | ||
| + | local mainForm = getMainForm() | ||
| + | |||
| + | if mainForm ~= nil then | ||
| + | local caption = getWindowCaption(mainForm.Handle) | ||
| + | print("Main form caption: " .. tostring(caption)) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | <syntaxhighlight lang="lua" line> | ||
| + | local memoryView = getMemoryViewForm() | ||
| + | |||
| + | if memoryView ~= nil then | ||
| + | print(getWindowCaption(memoryView.Handle)) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ===Notes=== | ||
| + | * The function requires a valid window handle. | ||
| + | * For Cheat Engine controls and forms, the Handle property can usually be used. | ||
| + | * For normal Cheat Engine form objects, reading the Caption property directly is usually simpler. | ||
| + | |||
| + | {{LuaSeeAlso}} | ||
| + | |||
| + | {{Forms}} | ||
Latest revision as of 19:53, 25 June 2026
Returns the caption text of a window.
The window is identified by its window handle.
Contents
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| windowhandle | Integer | The handle of the window whose caption should be returned. |
Returns[edit]
String — The caption text of the specified window.
Examples[edit]
1 local form = createForm()
2 form.Caption = "Example Window"
3
4 local caption = getWindowCaption(form.Handle)
5
6 print(caption)
1 local mainForm = getMainForm()
2
3 if mainForm ~= nil then
4 local caption = getWindowCaption(mainForm.Handle)
5 print("Main form caption: " .. tostring(caption))
6 end
1 local memoryView = getMemoryViewForm()
2
3 if memoryView ~= nil then
4 print(getWindowCaption(memoryView.Handle))
5 end
Notes[edit]
- The function requires a valid window handle.
- For Cheat Engine controls and forms, the Handle property can usually be used.
- For normal Cheat Engine form objects, reading the Caption property directly is usually simpler.