Option Explicit
Private Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function SetMenuInfo Lib "user32.dll" (ByVal hmenu As Long, ByRef MENUINFO As MENUINFO) As Long
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Private Type MENUINFO
cbSize As Long
fMask As Long
dwStyle As Long
cyMax As Long
hbrBack As Long
dwContextHelpID As Long
dwMenuData As Long
End Type
Private Const MIM_BACKGROUND = &H2
Private Sub Form_DblClick()
Dim mi As MENUINFO
mi.cbSize = Len(mi)
mi.fMask = MIM_BACKGROUND
mi.hbrBack = CreateSolidBrush(vbRed)
SetMenuInfo GetMenu(hwnd), mi
DrawMenuBar hwnd
End Sub
The SetSysColors function sends a WM_SYSCOLORCHANGE message to all windows to inform them of the change in color. It also directs the system to repaint the affected portions of all currently visible windows.
The SetSysColors function changes the current session only. The new colors are not saved when the system terminates.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 166