Jump to content

WinEnableControl

From EDM2
Revision as of 04:07, 9 April 2025 by Martini (talk | contribs) (Created page with "This macro sets the enable state of the item in the dialog template to the enable flag. ==Syntax== WinEnableControl(hwndDlg, usId, fEnable) ==Parameters== ;hwndDlg (HWND) - Input : Dialog window handle. ;usId (USHORT) - Input : Identity of the item in the dialog template (button id). ;fEnable (BOOL) - Input : Enable flag. ==Returns== ;rc (BOOL) - returns : Success indicator. :;TRUE :: Successful completion. :;FALSE :: Error occurred. ==Remarks== <pre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This macro sets the enable state of the item in the dialog template to the enable flag.

Syntax

WinEnableControl(hwndDlg, usId, fEnable)

Parameters

hwndDlg (HWND) - Input
Dialog window handle.
usId (USHORT) - Input
Identity of the item in the dialog template (button id).
fEnable (BOOL) - Input
Enable flag.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion.
FALSE
Error occurred.

Remarks

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

HWND      hwndDlg;  /*  Dialog window handle. */
USHORT    usId;     /*  Identity of the item in the dialog template (button id). */
BOOL      fEnable;  /*  Enable flag. */
BOOL      rc;       /*  Success indicator. */

rc = WinEnableControl(hwndDlg, usId, fEnable);

This macro expands to:

#define WinEnableControl(hwndDlg, usId, fEnable) WinEnableWindow(WinWindowFromId(hwndDlg, usId), fEnable)

This function requires the existence of a message queue.

Example Code

This example uses WinEnableControl to enable a dialog control if it is currently disabled.

#define INCL_WINWINDOWMGR      /* Window Manager Functions    */
#include <os2.H>

HWND   hwndDlg;       /* dialog window                     */
MPARAM mp1;           /* Parameter 1                       */
USHORT usId;          /* dialog control id                 */


if (!WinIsControlEnabled(hwndDlg, usId))
   WinEnableControl(hwndDlg, usId, TRUE);

Related Functions