comment $
//-----------------------------------------------------------------------------------//
//  Source code                                                                      //
//                                                                                   //
//  Written      by  Chib, Alexm			       		     //
//                                                                                   //
//  FileName   : XXMenu.asm                                                          //
//  Description: example for libraries of functions for work with menu               //
//  Version    : 1.00.000, December 1, 2004                                          //
//-----------------------------------------------------------------------------------//
$
; #########################################################################

;     include files
;     ~~~~~~~~~~~~~
      include \masm32\include\WINDOWS.INC
      include \masm32\include\masm32.inc
      include \masm32\include\gdi32.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc
      include \masm32\include\comctl32.inc
      include \masm32\include\comdlg32.inc
      include \masm32\include\shell32.inc
      include \masm32\include\oleaut32.inc
      include \masm32\include\msimg32.inc
      include \masm32\include\debug.inc

;     libraries
;     ~~~~~~~~~
      includelib \masm32\lib\masm32.lib
      includelib \masm32\lib\gdi32.lib
      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib
      includelib \masm32\lib\comctl32.lib
      includelib \masm32\lib\comdlg32.lib
      includelib \masm32\lib\shell32.lib
      includelib \masm32\lib\oleaut32.lib
      includelib \masm32\lib\msimg32.lib
      includelib \masm32\lib\debug.lib
      
      include \masm32\MACROS\Macros.asm
      
      ; # Menu #
      
      include 		XXControls.inc
      includelib 		XXControls.lib

$invoke MACRO Fun:REQ, A:VARARG
  IFB <A>
    invoke Fun
  ELSE
    invoke Fun, A
  ENDIF
  EXITM <eax>
        ENDM
        
IF_MSG macro WMsg:REQ, DoJmp:REQ
   cmp uMsg, WMsg
   jz  DoJmp
endm

WM_CASE macro reg,msgs
   irp msg,<msgs>
      cmp reg,WM_&msg
      je @@&msg
   endm
endm

HIWORD macro bigword
   mov  eax,bigword
   shr  eax,16         ;; Get high word
endm

; #########################################################################

        ;=================
        ; Local prototypes
        ;=================
        WndProc          PROTO :HWND, :UINT, :WPARAM, :LPARAM
        RegisterWinClass PROTO :DWORD, :DWORD, :HICON, :HCURSOR, :HBRUSH
        MsgLoop          PROTO
        Main             PROTO

        wsprintfA        PROTO C :DWORD,:VARARG
        wsprintf         equ <wsprintfA>        

        DrawBorderProc   PROTO :HMENU,:HDC,:DWORD
        ChangeStyleMenu  PROTO :HWND,:DWORD
       
    .data
        szXXControls                DB          "XXControls!!!",0
        szXXMenu		      DB	        "XXMenu!!!",0		
        lf	                LOGFONTA    <20, 0, 900, 900, 600, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Courier New">
        lf_small	                LOGFONTA    <20, 0, 900, 900, 500, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Comic Sans MS">
        szSysMenu		      DB	        "System menu.",0
        szTheme		      DB	        "Select theme.",0
        
    .data?
        hInstance                   HINSTANCE   ?
;        hIcon                       HICON       ?
        hCursor                     HCURSOR     ?
        hWnd                        HWND        ?
        hMenu                       HMENU       ?
        hSysMenu                    HMENU       ?
        hThemeMenu		      HMENU       ?
        hFileMenu		      HMENU       ?
        hContextMenu                HMENU       ?           
        hImageList                  HIMAGELIST  ?
        hImageListBig	      HIMAGELIST  ?
        h_Accel		      HACCEL      ?

    .const

        IDD_ABOUT                   equ         800       
        MAINMENU                    equ         600
        
        IDM_FILE_NEW                equ         1002
        IDM_FILE_OPEN               equ         1004
        IDM_FILE_SAVE               equ         1006
        IDM_FILE_SAVE_AS            equ         1008
        IDM_FILE_PRINT              equ         1010
        IDM_FILE_PRINT_PREVIEW      equ         1012
        IDM_FILE_PRINT_SETUP        equ         1014
        IDM_FILE_RECENT_FILE        equ         1016
        IDM_FILE_APP_EXIT           equ         1018
        IDM_EDIT_UNDO               equ         1020
        IDM_EDIT_CUT                equ         1022
        IDM_EDIT_COPY               equ         1024
        IDM_EDIT_PASTE              equ         1026
        IDM_EDIT_DELETE             equ         1028
        
        IDM_EDIT_BMP                equ         1080
        
        IDM_VIEW_TOOLBARS           equ         1030
        IDM_VIEW_TOOLBARS_STANDARD  equ         1032
        IDM_VIEW_TOOLBARS_THEME     equ	        1033
        IDM_VIEW_TOOLBARS_CUSTOMIZE equ         1034
        IDM_VIEW_SATATUSBAR         equ         1036
        IDM_VIEW_THEME_DEFAULT      equ         1040
        IDM_VIEW_THEME_OFFICE_2000  equ         1042
        IDM_VIEW_THEME_OFFICE_XP    equ         1044
        IDM_VIEW_THEME_XNET	      equ	        1046
        IDM_HELP_ABOUT_MENU_XX      equ         1050
        
        IDM_SHOW_DISABLED	      equ	        1060
        IDM_SHOW_BORDER	      equ         1062
        
        IDM_32_BIG1		      equ	        1070
        IDM_32_BIG2		      equ	        1072
        IDM_32_BIG3		      equ	        1074
        
        IDB_BITMAP1                 equ         100
        IDB_BITMAP2                 equ         102
        ACC		      equ	        110
        
        mnubtns                     MNUBUTTON <IDM_FILE_NEW,0>
                                    MNUBUTTON <IDM_FILE_OPEN,1>
                                    MNUBUTTON <IDM_FILE_SAVE,2>
                                    MNUBUTTON <IDM_FILE_PRINT,3>
                                    MNUBUTTON <IDM_FILE_PRINT_PREVIEW,4>
                                    MNUBUTTON <IDM_FILE_PRINT_SETUP,5>
                                    MNUBUTTON <IDM_EDIT_UNDO,6>
                                    MNUBUTTON <IDM_EDIT_CUT,7>
                                    MNUBUTTON <IDM_EDIT_COPY,8>
                                    MNUBUTTON <IDM_EDIT_PASTE,9>
                                    MNUBUTTON <IDM_EDIT_DELETE,10>
                                    MNUBUTTON <IDM_VIEW_TOOLBARS_CUSTOMIZE,11>
                                    MNUBUTTON <IDM_HELP_ABOUT_MENU_XX,12>
        nmnubtns            	      equ         13
        
; ########################### Inserted modules ############################

        ; #? - About #
        
        include 		XXAbout.inc
        includelib 		XXAbout.lib
        ; ------------------------------------
        include               tbmacros.asm
        include               toolbar.asm
        include               Statusbr.asm 

; #########################################################################