iczelion tut34[6]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

,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 ret searchproc endp replaceproc 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 ret replaceproc endp gotoproc 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 ret gotoproc endp prepareeditmenu 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 ret prepareeditmenu endp wndproc 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==w

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top