0% found this document useful (0 votes)
37 views2 pages

A1806A16 Wndassignment 3

When clicking the upper left corner of the screen outside the client area: - Windows treats this as interacting with the non-client area - It activates the system menu/Window menu, which provides standard options like resizing or closing the window - To attach the system menu, include the WS_SYSMENU window style when creating the window - This will allow the user to right click the title bar or use Alt+Space to access the system menu When shifting focus between two open windows: - The inactive window first receives a WM_MOUSEACTIVATE message - If it returns MA_ACTIVATE, it becomes active and receives WM_SETFOCUS - The previously active window

Uploaded by

Shoyab Siddiqui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

A1806A16 Wndassignment 3

When clicking the upper left corner of the screen outside the client area: - Windows treats this as interacting with the non-client area - It activates the system menu/Window menu, which provides standard options like resizing or closing the window - To attach the system menu, include the WS_SYSMENU window style when creating the window - This will allow the user to right click the title bar or use Alt+Space to access the system menu When shifting focus between two open windows: - The inactive window first receives a WM_MOUSEACTIVATE message - If it returns MA_ACTIVATE, it becomes active and receives WM_SETFOCUS - The previously active window

Uploaded by

Shoyab Siddiqui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Differentiate between DestroyMenu() and DeleteMenu().?

Ans:- DestroyMenu() :- During the WM_DESTROY message, NOPOPUPS sets the program's
menu to the Main menu and destroys the File and Edit menus with calls to DestroyMenu. The
Main menu is destroyed automatically when the window is destroyed.
DeleteMenu :-Deletes an item from the specified menu. If the menu item opens a menu or
submenu, this function destroys the handle to the menu or submenu and frees the memory
used by the menu or submenu.

2:-Differentiate between the use of WM_SYSCOMMAND and WM_COMMAND.?

Ans:- WM_COMMAND. This message indicates that the user has chosen an enabled menu
item from your window's menu.

The WM_SYSCOMMAND message is similar to the WM_COMMAND message except


that WM_SYSCOMMAND signals that the user has chosen an enabled menu item from the
system menu

3:-List the steps necessary for creating child windows?

Ans:- CreateMenu Creates a menu. The menu is initially empty, but it can be filled with menu items
by using the InsertMenuItem, AppendMenu, and InsertMenu functions.

AppendMenu Appends a new item to the end of the specified menu bar, drop-down menu,
submenu, or shortcut menu. You can use this function to specify the content, appearance, and
behavior of the menu item.
CheckMenuItem Sets the state of the specified menu item's check-mark attribute to either selected
or clear.
CreatePopupMenu Creates a drop-down menu, submenu, or shortcut menu. The menu is
initially empty. You can insert or append menu items by using the InsertMenuItem function.
You can also use the InsertMenu function to insert menu items and the AppendMenu
function to append menu items.
Defining a menu in a program's resource script is usually the easiest way to add a menu in
your window, but it's not the only way. You can dispense with the resource script and create a
menu entirely within your program by using two
functions called CreateMenu and AppendMenu. After you finish defining the menu, you can
pass the menu handle to CreateWindow or use SetMenu to set the window's menu. Here's
how it's done. CreateMenu simply returns a handle to a new menu:
hMenu = CreateMenu () ;

The menu is initially empty. AppendMenu inserts items into the menu. You must obtain a
different menu handle for the top-level menu item and for each popup. The popups are
constructed separately; the popup menu handles arethen inserted into the top-level menu. The
code shown in Figure 10-7 creates a menu in this fashion; in fact, it is the same menu that I
used in the MENUDEMO program. For illustrative simplicity, the code uses ASCII character
strings.
4:-Suppose we click on upper left corner of the whole screen, it means we aren’t restricting on
the client area, we are clicking on non-client area’s upper left corner, elaborate the action taken
by windows. Also, elaborate the things necessary for attaching that function in your window.

Ans:-

Using System Menus


The Window menu (also known as the System menu or Control menu) is a pop-up menu
defined and managed almost exclusively by the operating system.

The user can open the window menu by clicking the application icon on the title bar or by
right-clicking anywhere on the title bar or Alt+ Spacebar can be used.
Example : Notepad Application
 System menus can be attached to program window by including WS_SYSMENU
window style when calling CreateWindow().
 WS_SYSMENU is a part of WS_OVERLAPPED WINDOW. So system menu will
be added automatically to your program if you use WS_OVERLAPPEDWINDOW
style.
 You can explicitly add WS_SYSMENU to child and popup windows.
 The Window menu provides a standard set of menu items that the user can choose to
change a window's size or position, or close the application.
 Items on the window menu can be added, deleted, and modified, but most applications
just use the standard set of menu items.

 It returns the handle of a window’s system menu. Then you can operate on the menu.
 Syntax:
hmenu= GetSystemMenu(hwnd,FALSE );

OR

GetSystemMenu(hwnd,TRUE );

5:-Suppose two instances of same window application or different window applications are opened,
one is in active state and the other is in inactive state. Now, if we shift from one instance into the
other with the help of mouse, elaborate the actions taken and the messages generated by the
windows.?

Ans:-

You might also like