📄 tooltest44.asm
字号:
TBButt hWndTool, 7,IDM_DELETE,4,8,0
TBSep hWndTool
TBButt hWndTool, 10,IDM_FIND,4,0,0
TBButt hWndTool, 11,IDM_FINDNEXT,4,0,0
TBButt hWndTool, 12,IDM_FINDPREV,4,0,0
TBButt hWndTool, 13,IDM_REPLACE,4,0,0
TBSep hWndTool
TBButt hWndTool, 15,IDM_EXIT,4,0,0
;---------- [Create the FloatToolbar] ----------
INVOKE CreateWindowEx, WS_EX_TOOLWINDOW or WS_EX_WINDOWEDGE, addr FloatTBClass,
0, WS_POPUP or\
WS_VISIBLE or WS_THICKFRAME, 346, 305, 31, 250,
hwnd, NULL, hInst, NULL
mov hWndFloat, eax
INVOKE CreateWindowEx, 0, addr ToolClass, 0,
WS_CHILD or WS_VISIBLE or TBSTYLE_TOOLTIPS or CCS_NOPARENTALIGN or\
CCS_NORESIZE or CCS_ADJUSTABLE or TBSTYLE_FLAT or\
TBSTYLE_WRAPABLE or CCS_NODIVIDER,\
-1, -1, 1200, 26, hWndFloat, 0, hInst, 0
mov hWndToolF, eax
INVOKE SendMessage, hWndToolF, TB_BUTTONSTRUCTSIZE, sizeof TBBUTTON, 0
INVOKE SendMessage, hWndToolF, TB_SETIMAGELIST, 0, hImageList
;---------- [Size the Bitmap and Button] ----------
mov ecx, 16 ; loword = bitmap Width
mov eax, 16 ; hiword = bitmap Height
shl eax, 16
mov ax, cx
mov bSize, eax
INVOKE SendMessage, hWndToolF, TB_SETBITMAPSIZE, 0, bSize
mov eax, 23 ; loword = button Width
mov ecx, 22 ; hiword = button Height
shl ecx, 16
mov cx, ax
INVOKE SendMessage, hWndToolF, TB_SETBUTTONSIZE, 0, ecx
;---------- [Create the Float Toolbar structures] ----------
TBButt hWndToolF, 0,IDM_NEW,4,0,0
TBButt hWndToolF, 1,IDM_OPEN,4,0,0
TBButt hWndToolF, 2,IDM_SAVE,4,0,0
TBButt hWndToolF, 4,IDM_CUT,4,0,0
TBButt hWndToolF, 5,IDM_COPY,4,0,0
TBButt hWndToolF, 6,IDM_PASTE,4,0,0
TBButt hWndToolF, 7,IDM_DELETE,4,0,0
TBButt hWndToolF, 10,IDM_FIND,4,0,0
TBButt hWndToolF, 11,IDM_FINDNEXT,4,0,0
TBButt hWndToolF, 12,IDM_FINDPREV,4,0,0
TBButt hWndToolF, 13,IDM_REPLACE,4,0,0
TBButt hWndToolF, 15,IDM_EXIT,4,0,0
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [Create the Edit Window] ----------
INVOKE CreateWindowEx, NULL, addr RichEdit, NULL,\
WS_CHILD or WS_VISIBLE or WS_BORDER or ES_MULTILINE or\
ES_NOHIDESEL or ES_SAVESEL or ES_SELECTIONBAR or\
WS_HSCROLL or ES_AUTOHSCROLL or\
WS_VSCROLL or ES_AUTOVSCROLL,\
0, 0, 0, 0, hwnd, 4444, hInst, NULL
.if !eax
;Do message
jmp Ret0
.endif
mov hREdit, eax
INVOKE SendMessage, hREdit, EM_EXLIMITTEXT, 0, 4000000
INVOKE SetFocus, hREdit
;---------- [Control window subclassed] ----------
INVOKE SetWindowLong, hREdit, GWL_WNDPROC, RichEditProc
mov lpRichEdit, eax
INVOKE LoadMenu, hInst, addr PopupMenu
INVOKE GetSubMenu, eax, 0
mov hSMenu, eax
;---------- [Get the character format] ----------
mov charF.cbSize, sizeof charF
INVOKE SendMessage, hREdit, EM_GETCHARFORMAT, TRUE, addr charF
mov eax, FontW
mov charF.wWeight, ax
INVOKE lstrcpy, addr FontName, addr FontNameCN
INVOKE RtlZeroMemory, addr lf, sizeof lf
INVOKE lstrcpy, addr lf.lfFaceName, addr FontName
push FontHeight
pop lf.lfHeight
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 Dropdown ++++++++++++++++++++++++++++++++++++++++++++++++++++
INVOKE SendMessage, hWndTool, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;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
;Insert between
;++++ Sizing code +++++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [AutoSize the Toolbar Control] ----------
INVOKE SendMessage, hWndTool, TB_AUTOSIZE, 0, 0
INVOKE MoveWindow, hWndStat, 0, 0, 0, 0, TRUE
;---------- [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
.if hWndDock
mov edx, 0
add ecx, TBHgt
sub ecx, 2
.endif
.if FloatLock
mov eax, ToolW
.if ToolH > eax
add eax, 6
mov xPos, eax
sub ebx, ToolW
sub ebx, 6
.else
mov xPos, 0
add edx, ToolH
add edx, 6
sub ecx, ToolH
sub ecx, 6
.endif
.endif
INVOKE MoveWindow, hREdit, xPos, edx, ebx, ecx, TRUE
INVOKE MoveWindow, hWndTool, TBLeft, TBTop, TBWth, TBHgt, TRUE
;---------- [Size the Floating Toolbar] ----------
.if hWndFloat && !ToolH
INVOKE GetWindowRect, hWnd, addr rect
add rect.left, 195
add rect.top, -29
mov rect.right, 94
mov rect.bottom, 0
mov ToolH, 1
INVOKE MoveWindow, hWndFloat, rect.left, rect.top, rect.right, rect.bottom, TRUE
.elseif hWndFloat && FloatLock
INVOKE GetWindowRect, hREdit, addr rect
mov eax, rect.left
sub rect.right, eax
mov eax, rect.top
sub rect.bottom, eax
mov ecx, ToolW
.if ecx < ToolH
add ecx, 6
sub rect.left, ecx
mov edx, rect.bottom
.else
mov edx, ToolH
add edx, 6
sub rect.top, edx
mov ecx, rect.right
.endif
INVOKE MoveWindow, hWndFloat, rect.left, rect.top, ecx, edx, TRUE
.endif
;---------- [Size the Docking Toolbar] ----------
.if hWndDock
INVOKE SendMessage, hWndTool, TB_BUTTONCOUNT, 0, 0
mov Cnt, eax
mov ecx, Cnt
dec ecx
INVOKE SendMessage, hWndTool, TB_GETITEMRECT, ecx, addr rect
push rect.right
pop DockW
add DockW, 8
push rect.bottom
pop DockH
add DockH, 24
inc rect.right
add rect.bottom, 3
INVOKE MoveWindow, hWndTool, 0, -2, rect.right, rect.bottom, TRUE
INVOKE GetWindowRect, hWndDock, addr rect
push rect.left
push rect.top
INVOKE GetWindowRect, hWnd, addr rect
pop edx
pop ecx
.if ecx == 0 || edx == 0
add rect.left, 6
add rect.top, 44
.else
mov rect.left, ecx
mov rect.top, edx
.endif
INVOKE MoveWindow, hWndDock, rect.left, rect.top, DockW, DockH, TRUE
.endif
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Insert between
;++++ MOVE or ACTIVATEAPP Msg +++++++++++++++++++++++++++++++++++++++++
;---------- [MOVE Msg] ----------
.elseif wMsg == WM_MOVE
.if FloatLock
mov LockOn, 1
.endif
call SetSize
;---------- [ACTIVATEAPP Msg] ----------
.elseif wMsg == WM_ACTIVATEAPP
INVOKE DefWindowProc, hWnd, WM_NCACTIVATE, wParam, 0
ret
.elseif wMsg == WM_NCACTIVATE
mov eax, TRUE
ret
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Insert between
;++++ Notify code +++++++++++++++++++++++++++++++++++++++++++++++++++++
;---------- [Get Tooltips] ----------
.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 ecx, eax
INVOKE LoadString, hInst, ecx, addr szBuff, lengthof szBuff
mov ebx, lParam ; Get the buffer addr
lea eax, szBuff
mov (TOOLTIPTEXT ptr [ebx]).lpszText, eax
mov eax, FALSE
ret
.endif
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Insert between if any
;++++ Activate Docking Toolbar ++++++++++++++++++++++++++++++++++++++++
;---------- [Activate Docking Toolbar] ----------
.if eax == NM_RDBLCLK && !hWndDock
INVOKE GetWindowLong, hWndTool, GWL_STYLE
mov Styles, eax
.if (Styles & WS_BORDER)
xor Styles, WS_BORDER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -