📄 objexp.bat
字号:
test ax, ax
.if SIGN?
mov pt.x, cxSplitterIndentL
.else
.if ax < cxSplitterIndentL
mov pt.x, cxSplitterIndentL
.endif
.endif
mov eax, rect.right
sub eax, cxSplitterIndentR
.if pt.x > eax
mov pt.x, eax
.endif
mov hdc, $invoke(GetWindowDC, hWnd)
mov ecx, g_oldy
sub ecx, 2
mov eax, rect.bottom
sub eax, 8
invoke DrawXorBar, hdc, ecx, 4, 4, eax
invoke ReleaseDC, hWnd, hdc
m2m g_oldy, pt.x
and g_fDragMode, FALSE
; convert the splitter position back to screen coords.
invoke GetWindowRect, hWnd, addr rect
mov eax, rect.left
add pt.x, eax ; pt.x += rect.left
mov eax, rect.top
add pt.y, eax ; pt.y += rect.top
; now convert into CLIENT coordinates
invoke ScreenToClient, hWnd, addr pt
invoke GetClientRect, hWnd, addr rect
m2m g_nSplitterPosX, pt.x
; position the child controls
mov eax, rect.bottom
shl eax, 16
or eax, rect.right
invoke SendMessage, hWnd, WM_SIZE, 0, eax
invoke ReleaseCapture
.endif
xor eax, eax
ret
Splitter_OnLButtonUp endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Splitter_OnMouseMove proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local pt:POINT
local hdc:HDC
local rect:RECT
.if g_fDragMode != FALSE
mov pt.x, $LOWORD(lParam) ; horizontal position of cursor
mov pt.y, $HIWORD(lParam)
invoke GetWindowRect, hWnd, addr rect
; convert the mouse coordinates relative to the top-left of the window
invoke ClientToScreen, hWnd, addr pt
mov eax, rect.left
sub pt.x, eax ; pt.x -= rect.left
mov eax, rect.top
sub pt.y, eax ; pt.y -= rect.top
; same for the window coordinates - make them relative to 0,0
not rect.left
inc rect.left ; -rect.left
not rect.top
inc rect.top ; -rect.top
invoke OffsetRect, addr rect, rect.left, rect.top
mov eax, pt.x
and eax, 0FFFFh
test ax, ax
.if SIGN?
mov pt.x, cxSplitterIndentL
.else
sub eax, cxSplitterIndentL
.if SIGN?
mov pt.x, cxSplitterIndentL
.endif
.endif
comment ^
mov eax, pt.x
and eax, 0FFFh
sub eax, cxSplitterIndentL
.if SIGN?
mov pt.x, cxSplitterIndentL
.endif
^
mov eax, rect.right
sub eax, cxSplitterIndentR
.if pt.x > eax
mov pt.x, eax
.endif
mov eax, g_oldy
.if ( pt.x != eax ) && ( wParam & MK_LBUTTON )
mov hdc, $invoke(GetWindowDC, hWnd)
mov ecx, g_oldy
sub ecx, 2
mov eax, rect.bottom
sub eax, 8
invoke DrawXorBar, hdc, ecx, 4, 4, eax
mov ecx, pt.x
sub ecx, 2
mov eax, rect.bottom
sub eax, 8
invoke DrawXorBar, hdc, ecx, 4, 4, eax
invoke ReleaseDC, hWnd, hdc
m2m g_oldy, pt.x
.endif
.endif
xor eax, eax
ret
Splitter_OnMouseMove endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; SelectedItemToStatusBar
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SelectedItemToStatusBar proc uses esi
local lvi:LV_ITEM
local tvi:TV_ITEM
invoke GetFocus
.if eax == g_hwndListView
; Get selected list view item (object path)
lea esi, lvi
assume esi:ptr LV_ITEM
mov [esi].imask, LVIF_PARAM
ListView_GetNextItem g_hwndListView, -1, LVNI_SELECTED
.if eax != -1 ; nothing selected
mov [esi].iItem, eax
ListView_GetItem g_hwndListView, esi
mov ecx, [esi].lParam
.else
mov ecx, $CTW0() ; empty string
.endif
assume esi:nothing
.else
; Get selected tree view item (directory path)
lea esi, tvi
assume esi:ptr TV_ITEM
mov [esi]._mask, TVIF_PARAM
TreeView_GetSelection g_hwndTreeView ; our tree view has always something selected, but...
mov [esi].hItem, eax
TreeView_GetItem g_hwndTreeView, esi
mov ecx, [esi].lParam
assume esi:nothing
.endif
invoke SendMessageW, g_hwndStatusBar, SB_SETTEXTW, 0, ecx
ret
SelectedItemToStatusBar endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; IfItemIsDirectoryOpen
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IfItemIsDirectoryOpen proc uses esi edi ebx
; If dbl-click or enter hit was over directory in the list view step into it and expand tree
; Return TRUE if done or FALSE otherwise
local lvi:LV_ITEM
local tvi:TV_ITEM
local uLvIndex:UINT
;local hTvItem:HTREEITEM
local achLvText[256]:CHAR
local achTvText[256]:CHAR
xor ebx, ebx ; assume its not directory
lea esi, lvi
assume esi:ptr LV_ITEM
mov [esi].imask, LVIF_PARAM
ListView_GetNextItem g_hwndListView, -1, LVNI_SELECTED
.if eax != -1 ; nothing selected
mov uLvIndex, eax
Fix Avoid to use ListView_GetItemText twice
ListView_GetItemText g_hwndListView, uLvIndex, 1, addr achLvText, sizeof achLvText
invoke lstrcmp, addr achLvText, $CTA0("Directory")
.if eax == 0
ListView_GetItemText g_hwndListView, uLvIndex, 0, addr achLvText, sizeof achLvText
TreeView_GetSelection g_hwndTreeView ; our tree view has always something selected, but...
TreeView_GetChild g_hwndTreeView, eax
mov edi, eax
; assume eax:error ; don't touch eax
; Enum all childs of selected tree view item
; And find among them corresponding to the selected list view item
lea esi, tvi
assume esi:ptr TV_ITEM
mov [esi]._mask, TVIF_TEXT
lea ecx, achTvText
mov [esi].pszText, ecx
mov [esi].cchTextMax, sizeof achTvText
; assume eax:nothing
.while edi != NULL ; break if no more childs
mov [esi].hItem, edi
TreeView_GetItem g_hwndTreeView, esi
.if eax == TRUE
invoke lstrcmp, addr achLvText, addr achTvText
.if eax == 0
; found
TreeView_Expand g_hwndTreeView, edi, TVE_EXPAND
TreeView_SelectItem g_hwndTreeView, edi
inc ebx ; set flag
.break
.endif
.endif
TreeView_GetNextSibling g_hwndTreeView, edi
mov edi, eax
.endw
.endif
.endif
assume esi:nothing
mov eax, ebx
ret
IfItemIsDirectoryOpen endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Wnd_OnNotify
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Wnd_OnNotify proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
option PROLOGUE:NONE
option EPILOGUE:NONE
; Add locals here (only one WND_PROC_LOCAL)
;WND_PROC_LOCAL dwLocal1:DWORD, dwLocal2:DWORD
mov edi, lParam
mov eax, (NMHDR PTR [edi]).hwndFrom
.if eax == g_hwndListView
; Notify message from List
.if [NMHDR PTR [edi]].code == LVN_COLUMNCLICK
assume edi:ptr NM_LISTVIEW
mov eax, g_uPrevClickedColumn
.if [edi].iSubItem != eax
; Remove bitmap from prev header column
invoke ImageToHeaderItem, g_hwndHeader, g_uPrevClickedColumn, NULL
mov g_uSortOrder, SORT_NOT_YET
mrm g_uPrevClickedColumn, [edi].iSubItem
.endif
.if ( g_uSortOrder == SORT_NOT_YET ) || ( g_uSortOrder == SORT_DESCENDING )
mov g_uSortOrder, SORT_ASCENDING
invoke ImageToHeaderItem, g_hwndHeader, [edi].iSubItem, g_hbmpHeaderArrowDown
.else
mov g_uSortOrder, SORT_DESCENDING
invoke ImageToHeaderItem, g_hwndHeader, [edi].iSubItem, g_hbmpHeaderArrowUp
.endif
ListView_SortItemsEx g_hwndListView, offset CompareFunc, [edi].iSubItem
assume edi:nothing
.elseif [NMHDR PTR [edi]].code == NM_DBLCLK
invoke IfItemIsDirectoryOpen
.if eax == FALSE
invoke ShowObjectProperties
.endif
.elseif [NMHDR PTR [edi]].code == LVN_KEYDOWN
mov eax, lParam
.if [LV_KEYDOWN PTR [eax]].wVKey == VK_RETURN
ListView_GetSelectedCount g_hwndListView
.if eax != 0
invoke IfItemIsDirectoryOpen
.if eax == FALSE
invoke ShowObjectProperties
.endif
.endif
.elseif [LV_KEYDOWN PTR [eax]].wVKey == VK_TAB
invoke SetFocus, g_hwndTreeView
.endif
.elseif [NMHDR PTR [edi]].code == LVN_ITEMCHANGED
invoke SelectedItemToStatusBar
.elseif [NMHDR PTR [edi]].code == NM_SETFOCUS
invoke SelectedItemToStatusBar
.endif
.elseif eax == g_hwndTreeView
; Notify message from Tree
.if [NMHDR PTR [edi]].code == TVN_SELCHANGED
invoke FillListView
invoke SelectedItemToStatusBar
.elseif [NMHDR PTR [edi]].code == TVN_KEYDOWN
mov eax, lParam
.if [TV_KEYDOWN PTR [eax]].wVKey == VK_RETURN
invoke ShowObjectProperties
.elseif [TV_KEYDOWN PTR [eax]].wVKey == VK_TAB
invoke SetFocus, g_hwndListView
.endif
.elseif [NMHDR PTR [edi]].code == NM_SETFOCUS
invoke SelectedItemToStatusBar
.endif
.endif
pop eax
jmp eax ; jmp LeaveWndProc0
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
Wnd_OnNotify endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Wnd_OnMouseMove proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
option PROLOGUE:NONE
option EPILOGUE:NONE
; Add locals here (only one WND_PROC_LOCAL)
;WND_PROC_LOCAL dwLocal1:DWORD, dwLocal2:DWORD
invoke Splitter_OnMouseMove, hWnd, uMsg, wParam, lParam
pop eax
jmp eax ; jmp LeaveWndProc0
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
Wnd_OnMouseMove endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Wnd_OnSizing proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
option PROLOGUE:NONE
option EPILOGUE:NONE
; Add locals here (only one WND_PROC_LOCAL)
mov ecx, lParam
mov eax, (RECT PTR [ecx]).right
sub eax, (RECT PTR [ecx]).left ; main window wide
sub eax, cxSplitterIndentR
.if eax < g_nSplitterPosX
mov g_nSplitterPosX, eax
.endif
pop eax
jmp eax ; jmp LeaveWndProc0
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
Wnd_OnSizing endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Wnd_OnSize proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
option PROLOGUE:NONE
option EPILOGUE:NONE
; Add locals here (only one WND_PROC_LOCAL)
WND_PROC_LOCAL rect:RECT
mov ecx, $HIWORD(lParam)
invoke MoveWindow, g_hwndStatusBar, 0, ecx, $LOWORD(lParam), ecx, TRUE
invoke GetClientRect, g_hwndStatusBar, addr rect
mov edx, $HIWORD(lParam)
sub edx, rect.bottom
invoke MoveWindow, g_hwndChild1, 0, 0, g_nSplitterPosX, edx, TRUE
mov edx, $HIWORD(lParam)
sub edx, rect.bottom
mov ecx, g_nSplitterPosX
add ecx, xSplitterThickness
mov eax, $LOWORD(lParam)
sub eax, g_nSplitterPosX
sub eax, xSplitterThickness ; nMainWidth - nSplitterPosX - xSplitterThickness
invoke MoveWindow, g_hwndChild2, ecx, 0, eax, edx, TRUE
pop eax
jmp eax ; jmp LeaveWndProc0
option PROLOGUE:PROLOGUEDEF
option EPILOGUE:EPILOGUEDEF
Wnd_OnSize endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Wnd_OnLButtonDown proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
option PROLOGUE:NONE
option EPILOGUE:NONE
; Add locals here (only one
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -