Jump to content

WinIsThreadActive: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function determines whether the active window belongs to the calling execution thread.


This function determines whether the active window belongs to the calling execution thread.
==Syntax==
==Syntax==
  WinIsThreadActive(hab)
  WinIsThreadActive(hab)
==Parameters==
==Parameters==
;hab (HAB) - input
;hab (HAB) - input:Anchor-block handle of calling thread.
:Anchor-block handle of calling thread.  


==Returns==
==Returns==
;rc (BOOL) - returns
;rc (BOOL) - returns:Active-window indicator.
:Active-window indicator.
:;TRUE:Active window belongs to the calling thread
:;TRUE
:;FALSE:Active window does not belong to the calling thread.
::Active window belongs to the calling thread  
:;FALSE
::Active window does not belong to the calling thread.


==Example Code==
==Example Code==
Line 49: Line 46:


rc = WinIsThreadActive(hab);
rc = WinIsThreadActive(hab);
</pre>
</pre>


Line 64: Line 59:
* WinWindowFromDC
* WinWindowFromDC
* WinWindowFromID
* WinWindowFromID
* WinWindowFromPoint  
* WinWindowFromPoint
 
[[Category:Win]]
[[Category:Win]]

Latest revision as of 14:13, 4 October 2023

This function determines whether the active window belongs to the calling execution thread.

Syntax

WinIsThreadActive(hab)

Parameters

hab (HAB) - input
Anchor-block handle of calling thread.

Returns

rc (BOOL) - returns
Active-window indicator.
TRUE
Active window belongs to the calling thread
FALSE
Active window does not belong to the calling thread.

Example Code

This example uses WinIsThreadActive to verify that the active window belongs to the current thread before querying and enabling the system menu window via WinIsWindowEnabled and WinEnableWindow.

#define INCL_WINWINDOWMGR   /* Window Manager Functions */
#define INCL_WINFRAMEMGR    /* Window Frame Functions   */
#include <os2.h>

HAB   hab;                  /* Anchor-block handle      */
HWND    hwndSysmenu;        /* System menu window       */
HWND    hwnd;               /* Parent window            */
BOOL  fSuccess;             /* Success indicator        */

/* If the active window belongs to the current thread,  */
/* query the enabled status of the system menu          */
if (WinIsThreadActive(hab))
   {
     /* Obtain the handle for the system menu */
     hwndSysmenu = WinWindowFromID(hwnd,FID_SYSMENU);

     /* If the system menu is disabled, enable it */
     if (!WinIsWindowEnabled(hwndSysmenu))
        fSuccess = WinEnableWindow(hwndSysmenu, TRUE);
   }

Definition

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB     hab;  /*  Anchor-block handle of calling thread. */
BOOL    rc;   /*  Active-window indicator. */

rc = WinIsThreadActive(hab);

Related Functions

  • WinEnableWindow
  • WinIsWindow
  • WinIsWindowEnabled
  • WinQueryDesktopWindow
  • WinQueryObjectWindow
  • WinQueryWindowDC
  • WinQueryWindowProcess
  • WinQueryWindowRect
  • WinWindowFromDC
  • WinWindowFromID
  • WinWindowFromPoint