Step 1: Add the following code to cmainframe: oncreate
[Align = left]
-
C/C ++ code
-
Cbrush * newbrush; newbrush = new cbrush; newbrush-> createsolidbrush (RGB (139,137,137); menuinfo = {0}; menuinfo. cbsize = sizeof (menuinfo); menuinfo. hbrback = * newbrush; // use a brush to change the background color menuinfo. fmask = mim_background; menuinfo. dwstyle = mns_autodismiss; cmenu * pmenu = This-> getmenu (); If (ismenu (pmenu-> m_hmenu) {setmenuinfo (pmenu-> m_hmenu, & menuinfo );}
[/Align]
This code should be nice to understand. Step 2: Add the following code at the beginning of stdafx. h.
-
C/C ++ code
-
#ifndef WINVER #define WINVER 0x0501 #endif
Without step 2, The menuinfo structure will not be available. 0x0501 corresponds to the XP system. If the landlord is not using XP, You can query the following table:
Windows 95 and
Windows NT 4.0 winver = 0x0400
Windows 98 and
Windows NT 4.0 _ win32_windows = 0x0410 and winver = 0x0400
Windows NT 4.0 _ win32_winnt = 0x0400 and winver = 0x0400
Windows 98_win32_windows = 0x0410
Windows 2000 _ win32_winnt = 0x0500 and winver = 0x0500
Windows ME _ win32_windows = 0x0490
Windows XP and
Windows. NET Server _ win32_winnt = 0x0501 and winver = 0x0501
Internet Explorer 3.0, 3.01, 3.02 _ win32_ie = 0x0300
Internet Explorer 4.0 _ win32_ie = 0x0400
Internet Explorer 4.01 _ win32_ie = 0x0401
Internet Explorer 5.0, 5.0a, 5.0b _ win32_ie = 0x0500
Internet Explorer 5.01, 5.5 _ win32_ie = 0x0501
Internet Explorer 6.0 _ win32_ie = 0x0560 or
_ Win32_ie = 0x0600