版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
華北科技學(xué)院課程設(shè)計闡明書課程名稱:匯編語言班級:計算機B08-1姓名:_李鵬飛___學(xué)號:__07014231__設(shè)計題目:___win32編寫記事本___設(shè)計時間:_6月23日_至_7月1日__指引教師:_____杜杏菁_________________評語:_____________________________________________________________________________________________________________________________________________________________________________________________________評閱成績:____評閱教師:_____一、課程設(shè)計目進行程序設(shè)計辦法和技能基本訓(xùn)練,鞏固在課堂上學(xué)到關(guān)于程序設(shè)計基本知識和基本辦法,通過實際動手能力培養(yǎng),進一步熟悉匯編語言構(gòu)造和用法,達到能獨立閱讀、編制和調(diào)試一定規(guī)模匯編語言程序水平。二、課程設(shè)計規(guī)定1.規(guī)定編寫并調(diào)試通過一種小型軟件,實現(xiàn)對軟件或硬件操作。2.遵循模塊化、構(gòu)造化程序設(shè)計辦法。3.規(guī)定程序必要對的。4.程序簡要易懂,多運用輸入輸出提示,出錯信息及必要注釋。5.規(guī)定程序構(gòu)造合理,語句使用得當(dāng)。6.恰當(dāng)追求編程技巧和程序運營效率。三、課程設(shè)計題目:win32編寫記事本四、課題分析WINDOW記事本編寫,規(guī)定能實現(xiàn)基本菜單框架并打開窗口,有能力同窗可以編寫進行數(shù)據(jù)錄入并保存代碼開始加載頭文獻開始加載頭文獻加載數(shù)據(jù)段編譯代碼設(shè)計窗體編譯生成文獻結(jié)束六、程序源代碼:.386.modelflat,stdcalloptioncasemap:noneinclude windows.incinclude user32.incincludelib user32.libinclude kernel32.incincludelibkernel32.libinclude shell32.incincludelib shell32.libinclude comctl32.incincludelibcomctl32.libinclude comdlg32.incincludelibcomdlg32.libICO_MAIN EQU 1000h ;圖標IDM_MAIN EQU h ;菜單IDA_MAIN EQU h ;加速鍵IDM_NEW EQU 2101h ;新建IDM_OPEN EQU 2102h ;打開IDM_SAVE EQU 2103h ;保存IDM_SAVEAS EQU 2104h ;另存為IDM_EXIT EQU 2105h ;退出IDM_UNDO EQU 2201h ;撤銷IDM_CUT EQU 2203h ;剪切IDM_COPY EQU 2204h ;復(fù)制IDM_PASTE EQU 2205h ;粘貼IDM_DELETE EQU 2206h ;刪除IDM_FIND EQU 2207h ;查找IDM_REPLACE EQU 220Ah ;替代IDM_SELECTALL EQU 220Bh ;全選IDM_FONT EQU 2301h ;字體IDM_STATUSBAR EQU 2401h ;狀態(tài)欄IDM_HELP EQU 2501h ;協(xié)助主題IDM_ABOUT EQU 2502h ;關(guān)于IDM_MENUHELP EQU 2601h ;菜單信息.data?hInstance dd ?hWinMain dd ?hMenu dd ?hWinStatus dd ?hWinEdit dd ?hFile dd ?hFindDialog dd ?hRichEdit dd ?dwFontColor dd ?idFindMessage dd ?stFind FINDREPLACE <?>szFindText db 100dup(?)szReplaceText db 100 dup (?)szFileName db MAX_PATHdup(?)stLogFont LOGFONT <?>dwOption dd ?.dataF_STATUSBAR equ 00000001hdllEdit db "RichEd20.dll",0errTitle db "錯誤",0noRichEdit db "無法找到RichEd20.dll"className db "TextEditor",0captionMain db "文本編輯器",0classEdit db "RichEdit20A",0fontFace db "Fixedsys",0modify db "你已經(jīng)改動過啦,要不要存一下?",0filter db "文本文獻(*.txt)",0,"*.txt",0,"所有文獻",0,"*.*",0,0defExt db "txt",0titleFormat db "%s-我記事本",0errCreateFile db "咦!浮現(xiàn)問題了!",0errOpenFile db "咦!怎么打不開!",0notFound db "不給力啊,找不到!",0noName db "還沒起名字",0timeFormat db "%02d:%02d:%02d",0charsFormat db "字節(jié)數(shù):%d",0lineFormat db "行:%d",0colFormat db "列:%d",0helpTitle db "協(xié)助",0helpText db "Sorry!無法提供任何協(xié)助",0aboutTitle db "關(guān)于記事本",0aboutText db "我記事本",0ah,0dh,"作者:李鵬飛",0ah,0dh,"07月01日",0ah,0dh,0dwStatusWidth dd 100,200,300,400,-1dwMenuHelp dd 0,IDM_MENUHELP,0,0FINDMSGSTRING db "commdlg_FindReplace",0.code;====================================================================================================_CheckModifyStatePROC invoke SendMessage,hWinEdit,EM_GETMODIFY,0,0 ;獲取控件內(nèi)容與否變化信息 .if eax!=0 invoke MessageBox,hWinMain,addrmodify,addrcaptionMain,\ MB_YESNOCANCELorMB_ICONQUESTION .if eax==IDYES call _SaveFile ;有待改動 .elseif eax==IDCANCEL mov eax,FALSE ret .endif .endif mov eax,TRUE ret_CheckModifyStateENDP;====================================================================================================;Richedit流出操作_StreamProcOutPROCusesebxediesi_dwCookie,lpBuffer,NumBytes,pBytes invoke WriteFile,hFile,lpBuffer,NumBytes,pBytes,0 xoreax,1 ;如果ReadFile或WriteFile返回1(成功),則最后eax返回0,闡明操作成功 ret_StreamProcOutENDP;====================================================================================================;Richedit流入操作_StreamProcInPROCusesebxediesi_dwCookie,lpBuffer,NumBytes,pBytes invoke ReadFile,hFile,lpBuffer,NumBytes,pBytes,0 xoreax,1 ;如果ReadFile或WriteFile返回1(成功),則最后eax返回0,闡明操作成功 ret_StreamProcInENDP;====================================================================================================;設(shè)立字體和字體顏色_SetFont PROC _lpszFont,_dwFontSize,_dwColor local @stCf:CHARFORMAT invoke RtlZeroMemory,addr@stCf,sizeof @stCf ;開始填充stCf構(gòu)造 mov @stCf.cbSize,sizeof@stCf mov @stCf.dwMask,CFM_SIZEorCFM_FACEorCFM_BOLDorCFM_COLOR ;字段掩碼,用來指定構(gòu)造中哪些字段是有效 push _dwFontSize pop @stCf.yHeight push _dwColor pop @stCf.crTextColor mov @stCf.dwEffects,0 invoke lstrcpy,addr@stCf.szFaceName,_lpszFont invoke SendMessage,hWinEdit,EM_SETTEXTMODE,1,0 ;設(shè)立工作模式 invoke SendMessage,hWinEdit,EM_SETCHARFORMAT,SCF_ALL,addr@stCf ;為控件中所有文本設(shè)立指定格式 ret_SetFontENDP;====================================================================================================;查找文字_FindText PROC local @stFindText:FINDTEXTEX;設(shè)立查找區(qū)域 invoke SendMessage,hWinEdit,EM_EXGETSEL,0,addr @stFindText.chrg .if stFind.Flags&FR_DOWN ;向下查找 push @stFindText.chrg.cpMax pop @stFindText.chrg.cpMin ;將這個選取區(qū)域結(jié)束位置用做下一次查找起始點 .endif mov @stFindText.chrg.cpMax,-1 ;始終查找到所有文本最后;設(shè)立查找選項 mov @stFindText.lpstrText,offsetszFindText mov ecx,stFind.Flags and ecx,FR_MATCHCASEorFR_DOWNorFR_WHOLEWORD ;查找并把光標設(shè)立到找到文本上 invoke SendMessage,hWinEdit,EM_FINDTEXTEX,ecx,addr@stFindText ;ecx中存儲是搜索選項 .if eax== -1 mov ecx,hWinMain .if hFindDialog mov ecx,hFindDialog .endif invoke MessageBox,ecx,addrnotFound,NULL,MB_OKorMB_ICONINFORMATION ret .endif ;找到文本后來,文本位置在FINDTEXTEX構(gòu)造chrgText字段中返回,chrgText字段是一種CHARRANGE構(gòu)造,直接在EM_EXSETSEL消息中使用它將選取區(qū)域設(shè)立到找到文字上 invoke SendMessage,hWinEdit,EM_EXSETSEL,0,addr@stFindText.chrgText invoke SendMessage,hWinEdit,EM_SCROLLCARET,NULL,NULL ;卷動文字,以便找到文本可以出當(dāng)前顧客視野中 ret_FindText ENDP;====================================================================================================;保存文獻,如果沒有打開或創(chuàng)立文獻則另存為_SaveFile PROC local @stES:EDITSTREAM .if !hFile call _SaveAs .if !eax ret .endif .endif mov @stES.dwCookie,FALSE ;在Richedit流操作中寫文獻 mov @stES.dwError,NULL mov @stES.pfnCallback,offset_StreamProcOut ;回調(diào)函數(shù) invoke SendMessage,hWinEdit,EM_STREAMOUT,SF_TEXT,addr@stES ;流出操作,文本格式是簡樸文本格式 invoke SendMessage,hWinEdit,EM_SETMODIFY,FALSE,0 ;設(shè)立修改狀態(tài) mov eax,TRUE ret _SaveFile ENDP;=====================================================================================================;另存為_SaveAs PROC local @stOF:OPENFILENAME local @stEs:EDITSTREAM invoke RtlZeroMemory,addr@stOF,sizeof@stOF;顯示"保存文獻"對話框 ;填充stOF構(gòu)造 mov @stOF.lStructSize,sizeof@stOF push hWinMain pop @stOF.hwndOwner ;所屬窗口 mov @stOF.lpstrFilter,offsetfilter ;指定文獻名篩選字符串 mov @stOF.lpstrFile,offsetszFileName mov @stOF.nMaxFile,MAX_PATH ;指定lpstrFile參數(shù)指向緩沖區(qū)長度,260 mov @stOF.Flags,OFN_PATHMUSTEXIST ;途徑必要存在 mov @stOF.lpstrDefExt,offsetdefExt ;默認擴展名 mov @stOF.lpstrTitle,NULL ;標題為“另存為” invoke GetSaveFileName,addr@stOF .if eax ;創(chuàng)立新文獻 invoke CreateFile,addrszFileName,GENERIC_READorGENERIC_WRITE,\ ;存取方式:為讀寫 FILE_SHARE_READ,\ ;共享屬性:容許其她進程同步以讀方式打開文獻 0,\ ;安全屬性:無法被繼承 CREATE_ALWAYS,\ ;創(chuàng)立新文獻,如果文獻已經(jīng)存在則清除原文獻 FILE_ATTRIBUTE_NORMAL,\ ;文獻屬性:普通文獻 0 ;文獻模板句柄 .if eax!=INVALID_HANDLE_VALUE push eax .if hFile ;有打開文獻 invokeCloseHandle,hFile .endif pop eax ;保存文獻 mov hFile,eax ;文獻句柄 call _SaveFile call _SetCaption call _SetStatus mov eax,TRUE ret .else invoke MessageBox,hWinMain,addrerrCreateFile,NULL,MB_OKorMB_ICONERROR .endif .endif mov eax,FALSE ret_SaveAs ENDP;=====================================================================================================;打開及輸入文獻_OpenFile PROC local @stOF:OPENFILENAME local @stES:EDITSTREAM invoke RtlZeroMemory,addr@stOF,sizeof@stOF;顯示“打開文獻”對話框 mov @stOF.lStructSize,sizeof@stOF push hWinMain pop @stOF.hwndOwner mov @stOF.lpstrFilter,offsetfilter mov @stOF.lpstrFile,offsetszFileName mov @stOF.nMaxFile,MAX_PATH mov @stOF.Flags,OFN_FILEMUSTEXISTorOFN_PATHMUSTEXIST ;文獻必要存在 invoke GetOpenFileName,addr@stOF .if eax ;創(chuàng)立文獻 invoke CreateFile,addrszFileName,GENERIC_READorGENERIC_WRITE,\ FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0 ;打開存在文獻,當(dāng)文獻不存在時函數(shù)會返回失敗 .if eax== INVALID_HANDLE_VALUE invoke MessageBox,hWinMain,addrerrOpenFile,NULL,MB_OKorMB_ICONSTOP ret .endif push eax .if hFile invoke CloseHandle,hFile .endif pop eax mov hFile,eax ;讀入文獻 mov @stES.dwCookie,TRUE ;在Richedit流操作中讀文獻 mov @stES.dwError,NULL mov @stES.pfnCallback,offset_StreamProcIn invoke SendMessage,hWinEdit,EM_STREAMIN,SF_TEXT,addr@stES ;流入操作,文本格式是簡樸文本格式 invoke SendMessage,hWinEdit,EM_SETMODIFY,FALSE,0 ;設(shè)立修改狀態(tài) call _SetCaption call _SetStatus .endif ret_OpenFile ENDP;=====================================================================================================;選取字體_ChooseFont PROC local @stCF:CHOOSEFONT invoke RtlZeroMemory,addr@stCF,sizeof@stCF mov @stCF.lStructSize,sizeof@stCF push hWinMain pop @stCF.hwndOwner mov @stCF.lpLogFont,offsetstLogFont ;指定字體名稱和屬性 push dwFontColor pop @stCF.rgbColors mov @stCF.Flags,CF_SCREENFONTSorCF_INITTOLOGFONTSTRUCTorCF_EFFECTS ;字體列表中只顯示屏幕字體,對話框中顯示“效果”復(fù)選框 invoke ChooseFont,addr@stCF .if eax push @stCF.rgbColors pop dwFontColor mov eax,@stCF.iPointSize ;顧客選取字體大小,單位是1/10磅 shl eax,1 invoke _SetFont,addrstLogFont.lfFaceName,eax,@stCF.rgbColors .endif ret_ChooseFont ENDP;=====================================================================================================;設(shè)立標題欄顯示內(nèi)容_SetCaption PROC local @szBuffer[1024]:byte .if szFileName ;如果當(dāng)前是某一文獻,則顯示文獻名 mov eax,offsetszFileName .else mov eax,offsetnoName ;否則顯示未命名 .endif invoke wsprintf,addr@szBuffer,addrtitleFormat,eax invoke SetWindowText,hWinMain,addr@szBuffer ret_SetCaption ENDP;=====================================================================================================;設(shè)立菜單項,狀態(tài)欄狀態(tài)和信息_SetStatus PROC local @stRange:CHARRANGE local @dwLines,@dwLine,@dwLineStart local @szBuffer[256]:byte local @stST:SYSTEMTIME ;在狀態(tài)欄顯示行列信息 invoke GetWindowTextLength,hWinEdit invoke wsprintf,addr@szBuffer,addrcharsFormat,eax invoke SendMessage,hWinStatus,SB_SETTEXT,2,addr@szBuffer ;總字節(jié)數(shù) invoke SendMessage,hWinEdit,EM_EXGETSEL,0,addr@stRange ;獲取選定區(qū)域 invoke SendMessage,hWinEdit,EM_EXLINEFROMCHAR,0,-1 ;得知指定字符位于哪一行中 mov @dwLine,eax invoke SendMessage,hWinEdit,EM_LINEINDEX,eax,0 ;獲取指定行起始字符位置 mov ecx,@stRange.cpMin sub ecx,eax inc ecx ;顯示給顧客列號從1開始編號 invoke wsprintf,addr@szBuffer,addrcolFormat,ecx invoke SendMessage,hWinStatus,SB_SETTEXT,1,addr@szBuffer ;光標所在位置列 inc @dwLine ;顯示給顧客行號從1開始 invoke wsprintf,addr@szBuffer,addrlineFormat,@dwLine invoke SendMessage,hWinStatus,SB_SETTEXT,0,addr@szBuffer ;光標所在位置行 ;依照狀況變化菜單項狀態(tài) mov eax,@stRange.cpMin .if eax==@stRange.cpMax ;選中區(qū)域為空則復(fù)制粘貼刪除不可用 invoke EnableMenuItem,hMenu,IDM_COPY,MF_GRAYED invoke EnableMenuItem,hMenu,IDM_CUT,MF_GRAYED .else invoke EnableMenuItem,hMenu,IDM_COPY,MF_ENABLED invoke EnableMenuItem,hMenu,IDM_CUT,MF_ENABLED .endif invoke IsClipboardFormatAvailable,CF_TEXT ;判斷剪貼板格式與否是文本格式 .if eax ;如果剪貼板有內(nèi)容則可以粘貼 invoke EnableMenuItem,hMenu,IDM_PASTE,MF_ENABLED .else invoke EnableMenuItem,hMenu,IDM_PASTE,MF_GRAYED .endif invoke GetWindowTextLength,hWinEdit .if eax ;如果可以全選 invoke EnableMenuItem,hMenu,IDM_SELECTALL,MF_ENABLED .else invoke EnableMenuItem,hMenu,IDM_SELECTALL,MF_GRAYED .endif invoke SendMessage,hWinEdit,EM_GETMODIFY,0,0 .if eax ;如果可以保存 invoke EnableMenuItem,hMenu,IDM_SAVE,MF_ENABLED .else invoke EnableMenuItem,hMenu,IDM_SAVE,MF_GRAYED .endif .if dwOption&F_STATUSBAR ;如果選中了狀態(tài)欄 invoke CheckMenuItem,hMenu,IDM_STATUSBAR,MF_CHECKED .else invoke CheckMenuItem,hMenu,IDM_STATUSBAR,MF_UNCHECKED .endif ret_SetStatus ENDP;=====================================================================================================_Resize PROC local @stRect:RECT local @stRectTemp:RECT local @dwWidth,@dwHeight ;獲得窗口客戶區(qū)大小 invoke GetClientRect,hWinMain,addr@stRect mov eax,@stRect.right sub eax,@stRect.left mov @dwWidth,eax mov eax,@stRect.bottom sub eax,@stRect.top mov @dwHeight,eax ;計算及調(diào)節(jié)狀態(tài)欄 .if dwOption&F_STATUSBAR invoke ShowWindow,hWinStatus,SW_SHOW invoke MoveWindow,hWinStatus,0,0,0,0,TRUE invoke GetWindowRect,hWinStatus,addr@stRectTemp mov eax,@stRectTemp.bottom sub eax,@stRectTemp.top sub @dwHeight,eax .else invoke ShowWindow,hWinStatus,SW_HIDE .endif ;調(diào)節(jié)Richedit控件位置 invoke MoveWindow,hWinEdit,@stRect.left,@stRect.top,@dwWidth,@dwHeight,TRUE ret_Resize ENDP;=====================================================================================================_Quit PROC invoke _CheckModifyState .if eax invoke DestroyWindow,hWinMain invoke PostQuitMessage,NULL ;產(chǎn)生一條WM_QUIT消息 .if hFile ;如果有打開文獻則關(guān)閉 invoke CloseHandle,hFile .endif .endif invoke KillTimer,hWinMain,1 ;取消定期器 ret_Quit ENDP;=====================================================================================================_CreateWindowPROC;注冊“查找”對話框消息,初始化“查找”對話框構(gòu)造 mov stFind.lStructSize,sizeofstFind ;構(gòu)造長度 push hWinMain pop stFind.hwndOwner ;指定所屬窗口 mov stFind.Flags,FR_DOWN ;把“方向”單選鈕設(shè)立為“向下” mov stFind.lpstrFindWhat,offsetszFindText ;lpstrFindWhat指向包括查找字符串指針 mov stFind.wFindWhatLen,sizeofszFindText ;wFindWhatLen批示lpstrFindWhat緩存區(qū)長度 mov stFind.lpstrReplaceWith,offsetszReplaceText ;指向包括替代為字符串指針 mov stFind.wReplaceWithLen,sizeofszReplaceText ;lpstrReplaceWith緩存區(qū)長度 invoke RegisterWindowMessage,addrFINDMSGSTRING ;注冊自定義消息 mov idFindMessage,eax ;eax中返回消息ID ;建立狀態(tài)欄 invoke CreateStatusWindow,SBARS_SIZEGRIPorWS_CHILDorWS_VISIBLE,\ ;顯示狀態(tài)欄右下角斜條 NULL,hWinMain,2 ;父窗口為hWinMain,狀態(tài)欄控件ID為2,初始化字符串為NULL mov hWinStatus,eax invoke SendMessage,hWinStatus,SB_SETPARTS,5,offsetdwStatusWidth ;提成四欄 ;建立輸出文本窗口 invoke CreateWindowEx,WS_EX_CLIENTEDGE,offsetclassEdit,NULL,\ ;客戶區(qū)立體邊框 WS_CHILDORWS_VISIBLEORWS_VSCROLLOR WS_HSCROLL\ ORES_MULTILINEorES_NOHIDESEL,\ ;可以編輯多行文字,失去鍵盤輸入焦點時候依然顯示選取區(qū)域 0,0,0,0,\ hWinMain,0,hInstance,NULL ;0指定是子窗口ID號 mov hWinEdit,eax or dwOption,F_STATUSBAR ;注釋 invoke _SetCaption ;設(shè)立標題 invoke _SetStatus ;設(shè)立狀態(tài)欄 invoke _SetFont,addrfontFace,9*20,0 ;注釋 ;在使用多行Edit控件時,父窗口發(fā)送EM_SETEVENTMASK消息給RichEdit控件,指定它對哪些消息感興趣 ;wParam必要為0,ENM_CHANGE發(fā)送EN_CHANGE告知NM_SELCHANGE發(fā)送EN_SELCHANGE告知 invoke SendMessage,hWinEdit,EM_SETEVENTMASK,0,ENM_CHANGEorENM_SELCHANGEorENM_MOUSEEVENTS invoke SendMessage,hWinEdit,EM_EXLIMITTEXT,0,-1 ;設(shè)立控件中可以容納字符總數(shù),0FFFFFFFFh(-1)字節(jié) invoke SendMessage,hWinMain,EM_EMPTYUNDOBUFFER,0,0 ;清空undo,redo隊列 ret_CreateWindowENDP;====================================================================================================;窗口過程_ProcWinMain PROC usesebxediesihWnd,uMsg,wParam,lParam local @stRange:CHARRANGE local @stST:SYSTEMTIME local @szBuffer[128]:byte local @pt:POINT local hPopup:DWORD local @stES:EDITSTREAM mov eax,uMsg .ifeax==WM_CREATE push hWnd pop hWinMain invoke _CreateWindow invoke SetTimer,hWinMain,1,300,NULL ;設(shè)立定期器 .elseif eax==WM_DROPFILES ;拖放文獻 call _CheckModifyState .ifeax==FALSE call _SaveFile .endif invoke DragQueryFile,wParam,0,addrszFileName,128 ;獲取文獻途徑 invoke CreateFile,addrszFileName,GENERIC_READorGENERIC_WRITE,\ FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0 ;打開文獻 mov hFile,eax mov @stES.dwCookie,TRUE ;在Richedit流操作中讀文獻 mov @stES.dwError,NULL mov @stES.pfnCallback,offset_StreamProcIn invoke SendMessage,hWinEdit,EM_STREAMIN,SF_TEXT,addr@stES ;流入操作,文本格式是簡樸文本格式 invoke SendMessage,hWinEdit,EM_SETMODIFY,FALSE,0 ;設(shè)立修改狀態(tài) call _SetCaption call _SetStatus .elseifeax==WM_TIMER invoke GetLocalTime,addr@stST movzx eax,@stST.wHour movzx ebx,@stST.wMinute movzx ecx,@stST.wSecond invoke wsprintf,addr@szBuffer,addrtimeFormat,eax,ebx,ecx invoke SendMessage,hWinStatus,SB_SETTEXT,3,addr@szBuffer .elseifeax==WM_SIZE invoke _Resize .elseifeax==WM_NOTIFY mov eax,lParam mov eax,[eax+NMHDR.hwndFrom] .if eax==hWinEdit invoke _SetStatus .endif push esi mov esi,lParam assume esi:ptr NMHDR .if[esi].code==EN_MSGFILTER ;鼠標滑輪發(fā)送消息 assumeesi:ptrMSGFILTER .if[esi].msg==WM_RBUTTONDOWN invoke GetMenu,hWinMain ;獲取窗口主菜單句柄 invoke GetSubMenu,eax,1 ;獲取彈出式子菜單句柄 mov hPopup,eax invoke _SetStatus mov edx,[esi].lParam ;位置信息 mov ecx,edx and edx,0FFFFh shr ecx,16 mov @pt.x,edx mov @pt.y,ecx invoke ClientToScreen,hWinMain,addr@pt invoke TrackPopupMenu,hPopup,TPM_LEFTALIGNorTPM_BOTTOMALIGN,@pt.x,@pt.y,NULL,hWinMain,NULL .endif .endif pop esi .elseif eax==WM_MENUSELECT invoke MenuHelp,WM_MENUSELECT,wParam,lParam,lParam,hInstance,hWinStatus,offsetdwMenuHelp .elseifeax==WM_COMMAND mov eax,wParam movzx eax,ax .ifeax==IDM_OPEN invoke _CheckModifyState .ifeax ;eax==TRUE闡明沒有被修改 call _OpenFile .endif .elseifeax==IDM_NEW invoke _CheckModifyState .if eax .if hFile invoke CloseHandle,hFile mov hFile,0 .endif mov szFileName,0 invoke SetWindowText,hWinEdit,NULL invoke _SetCaption invoke _SetStatus .endif .elseif eax==IDM_SAVE call _SaveFile .elseif eax==IDM_SAVEAS call _SaveAs .elseif eax==IDM_EXIT call _Quit .elseif eax==IDM_UNDO invoke SendMessage,hWinEdit,EM_UNDO,0,0 .elseif eax==IDM_SELECTALL mov @stRange.cpMin,0 mov @stRange.cpMax,-1 invoke SendMessage,hWinEdit,EM_EXSETSEL,0,addr@stRange .elseif eax==IDM_COPY invoke SendMessage,hWinEdit,WM_COPY,0,0 .elseif eax==IDM_CUT invoke SendMessage,hWinEdit,WM_CUT,0,0 .elseif eax==IDM_PASTE invoke SendMessage,hWinEdit,WM_PASTE,0,0 .elseif eax==IDM_FIND and stFind.Flags,notFR_DIALOGTERM ;FR_DIALOGTERM代表取消按鈕 invoke FindText,addrstFind .if eax mov hFindDialog,eax .endif .elseif eax==IDM_FONT invoke _ChooseFont .elseif eax==IDM_STATUSBAR xor dwOption,F_STATUSBAR ;注釋 invoke _Resize .elseif eax ==IDM_HELP invoke MessageBox,NULL,offsethelpText,offsethelpTitle,MB_OKorMB_ICONQUESTION .elseif eax==IDM_ABOUT invoke MessageBox,NULL,offsetaboutText,offsetaboutTitle,MB_OK .endif .elseif eax== idFindMessage .if stFind.Flags&FR_DIALOGTERM mov hFindDialog,0 .else invoke _FindText .endif .elseif eax== WM_ACTIVATE ;窗口激活 mov eax,wParam .if (ax== WA_CLICKACTIVE)||(ax==WA_ACTIVE) ;由鼠標點擊激活或被鼠標點擊以外辦法激活 invoke SetFocus,hWinEdit .endif .elseif eax==WM_CLOSE call _Quit .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif xor eax,eax ret _ProcWinMain ENDP;====================================================================================================_WinMainPROC local@stWndClass:WNDCLASSEX local@stMsg:MSG local@hAccelerator invokeGetModuleHandle,NULL ;得到應(yīng)用程序句柄 mov hInstance,eax invokeLoadMenu,hInstance,IDM_MAIN ;加載菜單,IDM_MAIN指定要裝入菜單資源ID mov hMenu,eax ;eax返回菜單句柄 invokeLoa
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中學(xué)學(xué)生社團活動策劃與實施制度
- 【寒假專項】人教版六年級數(shù)學(xué)上冊應(yīng)用題必考專項訓(xùn)練(含答案)
- 養(yǎng)老院健康監(jiān)測制度
- 企業(yè)員工晉升與發(fā)展制度
- 吳佩孚介紹教學(xué)課件
- 老年糖尿病患者職業(yè)適應(yīng)性評估策略-2
- 強化地板備料工崗前安全理論考核試卷含答案
- 我國上市公司治理與運作的困境剖析與革新策略
- 我國上市公司并購的財務(wù)效應(yīng)多維剖析
- 印刷設(shè)備維修工風(fēng)險評估與管理知識考核試卷含答案
- 泰康入職測評題庫及答案
- 天津市河?xùn)|區(qū)2026屆高一上數(shù)學(xué)期末考試試題含解析
- 消化內(nèi)鏡ERCP技術(shù)改良
- DB37-T6005-2026人為水土流失風(fēng)險分級評價技術(shù)規(guī)范
- 云南師大附中2026屆高三1月高考適應(yīng)性月考卷英語(六)含答案
- 2026湖北隨州農(nóng)商銀行科技研發(fā)中心第二批人員招聘9人筆試備考試題及答案解析
- 紀念館新館項目可行性研究報告
- 仁愛科普版(2024)八年級上冊英語Unit1~Unit6補全對話練習(xí)題(含答案)
- 騎行美食活動方案策劃(3篇)
- 石化企業(yè)環(huán)保培訓(xùn)課件
- 2026年呂梁職業(yè)技術(shù)學(xué)院單招職業(yè)技能考試備考試題帶答案解析
評論
0/150
提交評論