📄 masmed.asm
字号:
call EnableDisable
mov edx,IDM_EDIT_REPLACE
call EnableDisable
xor eax,eax
mov edx,IDM_EDIT_BLOCKMODE
call EnableDisable
mov edx,IDM_EDIT_BLOCKINSERT
call EnableDisable
mov edx,IDM_EDIT_TOGGLEBM
call EnableDisable
mov edx,IDM_EDIT_NEXTBM
call EnableDisable
mov edx,IDM_EDIT_PREVBM
call EnableDisable
mov edx,IDM_EDIT_CLEARBM
call EnableDisable
mov edx,IDM_EDIT_INDENT
call EnableDisable
mov edx,IDM_EDIT_OUTDENT
call EnableDisable
mov edx,IDM_EDIT_COMMENT
call EnableDisable
mov edx,IDM_EDIT_UNCOMMENT
call EnableDisable
mov eax,TRUE
mov edx,IDM_FORMAT_LOCK
call EnableDisable
mov edx,IDM_FORMAT_GRID
call EnableDisable
mov edx,IDM_FORMAT_SNAP
call EnableDisable
mov edx,IDM_RESOURCE_DIALOG
call EnableDisable
mov edx,IDM_RESOURCE_MENU
call EnableDisable
mov edx,IDM_RESOURCE_ACCEL
call EnableDisable
mov edx,IDM_RESOURCE_VERINF
call EnableDisable
mov edx,IDM_RESOURCE_INCLUDE
call EnableDisable
mov edx,IDM_RESOURCE_RESOURCE
call EnableDisable
mov edx,IDM_RESOURCE_STRING
call EnableDisable
mov edx,IDM_RESOURCE_NAME
call EnableDisable
mov edx,IDM_RESOURCE_REMOVE
call EnableDisable
mov edx,IDM_RESOURCE_UNDO
call EnableDisable
invoke SendMessage,hResEd,DEM_ISBACK,0,0
xor eax,TRUE
mov edx,IDM_FORMAT_BACK
call EnableDisable
invoke SendMessage,hResEd,DEM_ISFRONT,0,0
xor eax,TRUE
mov edx,IDM_FORMAT_FRONT
call EnableDisable
.elseif eax==IDC_RAE
xor eax,eax
mov edx,IDM_FORMAT_LOCK
call EnableDisable
mov edx,IDM_FORMAT_BACK
call EnableDisable
mov edx,IDM_FORMAT_FRONT
call EnableDisable
mov edx,IDM_FORMAT_GRID
call EnableDisable
mov edx,IDM_FORMAT_SNAP
call EnableDisable
mov edx,IDM_FORMAT_ALIGN
call EnableDisable
mov edx,IDM_FORMAT_SIZE
call EnableDisable
mov edx,IDM_RESOURCE_DIALOG
call EnableDisable
mov edx,IDM_RESOURCE_MENU
call EnableDisable
mov edx,IDM_RESOURCE_ACCEL
call EnableDisable
mov edx,IDM_RESOURCE_VERINF
call EnableDisable
mov edx,IDM_RESOURCE_INCLUDE
call EnableDisable
mov edx,IDM_RESOURCE_RESOURCE
call EnableDisable
mov edx,IDM_RESOURCE_STRING
call EnableDisable
mov edx,IDM_RESOURCE_NAME
call EnableDisable
mov edx,IDM_RESOURCE_REMOVE
call EnableDisable
mov edx,IDM_RESOURCE_UNDO
call EnableDisable
mov eax,TRUE
mov edx,IDM_FILE_PRINT
call EnableDisable
mov edx,IDM_EDIT_SELECTALL
call EnableDisable
mov edx,IDM_EDIT_TOGGLEBM
call EnableDisable
mov edx,IDM_EDIT_FIND
call EnableDisable
mov edx,IDM_EDIT_REPLACE
call EnableDisable
mov edx,IDM_EDIT_FINDNEXT
call EnableDisable
mov edx,IDM_EDIT_FINDPREV
call EnableDisable
invoke SendMessage,hREd,EM_CANUNDO,0,0
mov edx,IDM_EDIT_UNDO
call EnableDisable
invoke SendMessage,hREd,EM_CANREDO,0,0
mov edx,IDM_EDIT_REDO
call EnableDisable
invoke SendMessage,hREd,EM_EXGETSEL,0,addr chrg
mov eax,chrg.cpMax
sub eax,chrg.cpMin
mov edx,IDM_EDIT_CUT
call EnableDisable
mov edx,IDM_EDIT_COPY
call EnableDisable
mov edx,IDM_EDIT_DELETE
call EnableDisable
mov edx,IDM_EDIT_INDENT
call EnableDisable
mov edx,IDM_EDIT_OUTDENT
call EnableDisable
mov edx,IDM_EDIT_COMMENT
call EnableDisable
mov edx,IDM_EDIT_UNCOMMENT
call EnableDisable
invoke SendMessage,hREd,EM_CANPASTE,CF_TEXT,0
mov edx,IDM_EDIT_PASTE
call EnableDisable
invoke SendMessage,hREd,REM_GETMODE,0,0
and eax,MODE_BLOCK
mov edx,IDM_EDIT_BLOCKINSERT
call EnableDisable
.if !eax
mov eax,MF_BYCOMMAND or MF_UNCHECKED
.else
mov eax,MF_BYCOMMAND or MF_CHECKED
.endif
invoke CheckMenuItem,hMnu,IDM_EDIT_BLOCKMODE,eax
mov eax,TRUE
mov edx,IDM_EDIT_BLOCKMODE
call EnableDisable
invoke SendMessage,hREd,EM_EXLINEFROMCHAR,0,chrg.cpMin
mov ebx,eax
invoke SendMessage,hREd,REM_NXTBOOKMARK,ebx,3
inc eax
mov edx,IDM_EDIT_NEXTBM
call EnableDisable
invoke SendMessage,hREd,REM_PRVBOOKMARK,ebx,3
inc eax
mov edx,IDM_EDIT_PREVBM
call EnableDisable
invoke SendMessage,hREd,REM_NXTBOOKMARK,-1,3
inc eax
mov edx,IDM_EDIT_CLEARBM
call EnableDisable
.elseif eax==IDC_HEX
xor eax,eax
mov edx,IDM_FORMAT_LOCK
call EnableDisable
mov edx,IDM_FORMAT_BACK
call EnableDisable
mov edx,IDM_FORMAT_FRONT
call EnableDisable
mov edx,IDM_FORMAT_GRID
call EnableDisable
mov edx,IDM_FORMAT_SNAP
call EnableDisable
mov edx,IDM_FORMAT_ALIGN
call EnableDisable
mov edx,IDM_FORMAT_SIZE
call EnableDisable
mov edx,IDM_RESOURCE_DIALOG
call EnableDisable
mov edx,IDM_RESOURCE_MENU
call EnableDisable
mov edx,IDM_RESOURCE_ACCEL
call EnableDisable
mov edx,IDM_RESOURCE_VERINF
call EnableDisable
mov edx,IDM_RESOURCE_INCLUDE
call EnableDisable
mov edx,IDM_RESOURCE_RESOURCE
call EnableDisable
mov edx,IDM_RESOURCE_STRING
call EnableDisable
mov edx,IDM_RESOURCE_NAME
call EnableDisable
mov edx,IDM_RESOURCE_REMOVE
call EnableDisable
mov edx,IDM_RESOURCE_UNDO
call EnableDisable
mov edx,IDM_FILE_PRINT
call EnableDisable
mov edx,IDM_EDIT_INDENT
call EnableDisable
mov edx,IDM_EDIT_OUTDENT
call EnableDisable
mov edx,IDM_EDIT_COMMENT
call EnableDisable
mov edx,IDM_EDIT_UNCOMMENT
call EnableDisable
mov eax,TRUE
mov edx,IDM_EDIT_SELECTALL
call EnableDisable
mov edx,IDM_EDIT_TOGGLEBM
call EnableDisable
mov edx,IDM_EDIT_FIND
call EnableDisable
mov edx,IDM_EDIT_REPLACE
call EnableDisable
mov edx,IDM_EDIT_FINDNEXT
call EnableDisable
mov edx,IDM_EDIT_FINDPREV
call EnableDisable
invoke SendMessage,hREd,EM_CANUNDO,0,0
mov edx,IDM_EDIT_UNDO
call EnableDisable
invoke SendMessage,hREd,EM_CANREDO,0,0
mov edx,IDM_EDIT_REDO
call EnableDisable
invoke SendMessage,hREd,EM_EXGETSEL,0,addr chrg
mov eax,chrg.cpMax
sub eax,chrg.cpMin
mov edx,IDM_EDIT_CUT
call EnableDisable
mov edx,IDM_EDIT_COPY
call EnableDisable
mov edx,IDM_EDIT_DELETE
call EnableDisable
invoke SendMessage,hREd,EM_CANPASTE,CF_TEXT,0
mov edx,IDM_EDIT_PASTE
call EnableDisable
xor eax,eax
mov edx,IDM_EDIT_BLOCKMODE
call EnableDisable
mov edx,IDM_EDIT_BLOCKINSERT
call EnableDisable
invoke SendMessage,hREd,HEM_ANYBOOKMARKS,0,0
mov edx,IDM_EDIT_NEXTBM
call EnableDisable
mov edx,IDM_EDIT_PREVBM
call EnableDisable
mov edx,IDM_EDIT_CLEARBM
call EnableDisable
.endif
invoke GetCapture
.if !eax
invoke UpdateAll,IS_CHANGED
.else
mov fTimer,2
.endif
.endif
.endif
ret
EnableDisable:
push eax
push edx
.if eax
mov eax,MF_BYCOMMAND or MF_ENABLED
.else
mov eax,MF_BYCOMMAND or MF_GRAYED
.endif
invoke EnableMenuItem,hMnu,edx,eax
pop edx
pop eax
push eax
push edx
.if eax
mov eax,TRUE
.endif
invoke SendMessage,hTbr,TB_ENABLEBUTTON,edx,eax
pop edx
pop eax
retn
MyTimerProc endp
ResProc proc uses ebx esi edi,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL rect:RECT
LOCAL rescol:COLOR
mov eax,uMsg
.if eax==WM_SIZE
invoke GetClientRect,hWin,addr rect
invoke MoveWindow,hToolBox,0,rect.top,53,rect.bottom,TRUE
mov eax,rect.right
sub eax,53+CBOWT
invoke MoveWindow,hResEd,53,rect.top,eax,rect.bottom,TRUE
mov ecx,rect.right
sub ecx,CBOWT
mov edx,rect.bottom
shr edx,1
invoke MoveWindow,hProject,ecx,rect.top,CBOWT,edx,TRUE
mov ecx,rect.right
sub ecx,CBOWT
mov edx,rect.bottom
shr edx,1
mov ebx,edx
add edx,rect.top
invoke MoveWindow,hProperty,ecx,edx,CBOWT,ebx,TRUE
.elseif eax==WM_CREATE
mov ebx,lParam
mov ebx,[ebx].CREATESTRUCT.lpCreateParams
mov edx,WS_CHILD or WS_VISIBLE or WS_VSCROLL or WS_HSCROLL or WS_CLIPSIBLINGS or WS_CLIPCHILDREN
.if grdsize.show
or edx,DES_GRID
.endif
.if grdsize.snap
or edx,DES_SNAPTOGRID
.endif
.if grdsize.tips
or edx,DES_TOOLTIP
.endif
invoke CreateWindowEx,200h,addr szDlgEditClass,0,edx,0,0,0,0,hWin,IDC_DLGEDIT,hInstance,0
mov hResEd,eax
invoke SendMessage,eax,WM_SETFONT,ebx,0
invoke CreateWindowEx,200h,addr szProjectClass,0,WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,0,0,0,0,hWin,IDC_PROJECT,hInstance,0
mov hProject,eax
invoke SendMessage,eax,WM_SETFONT,ebx,0
mov edx,nmeexp.nOutput
shl edx,16
add edx,nmeexp.nType
invoke SendMessage,hProject,PRO_SETEXPORT,edx,addr nmeexp.szFileName
invoke CreateWindowEx,0h,addr szPropertyClass,0,WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,0,0,0,0,hWin,IDC_PROPERTY,hInstance,0
mov hProperty,eax
invoke SendMessage,eax,WM_SETFONT,ebx,0
invoke CreateWindowEx,0h,addr szToolBoxClass,0,WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,0,0,0,0,hWin,IDC_TOOLBOX,hInstance,0
mov hToolBox,eax
invoke SendMessage,eax,WM_SETFONT,ebx,0
mov eax,grdsize.y
shl eax,16
add eax,grdsize.x
mov edx,grdsize.line
shl edx,24
add edx,grdsize.color
invoke SendMessage,hResEd,DEM_SETGRIDSIZE,eax,edx
.elseif eax==WM_DESTROY
invoke DestroyWindow,hToolBox
invoke DestroyWindow,hProperty
invoke DestroyWindow,hProject
invoke DestroyWindow,hResEd
.elseif eax==EM_GETMODIFY
invoke SendMessage,hProject,PRO_GETMODIFY,0,0
jmp Ex
.elseif eax==EM_SETMODIFY
invoke SendMessage,hProject,PRO_SETMODIFY,wParam,0
jmp Ex
.elseif eax==EM_UNDO
invoke SendMessage,hResEd,DEM_UNDO,0,0
jmp Ex
.elseif eax==WM_CUT
invoke SendMessage,hResEd,DEM_CUT,0,0
jmp Ex
.elseif eax==WM_COPY
invoke SendMessage,hResEd,DEM_COPY,0,0
jmp Ex
.elseif eax==WM_PASTE
invoke SendMessage,hResEd,DEM_PASTE,0,0
jmp Ex
.elseif eax==WM_CLEAR
invoke SendMessage,hResEd,DEM_DELETECONTROLS,0,0
jmp Ex
.elseif eax==WM_NOTIFY
mov fTimer,1
.endif
invoke DefWindowProc,hWin,uMsg,wParam,lParam
Ex:
ret
ResProc endp
WndProc proc uses ebx esi edi,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL pt:POINT
LOCAL rect:RECT
LOCAL tmprect:RECT
LOCAL ht:DWORD
LOCAL hCtl:HWND
LOCAL chrg:CHARRANGE
LOCAL cf:CHOOSEFONT
LOCAL buffer[MAX_PATH]:BYTE
LOCAL buffer1[MAX_PATH]:BYTE
LOCAL mnu:MENU
LOCAL nInx:DWORD
LOCAL hebmk:HEBMK
LOCAL min:DWORD
LOCAL max:DWORD
mov eax,uMsg
.if eax==WM_LBUTTONDOWN
.if fVSplit==1
invoke SetCapture,hWin
invoke SetCursor,hHSplitCur
mov fVSplit,2
.elseif fVSplit==3
invoke SetCapture,hWin
invoke SetCursor,hVSplitCur
mov fVSplit,4
.endif
.elseif eax==WM_LBUTTONUP
.if fVSplit
invoke ReleaseCapture
mov fVSplit,0
.endif
.elseif eax==WM_MOUSEMOVE
invoke GetDlgItem,hWin,IDC_SBR
mov edx,eax
invoke GetWindowRect,edx,addr rect
mov eax,rect.bottom
sub eax,rect.top
push eax
invoke GetClientRect,hWin,addr rect
pop eax
test wpos.fView,2
.if !ZERO?
sub rect.bottom,eax
.endif
test wpos.fView,4
.if !ZERO?
mov eax,wpos.htout
add eax,4
sub rect.bottom,eax
.endif
test wpos.fView,8
.if !ZERO?
mov eax,wpos.wtfile
sub rect.right,eax
.endif
test wpos.fView,1
.if !ZERO?
add rect.top,27
.endif
add rect.top,TABHT
invoke GetCursorPos,addr pt
invoke ScreenToClient,hWin,addr pt
.if fVSplit==0 || fVSplit==1 || fVSplit==3
mov fVSplit,0
mov eax,pt.x
mov edx,pt.y
.if eax<rect.right && edx>rect.bottom
invoke SetCursor,hHSplitCur
mov fVSplit,1
.elseif eax>=rect.right && edx>rect.top
invoke SetCursor,hVSplitCur
mov fVSplit,3
.endif
.elseif fVSplit==2
xor eax,eax
test wpos.fView,2
.if !ZERO?
;Get handle of statusbar
invoke GetDlgItem,hWnd,IDC_SBR
mov edx,eax
;Get height of statusbar
invoke GetWindowRect,edx,addr rect
mov eax,rect.bottom
sub eax,rect.top
.endif
mov max,eax
xor eax,eax
test wpos.fView,1
.if !ZERO?
;Get handle of toolbar
invoke GetDlgItem,hWnd,IDC_TBR
mov edx,eax
;Get height of toolbar
invoke GetWindowRect,edx,addr rect
mov eax,rect.bottom
sub eax,rect.top
.endif
add eax,TABHT
add eax,32
mov min,eax
invoke GetClientRect,hWin,addr rect
mov eax,rect.bottom
sub eax,max
push eax
sub eax,30
mov max,eax
pop eax
mov edx,pt.y
.if sdword ptr edx>max
mov edx,max
.elseif sdword ptr edx<min
mov edx,min
.endif
sub eax,edx
sub eax,RESIZEHT
.if eax!=wpos.htout
mov wpos.htout,eax
invoke SendMessage,hWin,WM_SIZE,0,0
invoke UpdateWindow,hREd
invoke UpdateWindow,hOut
.endif
.elseif fVSplit==4
invoke GetClientRect,hWin,addr rect
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -