iczelion tut35[8]

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

本文简介:选择自 jimgreen 的 blog

add esi,eax sub ecx,eax .else inc esi dec ecx .endif .endw .endif invoke selectobject,hdc,holdrgn invoke deleteobject,hrgn invoke selectobject,hdc,holdfont invoke releasedc,hwnd,hdc invoke showcaret,hwnd pop eax pop esi pop edi ret .elseif umsg==wm_close invoke setwindowlong,hwnd,gwl_wndproc,oldwndproc .else invoke callwindowproc,oldwndproc,hwnd,umsg,wparam,lparam ret .endif newricheditproc 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_settypographyoptions,to_simplelinebreak,to_simplelinebreak invoke sendmessage,hwndrichedit,em_gettypographyoptions,1,1 .if eax==0 ; means this message is not processed mov richeditversion,2 .else mov richeditversion,3 invoke sendmessage,hwndrichedit,em_seteditstyle,ses_emulatesysedit,ses_emulatesysedit .endif invoke setwindowlong,hwndrichedit,gwl_wndproc, addr newricheditproc mov oldwndproc,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 mov editstream.dwcookie,eax mov editstream.pfncallback,offset streaminproc invoke sendmessage,hwndrichedit,em_streamin,sf_text,addr editstream 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

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

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

go top