Jump to content

WinIsThreadActive

From EDM2

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