Jump to content

WinRestoreWindowPos: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This function obtains the title under which a specified application is started, or is added to the Window List.


This function obtains the title under which a specified application is started, or is added to the Window List.
==Syntax==
==Syntax==
  WinQuerySessionTitle(hab, ulSession, pszTitle, ulTitlelen);
  WinQuerySessionTitle(hab, ulSession, pszTitle, ulTitlelen)


==Parameters==
==Parameters==
;hab (HAB) - input
;hab (HAB) - input:Anchor-block handle.
:Anchor-block handle.  
;ulSession (ULONG) - input:Session identity of application whose title is requested.
 
;ulSession (ULONG) - input
:Session identity of application whose title is requested.
:Use the session identity of the caller Other
:Use the session identity of the caller Other
:Use the specified session identity.  
: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).


;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
;rc (ULONG) - returns:Return code.
:Return code.
:;Successful completion  
:;Successful completion  
:;Other
:;Other
::Error occurred.
::Error occurred.
==Remarks==
==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.
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.)  
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==
==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.
This example calls WinQuerySessionTitle to retrieve the application's title, and then sets the title bar of the frame window to that title.
Line 35: Line 30:
#define INCL_WINMESSAGEMGR
#define INCL_WINMESSAGEMGR
#define INCL_WINWINDOWMGR
#define INCL_WINWINDOWMGR
#include <OS2.H>
#include <os2.h>


HAB  hab;
HAB  hab;
Line 50: Line 45:
                                           /* which is frame window. */
                                           /* which is frame window. */
WinSetWindowText(hwndFrame, szTitle);
WinSetWindowText(hwndFrame, szTitle);
</pre>
Definition
<pre>
#define INCL_WINSWITCHLIST /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
HAB      hab;        /*  Anchor-block handle. */
ULONG    ulSession;  /*  Session identity of application whose title is requested. */
PSZ      pszTitle;    /*  Window List title. */
ULONG    ulTitlelen;  /*  Maximum length of data returnable, in bytes. */
ULONG    rc;          /*  Return code. */
rc = WinQuerySessionTitle(hab, ulSession,
      pszTitle, ulTitlelen);
</pre>
</pre>



Revision as of 07:33, 7 August 2023

This function obtains the title under which a specified application is started, or is added to the Window List.

Syntax

WinQuerySessionTitle(hab, ulSession, pszTitle, ulTitlelen)

Parameters

hab (HAB) - input
Anchor-block handle.
ulSession (ULONG) - input
Session identity of application whose title is requested.
Use the session identity of the caller Other
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

rc (ULONG) - 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.

#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);

Related Functions