Modify the background color (frame color) of the menu bar, not the color of the menu item or top menu.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.