📄 tooltest22.asm
字号:
xor eax, eax
mov ax, charF.wWeight
mov lf.lfWeight, eax
mov al, charF.bCharSet
mov lf.lfCharSet, al
mov al, charF.bPitchAndFamily
mov lf.lfPitchAndFamily, al
INVOKE CreateFontIndirect, ADDR lf
mov hFont, eax
INVOKE SendMessage, hREdit, WM_SETFONT, hFont, TRUE
INVOKE GetMenu, hwnd ; Get the handle to the main menu
INVOKE GetSubMenu, eax, 0 ; Get handle to 1st sub menu
INVOKE GetMenuItemCount, eax ; Get count of items in the sub menu
mov MenuCnt, eax ; Menu count for ProcessMRUFiles
;Insert between
;++++ Set variables +++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [Set various values] ----------
mov LeftOn, 0
mov TopOn, 1
mov RightOn, 0
mov BottomOn, 0
mov TBLeft, -1
mov TBTop, -2
mov TBWth, 469
mov TBHgt, 26
mov tbi.cbSize, sizeof tbi
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [Move and Size the Control(s)] ----------
.elseif wMsg == WM_SIZE
;++++ Sizing code +++++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [AutoSize the Toolbar Control] ----------
INVOKE SendMessage, hWndTool, TB_AUTOSIZE, 0, 0
;---------- [Size the Edit Toolbar Controls] ----------
xor eax, eax ; Zero out toolbar height
.if hWndTool
INVOKE GetClientRect, hWnd, addr rect ; Rectangle of main window
mov eax, rect.right
mov WWth, eax
.if TopOn || BottomOn
inc eax
mov TBWth, eax
.endif
mov eax, rect.bottom
mov WHgt, eax
INVOKE GetWindowRect, hWndTool, addr rect ; Rectangle of toolbar
mov eax, rect.bottom
sub eax, rect.top
mov TBHgt, eax
.if LeftOn || RightOn
mov eax, WHgt
mov TBHgt, eax
xor eax, eax
.endif
.endif
push eax ; Save height of toolbar
xor eax, eax ; Zero out statusbar height
.if hWndStat
INVOKE GetWindowRect, hWndStat, addr rect ; Rectangle of statusbar
mov eax, rect.bottom
sub eax, rect.top ; eax = height of statusbar
.endif
pop edx ; edx = height of toolbar
.if BottomOn
and edx, 0
.endif
mov ebx, lParam ; Width of new client area
and ebx, 0ffffh ; ebx = width
mov ecx, lParam
shr ecx, 16 ; Height of new client area
sub ecx, eax ; Edit window - height of statusbar
sub ecx, edx ; Edit window - height of toolbar
.if edx ; If toolbar
sub edx, 2 ; For border
add ecx, 2 ; For border
.endif
.if eax ; If statusbar
add ecx, 2 ; For border
.endif
and xPos, 0
.if LeftOn
mov eax, TBWth
mov xPos, eax
sub ebx, TBWth
mov TBHgt, ecx
.endif
.if RightOn
mov xPos, 0
sub ebx, TBWth
mov TBHgt, ecx
mov TBLeft, ebx
.endif
.if BottomOn
sub ecx, TBHgt
add ecx, 20 ; Statusbar height
mov TBTop, ecx
.endif
INVOKE MoveWindow, hREdit, xPos, edx, ebx, ecx, TRUE
INVOKE MoveWindow, hWndTool, TBLeft, TBTop, TBWth, TBHgt, TRUE
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.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
;Insert between
;++++ 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 < 17 ; 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
.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
.endif
mov [ebx.TBNOTIFY.tbButton].iBitmap, eax
mov [ebx.TBNOTIFY.tbButton].idCommand, edx
mov [ebx.TBNOTIFY.tbButton].fsState, TBSTATE_ENABLED
mov [ebx.TBNOTIFY.tbButton].fsStyle, TBSTYLE_BUTTON
mov [ebx.TBNOTIFY.tbButton].dwData, 0
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
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -