⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tooltest44.asm

📁 用masm写的TOOBar生成器
💻 ASM
📖 第 1 页 / 共 4 页
字号:
            .endif
            INVOKE     SetWindowLong, hWndTool, GWL_STYLE, Styles
            .if FloatLock
                  mov     LockOn, 1
            .endif
              call     DockToolbar
            INVOKE     SetFocus, hWndDock
               jmp     Ret0
         .endif
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Insert between if any
;++++ Customize Toolbar code ++++++++++++++++++++++++++++++++++++++++++
;---------- [Customize the Toolbar] ----------
         .if eax == TBN_BEGINADJUST
               mov     eax, TRUE
               ret

; Add to Windows.inc Comctl32.dll version 5.80 or later- Removes the help button
         .elseif eax == TBN_FIRST-23 ;TBN_INITCUSTOMIZE
               mov     eax, 1        ;TBNRF_HIDEHELP
               ret

         .elseif eax == TBN_QUERYINSERT
               mov     eax, TRUE
               ret

         .elseif eax == TBN_QUERYDELETE
               mov     eax, TRUE
               ret

         .elseif eax == TBN_GETBUTTONINFO
               mov     eax, [ebx.TBNOTIFY].iItem ; Item num
            .if eax <= 16                    ; Num of images
                 push     ebx
                 push     eax
                  mov     Incr, eax
               INVOKE     SendMessage, hWndTool, TB_BUTTONCOUNT, 0, 0

;---------- [Find matching bitmap ID] ----------
                  and     ID, 0
                  and     Len, 0
                  mov     Cnt, eax
               .while (Cnt)
                  INVOKE     SendMessage, hWndTool, TB_GETBUTTON, ID, addr tbb
                     mov     eax, Incr
                  .if eax == tbb.iBitmap && tbb.fsStyle != TBSTYLE_SEP
                        mov     edx, tbb.idCommand
                        mov     al, tbb.fsState
                        mov     SavState, al
                        mov     al, tbb.fsStyle
                        mov     SavStyle, al
                     .break
                  .endif
                  .if tbb.fsStyle != TBSTYLE_SEP
                        inc     Len
                  .endif
                     inc     ID
                     dec     Cnt
               .endw
               .if !Cnt
                     xor     edx, edx
                     xor     esi, esi
               .endif
                  pop     eax
                  pop     ebx
               .if !edx                    ; No matching ID
                  mov     edx, eax
                     inc     edx
                     add     edx, 6900
                     mov     SavState, TBSTATE_ENABLED
                     mov     SavStyle, TBSTYLE_BUTTON
               .endif

                 push     eax
                  mov     [ebx.TBNOTIFY.tbButton].iBitmap, eax
                  mov     [ebx.TBNOTIFY.tbButton].idCommand, edx
                  mov     al, SavState
                  mov     [ebx.TBNOTIFY.tbButton].fsState, al ;TBSTATE_ENABLED
                  mov     al, SavStyle
                  mov     [ebx.TBNOTIFY.tbButton].fsStyle, al ;TBSTYLE_BUTTON
                  mov     [ebx.TBNOTIFY.tbButton].dwData, 0
                  pop     eax

                  lea     ecx, szSpace
                  xor     esi, esi
               .if eax < 16                ; Number of predefined names
                  pushad
                  INVOKE     lstrcpy, addr szTextA, szTextC[eax*4]
                   popad
                     lea     esi, szTextA
               .endif

               .if esi
                     mov     ecx, esi
                  pushad
                     mov     tbi.dwMask, TBIF_TEXT
                     mov     tbi.pszText, ecx
                     mov     SavID, edx    ; Save the command ID for TBN_TOOLBARCHANGE
                  INVOKE     SendMessage, hWndTool, TB_SETBUTTONINFO, edx, addr tbi
                   popad
               .endif
                  mov     [ebx.TBNOTIFY].cchText, 32
                  mov     [ebx.TBNOTIFY].pszText, ecx
                  mov     eax, TRUE
                  ret
            .else
                  mov     eax, FALSE
                  ret
            .endif

         .elseif eax == TBN_TOOLBARCHANGE
               lea     ecx, szTextA
               mov     tbi.dwMask, TBIF_TEXT
               mov     tbi.pszText, ecx
            INVOKE     SendMessage, hWndTool, TB_SETBUTTONINFO, SavID, addr tbi
               mov     eax, FALSE
               ret
         .endif
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Insert between if any
;++++ Toolbar Dropdown Notify code ++++++++++++++++++++++++++++++++++++++++++
;---------- [Toolbar Dropdown Notify] ----------
         .if eax == TBN_DROPDOWN
               mov     eax, [ebx.NMTOOLBAR].iItem ; Item num
            INVOKE     SendMessage, hWndTool, TB_COMMANDTOINDEX, eax, 0
               mov     ecx, eax
            INVOKE     SendMessage, hWndTool, TB_GETITEMRECT, ecx, addr rect
              push     rect.top
              push     rect.left
            INVOKE     GetWindowRect, hWndTool, addr rect
               pop     eax
               add     rect.left, eax
               pop     eax
               add     eax, 28
               add     rect.top, eax
            INVOKE     TrackPopupMenu, hSMenu, TPM_LEFTALIGN or TPM_LEFTBUTTON,\
                       rect.left, rect.top, 0, hWnd, 0
         .endif
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

         jmp     DefWin

;---------- [System and user commands] ----------
      .elseif wMsg == WM_COMMAND
            mov     eax, wParam
           cwde                          ; Only low word contains command
         .if eax == IDM_NEW
            INVOKE     SendMessage, hREdit, WM_SETTEXT, 0, offset szNull
            INVOKE     SendMessage, hREdit, EM_SETMODIFY, FALSE, 0
            INVOKE     SetFocus, hREdit

         .elseif eax == IDM_OPEN

         .elseif eax == IDM_SAVE

         .elseif eax == IDM_EXIT
            INVOKE     SendMessage, hwnd, WM_CLOSE, 0 ,0

         .elseif eax == IDM_CUT
            INVOKE     SendMessage, hREdit, WM_CUT, 0 ,0

         .elseif eax == IDM_COPY
            INVOKE     SendMessage, hREdit, WM_COPY, 0 ,0

         .elseif eax == IDM_PASTE
            INVOKE     SendMessage, hREdit, WM_PASTE, 0 ,0

         .elseif eax == IDM_DELETE
            INVOKE     SendMessage, hREdit, WM_CLEAR, 0 ,0

         .elseif eax == IDM_SELALL
            INVOKE     SendMessage, hREdit, EM_SETSEL, 0, -1

         .elseif eax == IDM_FIND

         .elseif eax == IDM_FINDNEXT

         .elseif eax == IDM_FINDPREV

         .elseif eax == IDM_REPLACE

         .endif

      .elseif wMsg == WM_CLOSE
         INVOKE     DestroyWindow, hwnd

      .elseif wMsg == WM_DESTROY
;Insert between
;++++ Destroy Imagelist +++++++++++++++++++++++++++++++++++++++++++++++
         INVOKE     ImageList_Destroy, hImageList
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         INVOKE     PostQuitMessage, NULL

      .else

DefWin:
         INVOKE     DefWindowProc, hwnd, wMsg, wParam, lParam
            ret
      .endif

Ret0:
         xor    eax, eax
         ret
WndProc endp

;===================================================
; SubClass the Edit control procedure
;===================================================
RichEditProc PROC hwnd:DWORD, wmsg, wparam, lparam
LOCAL    rect:RECT

      .if wmsg == WM_RBUTTONDOWN
            jmp     PopUp
      .endif
         jmp     ThatsAll

PopUp:
      INVOKE     GetWindowRect, hWnd, addr rect
         mov     ecx, lparam        ; x/y pos of window
         mov     ebx, ecx
         and     ebx, 0000ffffh     ; ebx = LOWORD(lparam) = x pos
         shr     ecx, 16            ; ecx = HIWORD(lparam) = y pos
         add     ebx, rect.left
         add     ecx, rect.top
         add     ebx, 10 
         add     ecx, 70
      INVOKE     TrackPopupMenu, hSMenu, TPM_LEFTALIGN or TPM_LEFTBUTTON,\
                 ebx, ecx, 0, hWnd, addr rect
        jmp      ThatsAll

ThatsAll:
      INVOKE     CallWindowProc, lpRichEdit, hwnd, wmsg, wparam, lparam

         ret
RichEditProc ENDP

;Insert between
;++++ ChgBmpColor PROC ++++++++++++++++++++++++++++++++++++++++++++++++
;===================================================
; ChgBmpColor procedure
;===================================================
ChgBmpColor PROC hBitmap:DWORD
LOCAL    mDC:DWORD, hBrush, hOldBmp, Fill, hOldBrush
      INVOKE     CreateCompatibleDC, NULL
         mov     mDC, eax
      INVOKE     SelectObject, mDC, hBitmap
         mov     hOldBmp, eax
      INVOKE     GetSysColor, COLOR_BTNFACE
      INVOKE     CreateSolidBrush, eax
         mov     hBrush, eax
      INVOKE     SelectObject, mDC, hBrush
         mov     hOldBrush, eax
         mov     Fill, 00c0c0c0h
      INVOKE     ExtFloodFill, mDC, 0, 0, Fill, FLOODFILLSURFACE
      INVOKE     ExtFloodFill, mDC, 0, 15, Fill, FLOODFILLSURFACE
      INVOKE     ExtFloodFill, mDC, 15, 0, Fill, FLOODFILLSURFACE
      INVOKE     ExtFloodFill, mDC, 15, 15, Fill, FLOODFILLSURFACE
      INVOKE     SelectObject, mDC, hOldBrush
      INVOKE     DeleteObject, hBrush
      INVOKE     SelectObject, mDC, hBitmap
        push     eax
      INVOKE     DeleteDC, mDC
         pop     eax
         ret
ChgBmpColor ENDP
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Insert between if any
;++++ Create Docking Toolbar PROC +++++++++++++++++++++++++++++++++++++
;======================================================
; Create Docking Toolbar PROCEDURE
;======================================================
DockToolbar PROC
LOCAL    rect:RECT

      .if hWndDock
         INVOKE     DestroyWindow, hWndDock
      .endif

      INVOKE     CreateWindowEx, WS_EX_TOOLWINDOW, addr FloatTBClass,
                 0, WS_POPUPWINDOW or WS_CAPTION or\
                 WS_VISIBLE or WS_THICKFRAME, 0, 0, 0, 0,\
                 hWnd, NULL, hInst, NULL
         mov     hWndDock, eax

      INVOKE     SetParent, hWndTool, hWndDock
      INVOKE     GetClientRect, hWnd, addr rect
         mov     edx, rect.bottom
         shl     edx, 16
         mov     ecx, rect.right
         mov     dx, cx
      INVOKE     SendMessage, hWnd, WM_SIZE, 0, edx

         ret
DockToolbar ENDP
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Insert between if any
;++++ FloatWndProc PROC +++++++++++++++++++++++++++++++++++++++++++++++
;===================================================
; FloatWndProc procedure
;===================================================
FloatWndProc PROC  uses ebx esi edi hwnd:DWORD, wmsg, wparam, lparam
LOCAL    rect:RECT
LOCAL    rectE:RECT
LOCAL    rectF:RECT
LOCAL    Cnt:DWORD, WH, Var, swOn
LOCAL    szBuff[64]:BYTE

         mov     eax, hwnd
      .if eax == hWndDock
         .if wmsg == WM_CLOSE || wmsg == WM_RBUTTONDBLCLK
            INVOKE     SetParent, hWndTool, hWnd
            INVOKE     DestroyWindow, hWndDock
               and     hWndDock, 0
            INVOKE     GetWindowLong, hWndTool, GWL_STYLE
               mov     Styles, eax
            .if !(Styles & WS_BORDER)
                  xor     Styles, WS_BORDER
            .endif
            INVOKE     SetWindowLong, hWndTool, GWL_STYLE, Styles
            .if FloatLock
               INVOKE     GetWindowRect, hWndFloat, addr rectF
               INVOKE     GetClientRect, hREdit, addr rectE
                  mov     eax, rectF.left
                  sub     rectF.right, eax
                  mov     eax, rectF.top
                  sub     rectF.bottom, eax

                  add     rectF.top, 26
                  mov     eax, rectF.right
               .if rectF.bottom > eax
                     sub     rectF.top, 3

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -