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

📄 lion-tutorial34.htm

📁 内有一些代码
💻 HTM
📖 第 1 页 / 共 4 页
字号:
						mov findtext.chrg.cpMax,-1					.else						mov findtext.chrg.cpMax,0					.endif					invoke IsDlgButtonChecked,hWnd,IDC_MATCHCASE					.if eax==BST_CHECKED						or uFlags,FR_MATCHCASE					.endif					invoke IsDlgButtonChecked,hWnd,IDC_WHOLEWORD					.if eax==BST_CHECKED						or uFlags,FR_WHOLEWORD					.endif					mov findtext.lpstrText,offset FindBuffer					invoke SendMessage,hwndRichEdit,EM_FINDTEXTEX,uFlags,addr findtext					.if eax!=-1						invoke SendMessage,hwndRichEdit,EM_EXSETSEL,0,addr findtext.chrgText					.endif				.endif			.elseif ax==IDCANCEL				invoke SendMessage,hWnd,WM_CLOSE,0,0			.else				mov eax,FALSE				ret			.endif		.endif	.elseif uMsg==WM_CLOSE		mov hSearch,0		invoke EndDialog,hWnd,0	.else		mov eax,FALSE		ret	.endif	mov eax,TRUE	retSearchProc endpReplaceProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD	LOCAL settext:SETTEXTEX	.if uMsg==WM_INITDIALOG		push hWnd		pop hSearch		invoke SetDlgItemText,hWnd,IDC_FINDEDIT,addr FindBuffer		invoke SetDlgItemText,hWnd,IDC_REPLACEEDIT,addr ReplaceBuffer	.elseif uMsg==WM_COMMAND		mov eax,wParam		shr eax,16		.if ax==BN_CLICKED			mov eax,wParam			.if ax==IDCANCEL				invoke SendMessage,hWnd,WM_CLOSE,0,0			.elseif ax==IDOK				invoke GetDlgItemText,hWnd,IDC_FINDEDIT,addr FindBuffer,sizeof FindBuffer				invoke GetDlgItemText,hWnd,IDC_REPLACEEDIT,addr ReplaceBuffer,sizeof ReplaceBuffer				mov findtext.chrg.cpMin,0				mov findtext.chrg.cpMax,-1				mov findtext.lpstrText,offset FindBuffer				mov settext.flags,ST_SELECTION				mov settext.codepage,CP_ACP				.while TRUE					invoke SendMessage,hwndRichEdit,EM_FINDTEXTEX,FR_DOWN,addr findtext					.if eax==-1						.break					.else						invoke SendMessage,hwndRichEdit,EM_EXSETSEL,0,addr findtext.chrgText						invoke SendMessage,hwndRichEdit,EM_SETTEXTEX,addr settext,addr ReplaceBuffer					.endif				.endw			.endif		.endif	.elseif uMsg==WM_CLOSE		mov hSearch,0		invoke EndDialog,hWnd,0	.else		mov eax,FALSE		ret	.endif	mov eax,TRUE	retReplaceProc endpGoToProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD	LOCAL LineNo:DWORD	LOCAL chrg:CHARRANGE	.if uMsg==WM_INITDIALOG		push hWnd		pop hSearch	.elseif uMsg==WM_COMMAND		mov eax,wParam		shr eax,16		.if ax==BN_CLICKED			mov eax,wParam			.if ax==IDCANCEL				invoke SendMessage,hWnd,WM_CLOSE,0,0			.elseif ax==IDOK				invoke GetDlgItemInt,hWnd,IDC_LINENO,NULL,FALSE				mov LineNo,eax				invoke SendMessage,hwndRichEdit,EM_GETLINECOUNT,0,0				.if eax>LineNo					invoke SendMessage,hwndRichEdit,EM_LINEINDEX,LineNo,0					mov chrg.cpMin,eax					mov chrg.cpMax,eax					invoke SendMessage,hwndRichEdit,EM_EXSETSEL,0,addr chrg					invoke SetFocus,hwndRichEdit				.endif			.endif		.endif	.elseif uMsg==WM_CLOSE		mov hSearch,0		invoke EndDialog,hWnd,0	.else		mov eax,FALSE		ret	.endif	mov eax,TRUE	retGoToProc endpPrepareEditMenu proc hSubMenu:DWORD	LOCAL chrg:CHARRANGE	invoke SendMessage,hwndRichEdit,EM_CANPASTE,CF_TEXT,0	.if eax==0		; no text in the clipboard		invoke EnableMenuItem,hSubMenu,IDM_PASTE,MF_GRAYED	.else		invoke EnableMenuItem,hSubMenu,IDM_PASTE,MF_ENABLED	.endif	invoke SendMessage,hwndRichEdit,EM_CANUNDO,0,0	.if eax==0		invoke EnableMenuItem,hSubMenu,IDM_UNDO,MF_GRAYED	.else		invoke EnableMenuItem,hSubMenu,IDM_UNDO,MF_ENABLED	.endif	invoke SendMessage,hwndRichEdit,EM_CANREDO,0,0	.if eax==0		invoke EnableMenuItem,hSubMenu,IDM_REDO,MF_GRAYED	.else		invoke EnableMenuItem,hSubMenu,IDM_REDO,MF_ENABLED	.endif	invoke SendMessage,hwndRichEdit,EM_EXGETSEL,0,addr chrg	mov eax,chrg.cpMin	.if eax==chrg.cpMax		; no current selection		invoke EnableMenuItem,hSubMenu,IDM_COPY,MF_GRAYED		invoke EnableMenuItem,hSubMenu,IDM_CUT,MF_GRAYED		invoke EnableMenuItem,hSubMenu,IDM_DELETE,MF_GRAYED	.else		invoke EnableMenuItem,hSubMenu,IDM_COPY,MF_ENABLED		invoke EnableMenuItem,hSubMenu,IDM_CUT,MF_ENABLED		invoke EnableMenuItem,hSubMenu,IDM_DELETE,MF_ENABLED	.endif	retPrepareEditMenu endpWndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD	LOCAL ofn:OPENFILENAME	LOCAL buffer[256]:BYTE	LOCAL editstream:EDITSTREAM	LOCAL hFile:DWORD	LOCAL hPopup:DWORD	LOCAL pt:POINT	LOCAL chrg:CHARRANGE	.if uMsg==WM_CREATE		invoke CreateWindowEx,WS_EX_CLIENTEDGE,addr RichEditClass,0,WS_CHILD or WS_VISIBLE or ES_MULTILINE or WS_VSCROLL or WS_HSCROLL or ES_NOHIDESEL,\				CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,hWnd,RichEditID,hInstance,0		mov hwndRichEdit,eax		invoke SendMessage,hwndRichEdit,EM_LIMITTEXT,-1,0		invoke SetColor		invoke SendMessage,hwndRichEdit,EM_SETMODIFY,FALSE,0		invoke SendMessage,hwndRichEdit,EM_SETEVENTMASK,0,ENM_MOUSEEVENTS		invoke SendMessage,hwndRichEdit,EM_EMPTYUNDOBUFFER,0,0	.elseif uMsg==WM_NOTIFY		push esi		mov esi,lParam		assume esi:ptr NMHDR		.if [esi].code==EN_MSGFILTER			assume esi:ptr MSGFILTER			.if [esi].msg==WM_RBUTTONDOWN				invoke GetMenu,hWnd				invoke GetSubMenu,eax,1				mov hPopup,eax				invoke PrepareEditMenu,hPopup				mov edx,[esi].lParam				mov ecx,edx				and edx,0FFFFh				shr ecx,16				mov pt.x,edx				mov pt.y,ecx				invoke ClientToScreen,hWnd,addr pt				invoke TrackPopupMenu,hPopup,TPM_LEFTALIGN or TPM_BOTTOMALIGN,pt.x,pt.y,NULL,hWnd,NULL			.endif		.endif		pop esi	.elseif uMsg==WM_INITMENUPOPUP		mov eax,lParam		.if ax==0		; file menu						.if FileOpened==TRUE	; a file is already opened				invoke EnableMenuItem,wParam,IDM_OPEN,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_CLOSE,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_SAVE,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_SAVEAS,MF_ENABLED			.else				invoke EnableMenuItem,wParam,IDM_OPEN,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_CLOSE,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_SAVE,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_SAVEAS,MF_GRAYED			.endif		.elseif ax==1	; edit menu			invoke PrepareEditMenu,wParam		.elseif ax==2		; search menu bar			.if FileOpened==TRUE				invoke EnableMenuItem,wParam,IDM_FIND,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_FINDNEXT,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_FINDPREV,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_REPLACE,MF_ENABLED				invoke EnableMenuItem,wParam,IDM_GOTOLINE,MF_ENABLED			.else				invoke EnableMenuItem,wParam,IDM_FIND,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_FINDNEXT,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_FINDPREV,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_REPLACE,MF_GRAYED				invoke EnableMenuItem,wParam,IDM_GOTOLINE,MF_GRAYED			.endif		.endif	.elseif uMsg==WM_COMMAND		.if lParam==0		; menu commands			mov eax,wParam			.if ax==IDM_OPEN				invoke RtlZeroMemory,addr ofn,sizeof ofn				mov ofn.lStructSize,sizeof ofn				push hWnd				pop ofn.hwndOwner				push hInstance				pop ofn.hInstance				mov ofn.lpstrFilter,offset ASMFilterString				mov ofn.lpstrFile,offset FileName				mov byte ptr [FileName],0				mov ofn.nMaxFile,sizeof FileName				mov ofn.Flags,OFN_FILEMUSTEXIST or OFN_HIDEREADONLY or OFN_PATHMUSTEXIST				invoke GetOpenFileName,addr ofn				.if eax!=0					invoke CreateFile,addr FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0					.if eax!=INVALID_HANDLE_VALUE						mov hFile,eax						;================================================================						; stream the text into the richedit control						;================================================================												mov editstream.dwCookie,eax						mov editstream.pfnCallback,offset StreamInProc						invoke SendMessage,hwndRichEdit,EM_STREAMIN,SF_TEXT,addr editstream						;==========================================================						; Initialize the modify state to false						;==========================================================						invoke SendMessage,hwndRichEdit,EM_SETMODIFY,FALSE,0						invoke CloseHandle,hFile						mov FileOpened,TRUE					.else						invoke MessageBox,hWnd,addr OpenFileFail,addr AppName,MB_OK or MB_ICONERROR					.endif				.endif			.elseif ax==IDM_CLOSE				invoke CheckModifyState,hWnd				.if eax==TRUE					invoke SetWindowText,hwndRichEdit,0					mov FileOpened,FALSE				.endif			.elseif ax==IDM_SAVE				invoke CreateFile,addr FileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0				.if eax!=INVALID_HANDLE_VALUE@@:									mov hFile,eax					;================================================================					; stream the text to the file					;================================================================						

⌨️ 快捷键说明

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