Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WinWindowFromID (1.2)
◄Changes► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_WINMESSAGEMGR
HWND WinWindowFromID(hwndParent, id)
HWND hwndParent; /* parent-window handle */
USHORT id; /* window identifier */
The WinWindowFromID function returns the first child window that has the
specified identifier of the specified parent window.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hwndParent Identifies the parent window.
id Identifies the window.
Return Value
The return value is a window handle. If no child window exists with
identifier id the return value is NULL.
Comments
To obtain the window handle for an item within a dialog box, the hwndParent
parameter is set to the dialog-box window's handle and the id parameter is
set to the identifier of the item in the dialog template.
To obtain the window handle for a frame control, the hwndParent parameter is
set to the frame window's handle and the id parameter is set to one of the
FID constants, indicating which frame control you want a handle of.
The following list contains the frame control identifiers. Note that you
must also define the INCL_WINFRAMEMGR constant before including pmwin.h.
Value Meaning
────────────────────────────────────────────────────────────────────────────
FID_CLIENT Identifies the client window.
FID_HORZSCROLL Identifies the horizontal scroll bar.
FID_MENU Identifies the application menu.
FID_MINMAX Identifies the minimize/maximize box.
FID_SYSMENU Identifies the system menu.
FID_TITLEBAR Identifies the title bar.
FID_VERTSCROLL Identifies the vertical scroll bar.
Example
This example calls WinWindowFromID to get the window handle of the system
menu and calls WinSendMsg to send a message to disable the Close menu item.
#define INCL_WINMESSAGEMGR /* includes message manager functions */
#define INCL_WINFRAMEMGR /* includes FID_ constants */
#include <os2.h>
HWND hwndSysMenu;
hwndSysMenu = WinWindowFromID(hwndDlg, FID_SYSMENU);
WinSendMsg(hwndSysMenu, MM_SETITEMATTR,
MPFROM2SHORT(SC_CLOSE, TRUE),
MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));
See Also
WinMultWindowFromIDs, WinWindowFromPoint
♦