#Include "window9.bi"
#Include "XXControls.bi"
Dim Shared As HMENU hMessages,MenName
Dim As Integer event
Dim As HIMAGELIST hImageList
Dim As HBITMAP hBmpImgList
Dim Shared As HWND hwnd
Dim Shared As String sValue
sValue = " FreeBasic "
hwnd  = OpenWindow("",10,10,400,400)

Function DrawBorderProc(h_Menu As HMENU, hDC As HDC, lpRect As LPRECT) As Integer

    dim hFont As HFONT
    Dim Rct   As RECT
    Dim lenStr As DWORD
    Dim nX    As DWORD
    Dim nY    As DWORD
    Dim lf_small As LOGFONTA  = Type(20, 0, 900, 900, 500, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Comic Sans MS")
    Dim lf As LOGFONTA  = Type(20, 0, 900, 900, 600, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Courier New")
    
    if IsMenu(h_Menu) = 0 Then return 0
    
    If hDC<>0 And lpRect<>0 Then               
        NumColorBits
        If NumColorBits > 8 Then
            var GSC =  GetSysColor(COLOR_MENU )           
            Gradient_Fill(hDC, Cast(DWORD,lpRect),LightenColor(128, GSC), GSC, RECT_H)
        Else
            FillRect(hDC, lpRect, Cast(HBRUSH,COLOR_MENU+1))
        EndIf      
        SetTextColor(hDC,GetSysColor(COLOR_GRAYTEXT))    
        hFont = CreateFontIndirect(@lf)      
        hFont = SelectObject(hDC, hFont)
        lenStr  = Len(sValue)     
        nX = lpRect->Left
        nY = lpRect->bottom       
        nY-=3
        TextOut(hDC, nX, nY,sValue , lenStr)
        DeleteObject(SelectObject(hDC, hFont))
        Return FALSE   
    Else
        If h_Menu = GetSystemMenu(hwnd, FALSE)   Then     
        	Return 5
        ElseIf h_Menu = MenName then
	      Return 8 
        EndIf	   
   EndIf    
End Function


hMessages=Create_Menu()
MenName=MenuTitle(hMessages,"Стиль XP")
MenuItem(1,MenName,"1 меню")
MenuItem(2,MenName,"2 меню")
MenuItem(3,MenName,"3 меню")
MenuItem(4,MenName,"4 меню")
MenuItem(5,MenName,"5 меню")
MenuItem(6,MenName,"6 меню")

hImageList = ImageList_Create( 16, 16, ILC_COLOR or ILC_MASK, 14,0)
hBmpImgList = LoadBitmap(GetModuleHandle(0), Cast(LPCSTR,101))
ImageList_AddMasked(hImageList, hBmpImgList,bgr( 192, 192, 192))
DeleteObject(hBmpImgList)
RedrawMenu(hwnd, MenName, STYLE_XNET)
For i As Integer = 1 To 6
	SetMenuItemIcon(MenName, i, ImageList_GetIcon(hImageList, i-1, ILD_NORMAL))
Next
AddLeftBorder(MenName, Cast(DWORD,@DrawBorderProc), TRUE)
Do
 event=WaitEvent
 If event=EventClose Then End
Loop

