Jump to content

WinRestoreWindowPos: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
m totally wrong content replaced
Line 1: Line 1:
This function obtains the title under which a specified application is started, or is added to the Window List.
Restores the size and position of the window


==Syntax==
==Syntax==
  WinQuerySessionTitle(hab, ulSession, pszTitle, ulTitlelen)
  WinRestoreWindowPos (AppName, KeyName, hwnd)


==Parameters==
==Parameters==
;hab (HAB) - input:Anchor-block handle.
;AppName (PSZ): Pointer to the application name
;ulSession (ULONG) - input:Session identity of application whose title is requested.
;KeyName (PSZ): Pointer to the key name
:Use the session identity of the caller Other
;hwnd (HWND): Window handle
:Use the specified session identity.
;pszTitle (PSZ) - output:Window List title.
:This is the title of the application with a process identity, if the application is present in the Window List.
;ulTitlelen (ULONG) - input:Maximum length of data returnable, in bytes.
:If the pszTitle parameter is longer than this value, the title is truncated. However, the terminating null character is left at the end of the string. The maximum number of title characters copied is (ulTitlelen-1).


==Returns==
==Returns==
;rc (ULONG) - returns:Return code.
;rc (BOOL) - returns:Return code.
:;Successful completion
:;Other
::Error occurred.
 
==Remarks==
This function is useful when an application uses the same name in its window title (and in its entry in the Window List) as the end user invokes to start the application. This provides a visual link for the end user.
 
If this function is used after a Window List entry is created for the application, the title in the Window List entry is obtained. (See also WinQueryTaskTitle.)
 
==Example Code==
This example calls WinQuerySessionTitle to retrieve the application's title, and then sets the title bar of the frame window to that title.
<pre>
#define INCL_WINMESSAGEMGR
#define INCL_WINWINDOWMGR
#include <os2.h>
 
HAB  hab;
HWND hwndFrame, hwndClient;
CHAR szTitle[MAXNAMEL + 1];
 
WinQuerySessionTitle(hab,
                    0,
                    szTitle,
                    sizeof(szTitle));
 
hwndFrame = WinQueryWindow(hwndClient,
                          QW_PARENT); /* get handle of parent, */
                                          /* which is frame window. */
WinSetWindowText(hwndFrame, szTitle);
</pre>
 
==Related Functions==
* [[WinAddSwitchEntry]]
* [[WinChangeSwitchEntry]]
* [[WinCreateSwitchEntry]]
* [[WinQuerySessionTitle]]
* [[WinQuerySwitchEntry]]
* [[WinQuerySwitchHandle]]
* [[WinQuerySwitchList]]
* [[WinQueryTaskSizePos]]
* [[WinQueryTaskTitle]]
* [[WinRemoveSwitchEntry]]
* [[WinSwitchToProgram]]


[[Category:Win]]
[[Category:Win]]

Revision as of 21:01, 21 November 2023

Restores the size and position of the window

Syntax

WinRestoreWindowPos (AppName, KeyName, hwnd)

Parameters

AppName (PSZ)
Pointer to the application name
KeyName (PSZ)
Pointer to the key name
hwnd (HWND)
Window handle

Returns

rc (BOOL) - returns
Return code.