⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgedit.asm

📁 汇编资源编辑器
💻 ASM
📖 第 1 页 / 共 5 页
字号:
		mov		eax,hMnu
	.endif
	ret

GetNextLevel:
	add		esi,sizeof MNUITEM
	.if [esi].MNUITEM.itemflag==-1
		jmp		GetNextLevel
	.endif
	mov		eax,(MNUITEM ptr [esi]).level
	retn

GetMnuPopup endp

CtlProc proc uses esi,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	lpOldProc:DWORD
	LOCAL	pt:POINT
	LOCAL	rect:RECT
	LOCAL	rect1:RECT
	LOCAL	ws:DWORD
	LOCAL	wsex:DWORD
	LOCAL	nInx:DWORD
	LOCAL	buffer[256]:BYTE
	LOCAL	fShift:DWORD
	LOCAL	fControl:DWORD
	LOCAL	hCtl:HWND

	mov		nInx,0
	invoke GetWindowLong,hWin,GWL_USERDATA
	.if eax
		mov		esi,eax
		push	(DIALOG ptr [esi]).oldproc
		pop		lpOldProc
		mov		eax,uMsg
		.if eax==WM_NCLBUTTONDOWN || eax==WM_NCLBUTTONDBLCLK || eax==WM_NCMOUSEMOVE || eax==WM_NCLBUTTONUP
			mov		eax,lParam
			and		eax,0FFFFh
			cwde
			mov		rect1.left,eax
			add		eax,100
			mov		rect1.right,eax
			mov		eax,lParam
			shr		eax,16
			cwde
			mov		rect1.top,eax
			add		eax,100
			mov		rect1.bottom,eax
			invoke GetWindowLong,hWin,GWL_STYLE
			mov		ws,eax
			invoke GetWindowLong,hWin,GWL_EXSTYLE
			mov		wsex,eax
			invoke AdjustWindowRectEx,addr rect1,ws,0,wsex
			mov		eax,rect1.left
			mov		pt.x,eax
			mov		eax,rect1.top
			mov		pt.y,eax
			invoke GetWindowRect,hWin,addr rect
			mov		eax,(DIALOG ptr [esi]).ntype
			.if eax==7 || eax==24
				mov		eax,(DIALOG ptr [esi]).ccy
				add		eax,rect.top
				mov		rect.bottom,eax
			.endif
			mov		eax,rect.left
			sub		pt.x,eax
			mov		eax,rect.top
			sub		pt.y,eax
			mov		eax,pt.y
			shl		eax,16
			and		pt.x,0FFFFh
			add		eax,pt.x
			mov		lParam,eax
		.endif
		mov		eax,(DIALOG ptr [esi]).ntype
		.if !eax
			mov		eax,uMsg
			.if eax==WM_LBUTTONDOWN || eax==WM_NCLBUTTONDOWN
				.if !MnuTrack
					invoke SendMessage,hWin,WM_NCPAINT,0,0
					.if MnuHigh
						mov		eax,MnuHigh
						and		eax,0FFFFh
						mov		pt.x,eax
						mov		eax,MnuHigh
						shr		eax,16
						mov		pt.y,eax
						invoke GetWindowRect,hWin,addr rect
						mov		eax,rect.left
						dec		eax
						add		pt.x,eax
						mov		eax,rect.top
						add		pt.y,eax
						sub		esi,sizeof DLGHEAD
						invoke GetMnuPopup,esi
						mov		MnuTrack,eax
						.if eax
							invoke TrackPopupMenu,eax,TPM_LEFTALIGN or TPM_LEFTBUTTON,pt.x,pt.y,0,hWin,0
							invoke SendMessage,hWin,WM_NCPAINT,0,0
							invoke DestroyMenu,MnuTrack
						.endif
						xor		eax,eax
						mov		MnuTrack,eax
						ret
					.endif
				.endif
			.elseif eax==WM_NCMOUSEMOVE
				mov		edx,lParam
				movzx	eax,dx
				add		eax,5
				shr		edx,16
				.if edx>1 && edx<18 && eax<MnuRight
					invoke SendMessage,hWin,WM_NCPAINT,0,0
				.endif
			.elseif eax==WM_COMMAND && !lParam
			.endif
		.endif
		mov		eax,uMsg
		.if eax==WM_MOUSEMOVE || eax==WM_NCMOUSEMOVE
			.if MnuHigh
				mov		eax,(DIALOG ptr [esi]).ntype
				.if !eax
					mov		eax,hWin
				.else
					invoke GetParent,hWin
				.endif
				invoke SendMessage,eax,WM_NCPAINT,0,0
			.endif
			.if hStatus
				invoke GetCursorPos,addr pt
				invoke GetWindowLong,hDEd,DEWM_MEMORY
				.if eax
					add		eax,sizeof DLGHEAD
					mov		edx,(DIALOG ptr [eax]).hwnd
					invoke ScreenToClient,edx,addr pt
					invoke ResEdBinToDec,pt.x,offset szPos+5
					invoke lstrlen,offset szPos
					mov		byte ptr szPos[eax],','
					inc		eax
					invoke ResEdBinToDec,pt.y,addr szPos[eax]
					invoke SendMessage,hStatus,SB_SETTEXT,nStatus,offset szPos
				.endif
			.endif
		.endif
		mov		eax,uMsg
		.if eax==WM_RBUTTONDOWN
			mov		eax,lParam
			mov		edx,eax
			movzx	eax,ax
			shr		edx,16
			mov		pt.x,eax
			mov		pt.y,edx
			invoke ClientToScreen,hWin,addr pt
			mov		eax,pt.y
			shl		eax,16
			mov		ax,word ptr pt.x
			invoke SendMessage,hDEd,WM_CONTEXTMENU,hWin,eax
			xor		eax,eax
			ret
		.elseif eax==WM_NCRBUTTONDOWN
			invoke SendMessage,hDEd,WM_CONTEXTMENU,hWin,lParam
			xor		eax,eax
			ret
		.elseif eax==WM_LBUTTONDBLCLK || eax==WM_NCLBUTTONDBLCLK
			xor		eax,eax
			ret
		.elseif eax==WM_LBUTTONDOWN || eax==WM_NCLBUTTONDOWN
			invoke SetFocus,hDEd
			invoke GetWindowLong,hWin,GWL_USERDATA
			.if eax
				mov		esi,eax
				mov		eax,(DIALOG ptr [esi]).ntype
				.if !eax
					mov		eax,hWin
				.else
					invoke GetParent,hWin
				.endif
				invoke SendMessage,eax,WM_NCPAINT,0,0
				invoke LoadCursor,0,IDC_ARROW
				invoke SetCursor,eax
				.if ToolBoxID
					;Is readOnly
					invoke GetWindowLong,hDEd,DEWM_READONLY
					.if !eax
						;Draw outline of new control
						invoke DrawingRect,hWin,lParam,0
					.endif
				.elseif !fMoveing
					;Select control
					;Shift key
					invoke GetAsyncKeyState,VK_SHIFT
					and		eax,8000h
					mov		fShift,eax
					;Control key
					invoke GetAsyncKeyState,VK_CONTROL
					and		eax,8000h
					mov		fControl,eax
					.if !fControl && !fShift && !fMultiSel
						mov		eax,hMultiSel
						.if eax
						  @@:
							push	eax
							invoke GetParent,eax
							.if eax==hWin
								pop		eax
								jmp		@f
							.endif
							pop		eax
							mov		ecx,8
							.while ecx
								push	ecx
								invoke GetWindowLong,eax,GWL_USERDATA
								pop		ecx
								dec		ecx
							.endw
							or		eax,eax
							jne		@b
						.endif
						.while hMultiSel
							invoke GetParent,hMultiSel
							invoke PostMessage,eax,WM_PAINT,0,0
							invoke DestroyMultiSel,hMultiSel
							mov		hMultiSel,eax
							.if !eax
								invoke PostMessage,hWin,uMsg,wParam,lParam
								xor		eax,eax
								ret
							.endif
						.endw
					  @@:
						.if hMultiSel
							invoke SetCapture,hWin
							mov		eax,hMultiSel
						  @@:
							push	eax
							invoke GetParent,eax
							invoke MoveingRect,eax,lParam,0,nInx
							inc		nInx
							mov		ecx,8
							pop		eax
							.while ecx
								push	ecx
								invoke GetWindowLong,eax,GWL_USERDATA
								pop		ecx
								dec		ecx
							.endw
							or		eax,eax
							jne		@b
						.else
							invoke GetWindowLong,hDEd,DEWM_READONLY	;ReadOnly
							push	eax
							invoke GetWindowLong,hDEd,DEWM_MEMORY
							pop		edx
							.if eax
								mov		eax,(DLGHEAD ptr [eax]).locked
								.if !eax && !edx
									mov		eax,(DIALOG ptr [esi]).ntype
									.if eax
										mov		edx,(DIALOG ptr [esi]).style
										and		edx,CCS_NORESIZE
										.if (eax==18 && !edx) || (eax==19 && !edx)
										.else
											invoke SetCapture,hWin
											invoke MoveingRect,hWin,lParam,0,0
											invoke MoveingRect,hWin,lParam,1,0
											invoke DialogTltSize,ParPt.x,ParPt.y
										.endif
									.endif
								.endif
							.endif
						.endif
					.else
						invoke GetWindowLong,hWin,GWL_USERDATA
						mov		edx,(DIALOG ptr [eax]).style
						and		edx,CCS_NORESIZE
						mov		eax,(DIALOG ptr [eax]).ntype
						.if fShift && !fControl
							.if !eax || eax==3
								;Draw multisel rect
								invoke DrawingRect,hWin,lParam,0
								mov		fMultiSel,TRUE
							.endif
						.elseif !fShift && fControl
							.if eax
								.if (eax==18 && !edx) || (eax==19 && !edx)
								.else
									invoke CtlMultiSelect,hWin,lParam
								.endif
							.endif
						.endif
					.endif
				.endif
			.endif
			xor		eax,eax
			ret
		.elseif eax==WM_MOUSEMOVE || eax==WM_NCMOUSEMOVE
			.if ToolBoxID
				invoke DrawingRect,hWin,lParam,1
			.elseif fMoveing
				.if hMultiSel
					mov		eax,hMultiSel
				  @@:
					push	eax
					invoke GetParent,eax
					push	eax
					invoke MoveingRect,eax,lParam,1,nInx
					pop		eax
					.if eax==hWin
						invoke DialogTltSize,ParPt.x,ParPt.y
					.endif
					inc		nInx
					mov		ecx,8
					pop		eax
					.while ecx
						push	ecx
						invoke GetWindowLong,eax,GWL_USERDATA
						pop		ecx
						dec		ecx
					.endw
					or		eax,eax
					jne		@b
				.else
					invoke MoveingRect,hWin,lParam,1,0
					invoke DialogTltSize,ParPt.x,ParPt.y
				.endif
			.else
				.if fDrawing
					invoke DrawingRect,hWin,lParam,1
				.endif
				invoke LoadCursor,0,IDC_ARROW
				invoke SetCursor,eax
			.endif
			xor		eax,eax
			ret
		.elseif eax==WM_LBUTTONUP || eax==WM_NCLBUTTONUP
			.if !fNoMouseUp
				.if fMoveing
					.if hMultiSel
						mov		eax,hMultiSel
						.while eax
							push	eax
							invoke GetParent,eax
							push	eax
							invoke MoveingRect,eax,lParam,2,nInx
							pop		eax
							invoke SizeingRect,eax,99
							inc		nInx
							mov		ecx,8
							pop		eax
							.while ecx
								push	ecx
								invoke GetWindowLong,eax,GWL_USERDATA
								pop		ecx
								dec		ecx
							.endw
						.endw
					.else
						invoke SetFocus,hPrp
						invoke MoveingRect,hWin,lParam,2,0
						invoke SizeingRect,hWin,FALSE
					.endif
					invoke ReleaseCapture
					mov		fMoveing,0
					invoke NotifyParent
				.elseif fDrawing
					push	ToolBoxID
					invoke DrawingRect,hWin,lParam,2
					pop		eax
					.if !eax
						.if hReSize
							invoke DestroySizeingRect
						.endif
						.while hMultiSel
							invoke DestroyMultiSel,hMultiSel
							mov		hMultiSel,eax
						.endw
						.if sdword ptr SizeRect.right<0
							mov		eax,SizeRect.left
							mov		SizeRect.right,eax
							mov		SizeRect.left,0
						.endif
						mov		eax,SizeRect.left
						add		SizeRect.right,eax
						.if  sdword ptr SizeRect.bottom<0
							mov		eax,SizeRect.top
							mov		SizeRect.bottom,eax
							mov		SizeRect.top,0
						.endif
						mov		eax,SizeRect.top
						add		SizeRect.bottom,eax
						mov		eax,TRUE
						.while eax
							add		esi,sizeof DIALOG
							mov		eax,(DIALOG ptr [esi]).hwnd
							.if eax && eax!=-1
								mov		eax,(DIALOG ptr [esi]).x
								mov		ecx,eax
								add		ecx,(DIALOG ptr [esi]).ccx
								.if (eax>=SizeRect.left && eax<=SizeRect.right) || (ecx>=SizeRect.left && ecx<=SizeRect.right) || (SizeRect.left>=eax && SizeRect.right<=ecx)
									mov		eax,(DIALOG ptr [esi]).y
									mov		ecx,eax
									add		ecx,(DIALOG ptr [esi]).ccy
									.if (eax>=SizeRect.top && eax<=SizeRect.bottom) || (ecx>=SizeRect.top && ecx<=SizeRect.bottom) || (SizeRect.top>=eax && SizeRect.bottom<=ecx)
										mov		eax,(DIALOG ptr [esi]).ntype
										.if eax!=18 && eax!=19
											mov		eax,(DIALOG ptr [esi]).hwnd
											invoke CtlMultiSelect,eax,lParam
											inc		nInx
										.endif
									.endif
								.endif
								mov		eax,TRUE
							.endif
						.endw
						.if nInx==1 && hMultiSel
							invoke GetParent,hMultiSel
							invoke SizeingRect,eax,FALSE
						.endif
						invoke NotifyParent
					.endif
				.else
					.if !hMultiSel
						invoke SizeingRect,hWin,FALSE
					.endif
					invoke NotifyParent
				.endif
			.else
				mov		fNoMouseUp,FALSE
			.endif
			mov		fMultiSel,FALSE
			xor		eax,eax
			ret
		.elseif eax==WM_SYSCOMMAND
			xor		eax,eax
			ret
		.elseif eax==WM_SIZE
			mov		eax,(DIALOG ptr [esi]).ntype
			.if !eax
				invoke GetClientRect,hWin,addr rect
				sub		esi,sizeof DLGHEAD
				mov		eax,(DLGHEAD ptr [esi]).htlb 
				.if eax
					mov		hCtl,eax
					invoke GetWindowLong,eax,GWL_STYLE
					test	eax,CCS_NORESIZE
					.if ZERO?
						invoke MoveWindow,hCtl,0,0,rect.right,rect.bottom,TRUE
					.endif
				.endif
				mov		eax,(DLGHEAD ptr [esi]).hstb 
				.if eax
					mov		hCtl,eax
					invoke GetWindowLong,eax,GWL_STYLE
					test	eax,CCS_NORESIZE
					.if ZERO?
						invoke MoveWindow,hCtl,0,0,rect.right,rect.bottom,TRUE
					.endif
				.endif
			.endif
		.elseif eax==WM_NOTIFY
			mov		edx,lParam
			mov		eax,(NMHDR ptr [edx]).code
			.if eax==PGN_CALCSIZE
				mov		eax,[edx].NMPGCALCSIZE.dwFlag
				.if eax==PGF_CALCHEIGHT
					mov		[edx].NMPGCALCSIZE.iHeight,2048
				.else
					mov		[edx].NMPGCALCSIZE.iWidth,2048
				.endif
			.endif
		.endif
	.endif
	invoke CallWindowProc,lpOldProc,hWin,uMsg,wParam,lParam
	ret

CtlProc endp

CtlDummyProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
	LOCAL	pt:POINT
	LOCAL	ptp:POINT
	LOCAL	hPar:HWND

	.if uMsg>=WM_MOUSEFIRST && uMsg<=WM_MOUSELAST
		mov		eax,lParam
		and		eax,0FFFFh
		mov		pt.x,eax
		mov		eax,lParam
		shr		eax,16
		mov		pt.y,eax
		invoke ClientToScreen,hWin,addr pt
		invoke GetParent,hWin
		mov		hPar,eax
		mov		ptp.x,0
		mov		ptp.y,0
		invoke ClientToScreen,hPar,addr ptp
		mov		eax,pt.x
		sub		eax,ptp.x
		mov		edx,pt.y
		sub		edx,ptp.y
		shl		edx,16
		or		edx,eax
		invoke PostMessage,hPar,uMsg,wParam,edx
		xor		eax,eax
		ret
	.endif
	invoke GetWindowLong,hWin,GWL_USERDATA
	invoke CallWindowProc,eax,hWin,uMsg,wParam,lParam
	ret

CtlDummyProc endp

CtlEnumProc proc hWin:HWND,lParam:LPARAM

	.if lParam
		invoke SetWindowLong,hWin,GWL_WNDPROC,offset CtlDummyProc
		invoke SetWindowLong,hWin,GWL_USERDATA,eax
	.else
		invoke GetWindowLong,hWin,GWL_STYLE
		or		eax,WS_DISABLED
		invoke SetWindowLong,hWin,GWL_STYLE,eax
	.endif
	mov		eax,TRUE
	ret

CtlEnumProc endp

MakeDlgFont proc uses esi,lpMem:DWORD
	LOCAL	lf:LOGFONT

	mov		esi,lpMem
	.if [esi].DLGHEAD.hfont
		invoke DeleteObject,[esi].DLGHEAD.hfont
	.endif
    invoke RtlZeroMemory,addr lf,size lf
	mov		eax,[esi].DLGHEAD.fontht
	mov		lf.lfHeight,eax
	mov		lf.lfWeight,400
    invoke lstrcpy,addr lf.lfFaceName,addr [esi].DLGHEAD.font
	invoke CreateFontIndirect,addr lf
	mov     [esi].DLGHEAD.hfont,eax
	ret

MakeDlgFont endp

DesignDummyProc proc hWin:HWND,uMsg:UINT,wParam:WP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -