Microsoft KB Archive/65958

INF: Sample That Creates Window That Uses System Menu Bitmap PSS ID Number: Q65958 Article last modified on 09-06-1991 PSS database name: P_PresMan

1.21

OS/2

Summary:

The steps listed below can be used to create a standard window (a window with a title bar, minimum/maximum button, system menu, menu bar, and so on) with the smaller version of the system menu bitmap used in child windows (except in this case, the window is not a child window):

  Call WinCreateStdWindow and specify the system menu items in the resource file.   Call the WinGetSysBitmap function to obtain a bitmap handle to the child system menu. For example: /*  Get the child system bitmap. */ hbmChildSysMenu = WinGetSysBitmap(HWND_DESKTOP, SBMP_CHILDSYSMENU);   Call the WinLoadMenu function to load the system menu items from the resource file. For example: hwndSysMenu = WinLoadMenu(hwndFrame, NULL, IDM_DOCSYSMENU);   By using the handle to the system menu, it is possible to make the window resemble the system menu to the frame manager with the following calls: /*  Make it look like a normal system menu to the frame manager to ensure that it gets formatted correctly. */ flStyle = WinQueryWindowULong(hwndSysMenu, QWL_STYLE); WinSetWindowULong(hwndSysMenu, QWL_STYLE, flStyle | MS_TITLEBUTTON); WinSetWindowUShort(hwndSysMenu, QWS_ID, FID_SYSMENU);</li></ul> </li>  Call the WinSendMsg function to set the bitmap of the menu to the programmer’s bitmap, and call the WinShowWindow function to show the frame window. For example: /*  Set the bitmap to the SBMP_CHILDSYSMENU bitmap. */ WinSendMsg(hwndSysMenu, MM_SETITEMHANDLE, (MPARAM)SC_DOCSYSMENU, (MPARAM)hbmChildSysMenu);</li></ul>

WinShowWindow(hwndFrame, TRUE); </li></ol>

In the Software/Data Library is a file named SYSMENUR that implements this type of functionality. SYSMENUR can be found in the Software/Data Library by searching on the word SYSMENUR, the Q number of this article, or S12717. SYSMENUR was archived using the PKware file-compression utility.

Copyright Microsoft Corporation 1991.