WinCreateFrameControls: Difference between revisions
Appearance
Created page with "This function creates the standard frame controls for a specified window. ==Syntax== WinCreateFrameControls(hwndFrame, pfcdata, pszTitle); ==Parameters== ;hwndFrame (HWND) ..." |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This function creates the standard frame controls for a specified window. | This function creates the standard frame controls for a specified window. | ||
==Syntax== | ==Syntax== | ||
WinCreateFrameControls(hwndFrame, pfcdata, pszTitle) | WinCreateFrameControls(hwndFrame, pfcdata, pszTitle) | ||
==Parameters== | ==Parameters== | ||
;hwndFrame (HWND) - input | ;hwndFrame (HWND) - input:Frame-window handle. | ||
:Frame-window handle. | :Becomes the parent and owner window of all the frame controls that are created: | ||
::HWND_DESKTOP - The desktop window | |||
:Becomes the parent and owner window of all the frame controls that are created: | ::HWND_OBJECT - Object window | ||
::Other - Specified window. | |||
: | ;pfcdata (PFRAMECDATA) - input:Frame-control data. | ||
: | |||
: | |||
;pfcdata (PFRAMECDATA) - input | |||
:Frame-control data. | |||
:This includes a combination of frame creation flags (FCF_*), that specifies which frame controls are to be created. For further information, see | :This includes a combination of frame creation flags (FCF_*), that specifies which frame controls are to be created. For further information, see | ||
;pszTitle (PSZ) - input:Title string. | |||
;pszTitle (PSZ) - input | :This parameter contains a string that is displayed in the WC_TITLEBAR control only when FCF_TITLEBAR is specified in pfcdata. | ||
:Title string. | |||
:This parameter contains a string that is displayed in the WC_TITLEBAR control only when FCF_TITLEBAR is specified in pfcdata. | |||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns | ;rc (BOOL) - returns:Success indicator. | ||
:Success indicator. | ::TRUE - Successful completion | ||
: | ::FALSE - Error occurred. | ||
: | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError: | ||
;PMERR_INVALID_HWND (0x1001) | ;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified. | ||
:An invalid window handle was specified. | ;PMERR_INVALID_FLAG (0x1019):An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits. | ||
;PMERR_INVALID_FLAG (0x1019) | |||
:An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits. | |||
==Remarks== | ==Remarks== | ||
This function is typically used when the standard frame controls are needed for use with a nonstandard window (such as a non WC_FRAME class). | This function is typically used when the standard frame controls are needed for use with a nonstandard window (such as a non WC_FRAME class). | ||
All of the controls are created with the standard FID_* window identifiers; see | All of the controls are created with the standard FID_* window identifiers; see | ||
The controls are created but not formatted. Formatting must be done by setting the required positions. All controls are created with position and size set to zero and WS_VISIBLE is not set. | The controls are created but not formatted. Formatting must be done by setting the required positions. All controls are created with position and size set to zero and WS_VISIBLE is not set. | ||
==Example Code== | ==Example Code== | ||
This example creates frame controls (title bar, system menu, size border, and min/max buttons) for a button window created by WinCreateWindow. The new controls are owned by and children of the button window. | |||
This example creates frame controls (title bar, system menu, size border, and min/max buttons) for a button window created by WinCreateWindow. The new controls are owned by and children of the button window. | |||
<pre> | <pre> | ||
#define INCL_WINWINDOWMGR /* Window Manager Functions */ | #define INCL_WINWINDOWMGR /* Window Manager Functions */ | ||
Line 107: | Line 78: | ||
==Related Functions== | ==Related Functions== | ||
*WinCalcFrameRect | *[[WinCalcFrameRect]] | ||
*[[WinCreateStdWindow]] | |||
*[[WinCreateStdWindow]] | *[[WinCreateWindow]] | ||
*[[WinCreateWindow]] | *[[WinDefWindowProc]] | ||
*WinDefWindowProc | *[[WinDestroyWindow]] | ||
*WinDestroyWindow | *[[WinQueryClassInfo]] | ||
*WinQueryClassInfo | *[[WinQueryClassName]] | ||
*WinQueryClassName | *[[WinRegisterClass]] | ||
*[[WinRegisterClass]] | *[[WinSubclassWindow]] | ||
*[[WinSubclassWindow]] | |||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 18:48, 10 April 2025
This function creates the standard frame controls for a specified window.
Syntax
WinCreateFrameControls(hwndFrame, pfcdata, pszTitle)
Parameters
- hwndFrame (HWND) - input
- Frame-window handle.
- Becomes the parent and owner window of all the frame controls that are created:
- HWND_DESKTOP - The desktop window
- HWND_OBJECT - Object window
- Other - Specified window.
- pfcdata (PFRAMECDATA) - input
- Frame-control data.
- This includes a combination of frame creation flags (FCF_*), that specifies which frame controls are to be created. For further information, see
- pszTitle (PSZ) - input
- Title string.
- This parameter contains a string that is displayed in the WC_TITLEBAR control only when FCF_TITLEBAR is specified in pfcdata.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE - Successful completion
- FALSE - Error occurred.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
- PMERR_INVALID_FLAG (0x1019)
- An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits.
Remarks
This function is typically used when the standard frame controls are needed for use with a nonstandard window (such as a non WC_FRAME class).
All of the controls are created with the standard FID_* window identifiers; see
The controls are created but not formatted. Formatting must be done by setting the required positions. All controls are created with position and size set to zero and WS_VISIBLE is not set.
Example Code
This example creates frame controls (title bar, system menu, size border, and min/max buttons) for a button window created by WinCreateWindow. The new controls are owned by and children of the button window.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINLISTBOXES /* List Box definitions */ #define INCL_WINFRAMEMGR /* Frame Manager Functions */ #include <os2.h> HWND hwnd; /* cursor display window */ ULONG flStyle; /* window style */ USHORT ButtonId; /* window id (app supplied) */ BOOL fSuccess; /* success indicator */ FRAMECDATA pFcdata; /* Frame-control data */ USHORT usFrameId; /* frame resource id (app supplied) */ flStyle = WS_VISIBLE; /* create window visible */ /* create button window (no frame controls) */ hwnd = WinCreateWindow(HWND_DESKTOP, /* parent window */ WC_BUTTON, /* class name */ "new button", /* window text */ flStyle, /* window style */ 0, 0, /* position (x,y) */ 200, 100, /* size (width,height) */ 0L, /* owner window */ HWND_TOP, /* sibling window */ ButtonId, /* window id */ NULL, /* control data */ NULL); /* presentation parms */ /****************************** * initialize frame structure * ******************************/ pFcdata.cb = sizeof(FRAMECDATA); /* Length */ /* Frame-creation flags */ pFcdata.flCreateFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX; pFcdata.hmodResources = 0L; /* resource in EXE */ pFcdata.idResources = usFrameId; /* resource id */ /* create frame controls; display 'button frame' on title bar */ fSuccess = WinCreateFrameControls(hwnd, &pFcdata, "button frame");