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

📄 tooltest44.asm

📁 用masm写的TOOBar生成器
💻 ASM
📖 第 1 页 / 共 4 页
字号:
                     sub     rectF.bottom, 26
               .endif
                  mov     LockOn, 1
               INVOKE     MoveWindow, hWndFloat, rectF.left, rectF.top, rectF.right, rectF.bottom, TRUE
                  mov     FloatLock, 1
            .endif
              call     SetSize

               mov     eax, 1
               ret
         .endif
            jmp     DefWin
      .endif

      .if wmsg == WM_NCLBUTTONDBLCLK
         INVOKE     PostMessage, hWndFloat, WM_NCLBUTTONDOWN, HTCAPTION, 0
      .endif
         mov     eax, hwnd
      .if eax != hWndFloat
            mov     eax, 1
            ret
      .endif

      .if wmsg == WM_MOVE
         INVOKE     SetFocus, hREdit
         .if !ToolW
               mov     eax, TRUE
               ret
         .endif
            and     swOn, 0
         INVOKE     GetWindowRect, hWndFloat, addr rectF ; Rectangle of Float
         INVOKE     GetWindowRect, hREdit, addr rectE ; Rectangle of Edit

            mov     eax, lparam       ; Get xPos
            and     eax, 0ffffh       ; Lowword
            mov     ecx, lparam       ; Get yPos
            shr     ecx, 16           ; Hiword

            add     rectE.left, 6
            add     rectE.top, 6

         .if eax < 10 || eax > 7fffh || ecx > 7fffh
            .if eax > 10
                 push     eax
               INVOKE     GetWindowRect, hWndFloat, addr rectF ; Rectangle of Float
                 push     rectF.left
                 push     rectF.top
               INVOKE     GetClientRect, hWndFloat, addr rectF ; Rectangle of Float
                  pop     ecx
                  pop     edx
                  pop     eax
               .if eax > 7fffh
                     mov     rectF.top, ecx
               .else
                     mov     rectF.left, edx
               .endif
                  add     rectF.right, 6
                  add     rectF.bottom, 6
               INVOKE     MoveWindow, hWndFloat, rectF.left, rectF.top, rectF.right, rectF.bottom, TRUE
            .endif
               and     FloatLock, 0
               xor     eax, eax
               ret
         .endif

            mov     ebx, eax
            sub     eax, 10
            add     ebx, 10
            mov     edx, ecx
            sub     ecx, 10
            add     edx, 10

         .if eax < rectE.left && ebx > rectE.left &&\
             ecx < rectE.top && edx > rectE.top || LockOn
               and     LockOn, 0
               mov     FloatLock, 1
            INVOKE     GetClientRect, hWndFloat, addr rectF
            INVOKE     GetClientRect, hREdit, addr rectE
               mov     eax, rectF.right
            .if eax > rectF.bottom
                  mov     WH, 1
                  mov     eax, 22  ; Height
                 push     rectE.right
                 push     eax
            .else
                  mov     WH, 2
                  mov     eax, 23  ; Width
                 push     rectE.bottom
                 push     eax
            .endif
               jmp     NewPos

         .else
            INVOKE     GetClientRect, hWndFloat, addr rectF
               and     FloatLock, 0
              call     SetSize
            INVOKE     GetWindowRect, hWndFloat, addr rect
            INVOKE     SendMessage, hWndToolF, TB_BUTTONCOUNT, 0, 0
               mov     Cnt, eax
            .if rectF.right == 23 || rectF.bottom == 22
               .if rectF.right == 23
                    imul     eax, 22
                     mov     rectF.bottom, eax
               .elseif rectF.bottom == 22
                    imul     eax, 23
                     mov     rectF.right, eax
               .endif

                  mov     WH, 1
                 push     rectF.right
                 push     rectF.bottom
                  jmp     NewPos
            .endif
         .endif
            mov     eax, TRUE
            ret
      .endif

      .if wmsg == WM_SIZE
         INVOKE     SendMessage, hWndToolF, TB_BUTTONCOUNT, 0, 0
            mov     Cnt, eax
         .if !eax
               jmp     DefWin
         .endif
         INVOKE     GetClientRect, hREdit, addr rectE
         INVOKE     GetWindowRect, hWndFloat, addr rect
            mov     eax, lparam       ; Get width
            and     eax, 0ffffh       ; Lowword
            mov     ebx, lparam       ; Get height
            shr     ebx, 16           ; Hiword

         .if !ToolW
               mov     ToolW, eax
               mov     ToolH, ebx
               dec     ToolW
         .endif

            and     swOn, 0
            xor     edx, edx
         .if FloatLock && ebx == ToolH && eax != ToolW
               mov     WH, 1
               mov     eax, 22  ; Height
              push     rectE.right
              push     eax
               mov     swOn, 1
               jmp     NewPos
         .endif
         .if FloatLock && eax == ToolW && ebx != ToolH
               mov     WH, 2
               mov     eax, 23  ; Width
              push     rectE.bottom
              push     eax
               mov     swOn, 2
               jmp     NewPos
         .endif

         .if eax != ToolW || ebx != ToolH
               mov     WH, 1
               mov     ecx, 22
            .if ebx != ToolH
                  mov     WH, 2
                  mov     ecx, 23
                  mov     eax, ebx
            .endif
               div     ecx
            .if edx
                  inc     eax
            .endif
            .if eax > Cnt
                  mov     eax, Cnt
            .endif

DoAgain:
            .if !eax
                  mov     eax, 1
            .endif
               mov     ebx, eax

               mov     Var, 22
            .if WH == 1
                  mov     Var, 23
            .endif
              imul     eax, Var

              push     eax           ; W if WH == 1
               xor     edx, edx
               mov     eax, Cnt
               div     ebx
            .if !eax
                  inc     eax
            .endif
            .if edx
                  inc     eax
            .endif

            .if WH == 2 && eax == 2 || WH == 2 && eax == 3
              imul     ebx, eax
               .if ebx > Cnt
                  .if eax == 3
                        pop     eax
                        xor     edx, edx
                        mov     eax, Cnt
                        mov     ebx, 3
                        div     ebx
                        jmp     DoAgain
                  .endif
                     pop     eax
                     mov     eax, Cnt
                     jmp     DoAgain
               .endif
            .endif

               mov     Var, 23
            .if WH == 1
                  mov     Var, 22
            .endif
              imul     eax, Var
              push     eax           ; H if WH == 1

NewPos:
            INVOKE     GetWindowRect, hWndFloat, addr rect
            .if WH == 1
                  pop     eax
                  pop     ebx
            .else
                  pop     ebx
                  pop     eax
            .endif

               mov     ToolW, ebx
               mov     ToolH, eax
               mov     rect.right, ebx
               mov     rect.bottom, eax
               add     rect.right, 6
               add     rect.bottom, 6

            .if FloatLock
                  and     FloatLock, 0
                 call     SetSize
                  mov     FloatLock, 1
               INVOKE     GetWindowRect, hREdit, addr rectE
                MOVmd     rect.left, rectE.left
                MOVmd     rect.top, rectE.top
               INVOKE     GetClientRect, hREdit, addr rectE
               .if swOn
                  .if swOn == 1
                        jmp     sw01
                  .else
                        jmp     sw02
                  .endif
                     jmp     PressOn
               .endif
               INVOKE     GetClientRect, hWndFloat, addr rectF
                  mov     eax, rectF.right
               .if eax > rectF.bottom
sw01:
                     mov     rect.bottom, 22  ; Height
                     mov     ToolH, 22
                     add     rect.bottom, 6
                   MOVmd     rect.right, rectE.right
                     add     rect.right, 6
               .else
sw02:
                     mov     rect.right, 23   ; Width
                     mov     ToolW, 23
                     add     rect.right, 6
                   MOVmd     rect.bottom, rectE.bottom
                     add     rect.bottom, 6
               .endif
            .endif

PressOn:
            INVOKE     MoveWindow, hWndFloat, rect.left, rect.top, rect.right, rect.bottom, TRUE
            INVOKE     GetClientRect, hWndFloat, addr rect
               add     rect.right, 2
               add     rect.bottom, 2
            INVOKE     MoveWindow, hWndToolF, -1, -1, rect.right, rect.bottom, TRUE
              call     SetSize
         .endif
            jmp     Ret0

      .elseif wmsg == WM_NOTIFY
            mov     ebx, lparam                      ; Get pointer to NMHDR
            mov     eax, (NMHDR ptr [ebx]).code
         .if eax == TTN_NEEDTEXT
               mov     eax, (NMHDR ptr [ebx]).idFrom ; Resource id
               mov     ebx, eax
            INVOKE     LoadString, hInst, ebx, addr szBuff, lengthof szBuff
               mov     ebx, lparam                   ; Get the buffer addr
               lea     eax, szBuff
               mov     (TOOLTIPTEXT ptr [ebx]).lpszText, eax
               jmp     Ret0
         .endif
            jmp     DefWin

      .elseif wmsg == WM_COMMAND
         INVOKE     SendMessage, hWnd, WM_COMMAND, wparam, lparam
         INVOKE     SetFocus, hREdit
            xor     eax, eax
            jmp     Ret0
      .endif

DefWin:
      INVOKE     DefWindowProc, hwnd, wmsg, wparam, lparam
         ret

Ret0:
         xor     eax, eax
         ret
FloatWndProc ENDP
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Insert between if any
;++++ SetSize PROC ++++++++++++++++++++++++++++++++++++++++++++++++++++
;======================================================
; Call WM_SIZE PROCEDURE
;======================================================
SetSize PROC
LOCAL    rect:RECT

      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

SetSize ENDP
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

end start

⌨️ 快捷键说明

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