Menus Ex - No:7 Date: Aim
Menus Ex - No:7 Date: Aim
Ex.No:7
Date:
AIM:
To develop menus using resource script in windows program.
FUNCTIONS:
PostMessage: This Function Places (posts) a message in the message queue associated with the
thread that created the specified window and returns without waiting for the thread to process the
message.
Syntax:
BOOL WINAPI PostMessage(HWND hWnd,UINT Msg, WPARAM
wParam, LPARAM lParam);
Parameters:
hWnd [in, optional]
Type: HWND
A handle to the window whose window procedure is to receive the message. The
following values have special meanings.
Value Meaning
HWND_BROADCAST The message is posted to all top-level windows in the system,
((HWND)0xffff) including disabled or invisible unowned windows, overlapped
windows, and pop-up windows. The message is not posted to child
windows.
NULL The function behaves like a call to PostThreadMessage with
the dwThreadId parameter set to the identifier of the current thread.
Starting with Windows Vista, message posting is subject to UIPI. The thread of a
process can post messages only to message queues of threads in processes of
lesser or equal integrity level.
Msg [in]
Type: UINT
The message to be posted.
For lists of the system-provided messages, see System-Defined Messages.
wParam [in]
Type: WPARAM
Additional message-specific information.
lParam [in]
Type: LPARAM
Additional message-specific information.
Return Value
If the function succeeds, the return value is nonzero.If the function fails, the return value
is zero.
Polygon: The function draws a polygon consisting of two or more vertices connected by straight
lines. The polygon is outlined by using the current pen and filled by using the current brush and
polygon fill mode.
Syntax:
Parameters:
hdc [in]
A handle to the device context.
lpPoints [in]
A pointer to an array of POINT structures that specify the vertices of the
polygon, in logical coordinates.
nCount [in]
The number of vertices in the array. This value must be greater than or equal to 2.
Return Value:
If the function succeeds, the return value is nonzero.If the function fails, the return
value is zero.
Syntax:
Parameters:
hWnd [in]
A handle to the window to be redrawn. If this parameter is NULL, the desktop
window is updated.
lprcUpdate [in]
A pointer to a RECT structure containing the coordinates, in device units, of the
update rectangle. This parameter is ignored if thehrgnUpdate parameter identifies
a region.
hrgnUpdate [in]
A handle to the update region. If both the hrgnUpdate and lprcUpdate parameters
are NULL, the entire client area is added to the update region.
flags [in]
One or more redraw flags. This parameter can be used to invalidate or validate a
window, control repainting, and control which windows are affected
by RedrawWindow.
The following flags are used to invalidate the window.
The following flags are used to validate the window.
The following flags control when repainting occurs. RedrawWindow will not
repaint unless one of these flags is specified.
Flag Description
RDW_ERASENOW Causes the affected windows (as specified by the
RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to
receiveWM_NCPAINT and WM_ERASEBKGND messages, if
necessary, before the function returns. WM_PAINT messages are
received at the ordinary time.
RDW_UPDATENOW Causes the affected windows (as specified by the
RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to
receiveWM_NCPAINT, WM_ERASEBKGND,
and WM_PAINT messages, if necessary, before the function returns.
By default, the windows affected by RedrawWindow depend on whether the
specified window has the WS_CLIPCHILDREN style. Child windows that are
not the WS_CLIPCHILDREN style are unaffected; non-WS_CLIPCHILDREN
windows are recursively validated or invalidated until a WS_CLIPCHILDREN
window is encountered. The following flags control which windows are affected
by the RedrawWindow function.
Flag Description
RDW_ALLCHILDREN Includes child windows, if any, in the repainting operation.
RDW_NOCHILDREN Excludes child windows, if any, from the repainting
operation.
Return Value:
If the function succeeds, the return value is nonzero.If the function fails, the return value
is zero.
Parameters:
wInteger
Return Value:
The return value is the specified value in the low-order word and zero in the high-order
word.
LoadMenu: Loads the specified menu resource from the executable (.exe) file associated with
an application instance.
Parameters:
hInstance [in, optional]
HINSTANCE
lpMenuName [in]
LPCTSTR
The name of the menu resource. Alternatively, this parameter can consist of the
resource identifier in the low-order word and zero in the high-order word. To
create this value, use the MAKEINTRESOURCE macro.
Return Value:
If the function succeeds, the return value is a handle to the menu resource.If the function
fails, the return value is NULL