📄 resed.asm
字号:
mov eax,edx
.endif
mov edx,rect.bottom
sub edx,eax
sub edx,21+3
.if edx!=wpos.htout
mov wpos.htout,edx
mov eax,rect.bottom
shl eax,16
add eax,rect.right
invoke SendMessage,hWin,WM_SIZE,0,eax
.endif
.endif
.else
mov edx,rect.right
sub edx,wpos.wtpro
mov ecx,edx
sub edx,3
mov eax,pt.x
.if sdword ptr eax>=edx && sdword ptr eax<=ecx
invoke SetCursor,hVSplit
mov fSize,1
jmp Ex
.elseif sdword ptr eax>edx
invoke SetCursor,hHSplit
mov fSize,2
jmp Ex
.else
mov edx,rect.bottom
sub edx,wpos.htout
sub edx,21
mov ecx,edx
sub edx,3
mov eax,pt.y
.if sdword ptr eax>=edx && sdword ptr eax<=ecx
invoke SetCursor,hHSplit
mov fSize,3
jmp Ex
.endif
.endif
invoke LoadCursor,0,IDC_ARROW
invoke SetCursor,eax
mov fSize,0
.endif
.elseif eax==WM_LBUTTONDOWN
.if fSize==1
invoke SetCapture,hWin
invoke SetCursor,hVSplit
.elseif fSize==2
invoke SetCapture,hWin
invoke SetCursor,hHSplit
.elseif fSize==3
invoke SetCapture,hWin
invoke SetCursor,hHSplit
.endif
.elseif eax==WM_LBUTTONUP
.if fSize
invoke ReleaseCapture
mov fSize,0
.endif
.elseif eax==WM_CONTEXTMENU
mov eax,lParam
.if eax!=-1
and eax,0FFFFh
mov pt.x,eax
mov eax,lParam
shr eax,16
mov pt.y,eax
.else
invoke GetWindowRect,hWin,addr rect
.if hResEd
invoke GetWindowLong,hResEd,DEWM_DIALOG
.if eax
mov edx,eax
invoke GetWindowRect,edx,addr rect
.endif
.endif
mov eax,rect.left
add eax,30
mov pt.x,eax
mov eax,rect.top
add eax,30
mov pt.y,eax
.endif
invoke SendMessage,hWin,WM_INITMENUPOPUP,hContextMenuPopup,1
invoke SendMessage,hWin,WM_INITMENUPOPUP,hContextMenuPopup,2
invoke TrackPopupMenu,hContextMenuPopup,TPM_LEFTALIGN or TPM_RIGHTBUTTON,pt.x,pt.y,0,hWin,0
xor eax,eax
ret
.elseif eax==WM_INITMENUPOPUP
mov eax,lParam
.if eax==1
;Edit
invoke SendMessage,hResEd,DEM_CANUNDO,0,0
xor eax,1
.if eax
mov eax,MF_GRAYED
.endif
invoke EnableMenuItem,wParam,IDM_EDIT_UNDO,eax
invoke SendMessage,hResEd,DEM_ISSELECTION,0,0
.if !eax
mov ebx,MF_GRAYED
.else
xor ebx,ebx
.endif
invoke EnableMenuItem,wParam,IDM_EDIT_DELETE,ebx
invoke EnableMenuItem,wParam,IDM_EDIT_CUT,ebx
invoke EnableMenuItem,wParam,IDM_EDIT_COPY,ebx
invoke SendMessage,hResEd,DEM_CANPASTE,0,0
xor eax,1
.if eax
mov eax,MF_GRAYED
.endif
invoke EnableMenuItem,wParam,IDM_EDIT_PASTE,eax
.elseif eax==2
;Format
invoke SendMessage,hResEd,DEM_ISLOCKED,0,0
.if eax
mov eax,MF_CHECKED
.endif
invoke CheckMenuItem,wParam,IDM_FORMAT_LOCK,eax
invoke GetWindowLong,hResEd,GWL_STYLE
and eax,DES_GRID
.if eax
mov eax,MF_CHECKED
.endif
invoke CheckMenuItem,wParam,IDM_FORMAT_GRID,eax
invoke GetWindowLong,hResEd,GWL_STYLE
and eax,DES_SNAPTOGRID
.if eax
mov eax,MF_CHECKED
.endif
invoke CheckMenuItem,wParam,IDM_FORMAT_SNAP,eax
invoke SendMessage,hResEd,DEM_ISBACK,0,0
.if eax
mov eax,MF_GRAYED
.endif
invoke EnableMenuItem,wParam,IDM_FORMAT_BACK,eax
invoke SendMessage,hResEd,DEM_ISFRONT,0,0
.if eax
mov eax,MF_GRAYED
.endif
invoke EnableMenuItem,wParam,IDM_FORMAT_FRONT,eax
invoke SendMessage,hResEd,DEM_ISSELECTION,0,0
.if eax==2
mov ebx,MF_BYPOSITION
.else
mov ebx,MF_BYPOSITION or MF_GRAYED
.endif
mov ecx,wParam
.if ecx==hContextMenuPopup
mov edx,13
.else
mov edx,6
.endif
push edx
invoke EnableMenuItem,wParam,edx,ebx
pop edx
inc edx
invoke EnableMenuItem,wParam,edx,ebx
.elseif eax==3
;View
test wpos.fView,1
.if !ZERO?
mov eax,MF_BYCOMMAND or MF_CHECKED
.else
mov eax,MF_BYCOMMAND or MF_UNCHECKED
.endif
invoke CheckMenuItem,wParam,IDM_VIEW_OUTPUT,eax
.elseif eax==4
;Project
invoke GetWindowLong,hProject,0
.if eax
xor ebx,ebx
.else
mov ebx,MF_GRAYED
.endif
invoke EnableMenuItem,wParam,IDM_PROJECT_ADD_DIALOG,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_ADD_MENU,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_ADD_ACCELERATOR,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_ADD_VERSIONINFO,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_INCLUDE,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_RESOURCE,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_STRINGTABLE,ebx
invoke EnableMenuItem,wParam,IDM_PROJECT_NAMES,ebx
invoke SendMessage,hProject,PRO_GETSELECTED,0,0
mov ebx,MF_GRAYED
.if eax>=2
xor ebx,ebx
.endif
invoke EnableMenuItem,wParam,IDM_PROJECT_REMOVE,ebx
invoke SendMessage,hProject,PRO_CANUNDO,0,0
mov ebx,MF_GRAYED
.if eax
xor ebx,ebx
.endif
invoke EnableMenuItem,wParam,IDM_PROJECT_UNDO,ebx
.endif
.elseif eax==WM_NOTIFY
mov edx,lParam
mov eax,[edx].NMHDR.hwndFrom
.if eax==hResEd
invoke GetDlgItem,hWin,IDC_TBR1
invoke ToolBarEnable,eax
.else
mov eax,[edx].NMHDR.code
.if eax==TTN_NEEDTEXT
;Toolbar tooltip
mov edx,(NMHDR ptr [edx]).idFrom
invoke LoadString,hInstance,edx,addr buffer,sizeof buffer
lea eax,buffer
mov edx,lParam
mov (TOOLTIPTEXT ptr [edx]).lpszText,eax
.endif
.endif
.elseif eax==WM_COMMAND
mov eax,wParam
movzx eax,ax
.if eax==IDM_FILE_NEW_PROJECT
invoke WantToSaveProject,offset ProjectFileName
.if !eax
invoke lstrcpy,offset ProjectFileName,offset szNewFile
invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,4096
mov hMem,eax
invoke GlobalLock,hMem
invoke GetDlgItem,hWin,IDC_PROJECT
invoke SendMessage,eax,PRO_OPEN,offset ProjectFileName,hMem
invoke SetWinCaption,offset ProjectFileName
.endif
.elseif eax==IDM_FILE_OPEN_PROJECT
invoke WantToSaveProject,offset ProjectFileName
.if !eax
invoke OpenProject
.endif
.elseif eax==IDM_FILE_CLOSE_PROJECT
invoke WantToSaveProject,offset ProjectFileName
.if !eax
invoke GetDlgItem,hWin,IDC_PROJECT
invoke SendMessage,eax,PRO_CLOSE,0,0
invoke SetWinCaption,NULL
.endif
.elseif eax==IDM_FILE_SAVE_PROJECT
invoke SaveProjectFile,offset ProjectFileName
invoke SendMessage,hResEd,DEM_SETMODIFY,FALSE,0
.elseif eax==IDM_FILE_SAVE_PROJECT_AS
invoke SaveProjectFileAs,offset ProjectFileName
invoke SendMessage,hResEd,DEM_SETMODIFY,FALSE,0
.elseif eax==IDM_FILE_EXIT
invoke SendMessage,hWin,WM_CLOSE,0,0
.elseif eax==IDM_EDIT_UNDO
invoke SendMessage,hResEd,DEM_UNDO,0,0
.elseif eax==IDM_EDIT_DELETE
invoke SendMessage,hResEd,DEM_DELETECONTROLS,0,0
.elseif eax==IDM_EDIT_CUT
invoke SendMessage,hResEd,DEM_CUT,0,0
.elseif eax==IDM_EDIT_COPY
invoke SendMessage,hResEd,DEM_COPY,0,0
.elseif eax==IDM_EDIT_PASTE
invoke SendMessage,hResEd,DEM_PASTE,0,0
.elseif eax==IDM_VIEW_OUTPUT
xor wpos.fView,1
invoke GetClientRect,hWin,addr rect
mov eax,rect.bottom
shl eax,16
add eax,rect.right
invoke SendMessage,hWin,WM_SIZE,0,eax
invoke GetDlgItem,hWin,IDC_TBR1
invoke ToolBarEnable,eax
.elseif eax==IDM_FORMAT_LOCK
invoke SendMessage,hResEd,DEM_ISLOCKED,0,0
xor eax,TRUE
invoke SendMessage,hResEd,DEM_LOCKCONTROLS,0,eax
.elseif eax==IDM_FORMAT_BACK
invoke SendMessage,hResEd,DEM_SENDTOBACK,0,0
.elseif eax==IDM_FORMAT_FRONT
invoke SendMessage,hResEd,DEM_BRINGTOFRONT,0,0
.elseif eax==IDM_FORMAT_GRID
invoke GetWindowLong,hResEd,GWL_STYLE
xor eax,DES_GRID
invoke SetWindowLong,hResEd,GWL_STYLE,eax
.elseif eax==IDM_FORMAT_SNAP
invoke GetWindowLong,hResEd,GWL_STYLE
xor eax,DES_SNAPTOGRID
invoke SetWindowLong,hResEd,GWL_STYLE,eax
.elseif eax==IDM_FORMAT_ALIGN_LEFT
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_LEFT
.elseif eax==IDM_FORMAT_ALIGN_CENTER
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_CENTER
.elseif eax==IDM_FORMAT_ALIGN_RIGHT
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_RIGHT
.elseif eax==IDM_FORMAT_ALIGN_TOP
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_TOP
.elseif eax==IDM_FORMAT_ALIGN_MIDDLE
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_MIDDLE
.elseif eax==IDM_FORMAT_ALIGN_BOTTOM
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,ALIGN_BOTTOM
.elseif eax==IDM_FORMAT_SIZE_WIDTH
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,SIZE_WIDTH
.elseif eax==IDM_FORMAT_SIZE_HEIGHT
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,SIZE_HEIGHT
.elseif eax==IDM_FORMAT_SIZE_BOTH
invoke SendMessage,hResEd,DEM_ALIGNSIZE,0,SIZE_BOTH
.elseif eax==IDM_PROJECT_ADD_DIALOG
invoke SendMessage,hProject,PRO_ADDITEM,TPE_DIALOG,TRUE
.elseif eax==IDM_PROJECT_ADD_MENU
invoke SendMessage,hProject,PRO_ADDITEM,TPE_MENU,TRUE
.elseif eax==IDM_PROJECT_ADD_ACCELERATOR
invoke SendMessage,hProject,PRO_ADDITEM,TPE_ACCEL,TRUE
.elseif eax==IDM_PROJECT_ADD_VERSIONINFO
invoke SendMessage,hProject,PRO_ADDITEM,TPE_VERSION,TRUE
.elseif eax==IDM_PROJECT_INCLUDE
invoke SendMessage,hProject,PRO_ADDITEM,TPE_INCLUDE,TRUE
.elseif eax==IDM_PROJECT_RESOURCE
invoke SendMessage,hProject,PRO_ADDITEM,TPE_RESOURCE,TRUE
.elseif eax==IDM_PROJECT_STRINGTABLE
invoke SendMessage,hProject,PRO_ADDITEM,TPE_STRING,TRUE
.elseif eax==IDM_PROJECT_NAMES
invoke SendMessage,hProject,PRO_SHOWNAMES,0,hOut
.elseif eax==IDM_PROJECT_REMOVE
invoke SendMessage,hProject,PRO_DELITEM,0,0
.elseif eax==IDM_PROJECT_UNDO
invoke SendMessage,hProject,PRO_UNDODELETED,0,0
.elseif eax==IDM_OPTION_TOOLS
invoke DialogBoxParam,hInstance,IDD_DLGOPTMNU,hWin,offset MenuOptionProc,1
invoke SetToolMenu
.elseif eax==IDM_OPTION_HELP
invoke DialogBoxParam,hInstance,IDD_DLGOPTMNU,hWin,offset MenuOptionProc,2
invoke SetHelpMenu
.elseif eax==IDM_OPTION_OPTIONS
invoke DialogBoxParam,hInstance,IDD_TABOPTIONS,hWin,offset TabOptionsProc,0
.elseif eax==IDM_HELP_ABOUT
invoke DialogBoxParam,hInstance,IDD_DLGABOUT,hWin,offset AboutProc,0
.elseif eax>=20000 && eax<=20020
mov mnu.szcap,0
mov mnu.szcmnd,0
mov edx,eax
sub edx,19999
invoke MakeKey,addr szMenuTool,edx,addr buffer
mov lpcbData,sizeof mnu
invoke RegQueryValueEx,hReg,addr buffer,0,addr lpType,addr mnu,addr lpcbData
movzx eax,mnu.szcmnd
.if eax
mov buffer1,0
push ebx
push esi
push edi
xor ebx,ebx
lea esi,mnu.szcmnd
lea edi,buffer
@@:
mov al,[esi]
.if al=='$'
.if !ebx
mov byte ptr [edi],0
lea edi,buffer1
inc ebx
.endif
push esi
mov esi,offset ProjectFileName
.while al!='.' && al
mov al,[esi]
.if al!='.' && al
mov [edi],al
inc esi
inc edi
.endif
.endw
pop esi
inc esi
jmp @b
.endif
mov [edi],al
inc esi
inc edi
or al,al
jne @b
pop edi
pop esi
pop ebx
invoke ShellExecute,hWin,NULL,addr buffer,addr buffer1,NULL,SW_SHOWNORMAL;SW_SHOWDEFAULT
.endif
.elseif eax>=30000 && eax<=30020
mov mnu.szcap,0
mov mnu.szcmnd,0
mov edx,eax
sub edx,29999
invoke MakeKey,addr szMenuHelp,edx,addr buffer
mov lpcbData,sizeof mnu
invoke RegQueryValueEx,hReg,addr buffer,0,addr lpType,addr mnu,addr lpcbData
movzx eax,mnu.szcmnd
.if eax
invoke ShellExecute,hWin,NULL,addr mnu.szcmnd,NULL,NULL,SW_SHOWDEFAULT
.endif
.endif
.elseif eax==WM_SIZE
mov eax,lParam
movzx edx,ax
shr eax,16
mov pt.x,edx
mov pt.y,eax
;ToolBar
invoke GetDlgItem,hWin,IDC_TBR1
invoke MoveWindow,eax,0,0,pt.x,25,TRUE
;ToolBox
invoke GetDlgItem,hWin,IDC_TOOLBOX
mov edx,pt.y
sub edx,25+21
invoke MoveWindow,eax,0,25,53,edx,TRUE
;Dialog edit
invoke GetDlgItem,hWin,IDC_DLGEDIT
mov ecx,pt.x
sub ecx,wpos.wtpro
sub ecx,3+53
mov edx,pt.y
sub edx,25+21
test wpos.fView,1
.if !ZERO?
sub edx,wpos.htout
sub edx,3
.endif
invoke MoveWindow,eax,53,25,ecx,edx,TRUE
;Output
invoke GetDlgItem,hWin,IDC_EDT1
mov edx,pt.y
sub edx,21
sub edx,wpos.htout
mov ecx,pt.x
sub ecx,3+53
sub ecx,wpos.wtpro
test wpos.fView,1
.if ZERO?
xor eax,eax
.else
mov eax,wpos.htout
.endif
invoke MoveWindow,hOut,53,edx,ecx,eax,TRUE
;Project
invoke GetDlgItem,hWin,IDC_PROJECT
mov ecx,pt.x
sub ecx,wpos.wtpro
mov pt.x,ecx
invoke MoveWindow,eax,ecx,25,wpos.wtpro,wpos.htpro,TRUE
;Property
invoke GetDlgItem,hWin,IDC_PROPERTY
mov ecx,pt.x
sub ecx,wpos.wtpro
mov ecx,wpos.htpro
mov edx,pt.y
sub edx,ecx
sub edx,25+21+1
add ecx,2+25
invoke MoveWindow,eax,pt.x,ecx,wpos.wtpro,edx,TRUE
;Statusbar
invoke GetDlgItem,hWin,IDC_SBR1
invoke MoveWindow,eax,0,0,0,0,FALSE
.elseif eax==WM_CLOSE
invoke WantToSaveProject,offset ProjectFileName
.if !eax
invoke GetWindowLong,hWin,GWL_STYLE
test eax,WS_MAXIMIZE
.if ZERO?
test eax,WS_MINIMIZE
.if ZERO?
mov wpos.fMax,FALSE
invoke GetWindowRect,hWin,addr rect
mov eax,rect.left
mov wpos.x,eax
mov eax,rect.top
mov wpos.y,eax
mov eax,rect.right
sub eax,rect.left
mov wpos.wt,eax
mov eax,rect.bottom
sub eax,rect.top
mov wpos.ht,eax
.endif
.else
mov wpos.fMax,TRUE
.endif
invoke DestroyWindow,hWin
.endif
.elseif eax==WM_DESTROY
invoke DestroyCursor,hHSplit
invoke DestroyCursor,hVSplit
invoke DestroyIcon,hIcon
invoke ImageList_Destroy,hIml
invoke DestroyAcceleratorTable,hAccel
invoke DestroyMenu,hContextMenu
invoke DestroyWindow,hResEd
invoke DestroyWindow,hProject
invoke GetDlgItem,hWin,IDC_TOOLBOX
invoke DestroyWindow,eax
invoke GetDlgItem,hWin,IDC_PROPERTY
invoke DestroyWindow,eax
mov nInx,1
mov ebx,offset hCustDll
.while nInx<=32
mov eax,[ebx]
.if eax
invoke FreeLibrary,eax
.endif
add ebx,4
inc nInx
.endw
invoke PostQuitMessage,NULL
.elseif eax==WM_DROPFILES
invoke DragQueryFile,wParam,0,addr buffer,sizeof buffer
invoke WantToSaveProject,offset ProjectFileName
.if !eax
invoke LoadProjectFile,addr buffer
.endif
.else
ExDef:
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
.endif
Ex:
xor eax,eax
ret
WndProc endp
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -