汇编语言课程设计编写记事本_第1页
汇编语言课程设计编写记事本_第2页
汇编语言课程设计编写记事本_第3页
汇编语言课程设计编写记事本_第4页
汇编语言课程设计编写记事本_第5页
已阅读5页,还剩35页未读, 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

华北科技学院

课程设计说明书

课程名称:汇编语言

班级:计算机B08-1姓名:一

学号:——

设计题目:_______Win32编写记事本_____________

设计时间:6月23n至7月1日

指导教师:_____________________

评语:_________________________________

评阅成绩:评阅教师:

一、课程设计目的

进行程序设计方法和技能的基本训练,巩固在课堂上学到的有关程序设计的基

本知识和基本方法,通过实际动手能力的培养,进一步熟悉汇编语言的结构和

使用方法,达成能独立阅读、编制和调试一定规模的汇编语言程序的水平。

二、课程设计规定

1.规定编写并调试通过一个小型软件,实现对软件或硬件的操作。

2.遵循模块化、结构化的程序设计方法。

3.规定程序必须对的。

4.程序简明易懂,多运用输入输出提醒,犯错信息及必要的注释。

5.规定程序结构合理,语句使用得当。

6.适当追求编程技巧和程序运营效率。

三、课程设计题目:

Win32编写记事本

四、课题分析

WINDOW记事本的编写,规定能实现基本菜单框架并打开窗口,有能力的同学可

以编写进行数据录入并保存的代码

五、流程图:

六、程序源代码:

.386

.modelflat,stdcall

optioncasemap:none

includewindows,inc

includeuser32.inc

includelibuser32.1ib

includekernel32.inc

includelibkerne132.lib

includeshel!32.inc

includelibshell32.lib

includecomet132.inc

includelibconctl32.lib

includecomdlg32.inc

includelibcondlg32.1ib

ICOMAINEQUlOOOh;图标

IDMMAINEQU2023h;菜单

IDAJ1AINEQU2023h;加速键

IDM_NEWEQU2101h;新建

IDMOPENEQU2102h;打开

IDMSAVEEQU2103h;保存

1DM_SAVEASEQU2104h;另存为

IDM_EXITEQU2105h;退出

TDMUNDOEQU220Ih;撤消

IDMCUTEQU2203h;剪切

IDM_COPYEQU2204h;复制

IDMPASTEEQU2205h;粘贴

IDNLDELETEEQU2206h;删除

IDMJ'INDEQU2207h;查找

IDM_REPLACEEQU220Ah;替换

TDMSELECTALLEQU220Bh:全选

IDM_FONTEQU2301h;字体

1DMSTATUSBAREQU2401h;状态栏

IDMJELPEQU2501h;帮助主题

TDMABOUTEQU2502h;关于

IDM_MENUHELPEQU2601h:菜单信息

.data?

hlnstancedd?

hWinMaindd?

hMcnudd?

hWinStatusdd?

hWinEditdd?

hFiledd?

hFindDialogdd?

hRichEditdd?

dwFontColordd?

idFindMcssagedd?

slFindFINDREPLACE<?>

szFindTextdb100dup(?)

szReplaceTextdb100dup(?)

szFileNamedbMAX_PATHdup(?)

stLogFontLOGFONT<?>

dwOptiondd?

.data

F_STATUSBARequ0000000Ih

dllEditdb〃RichEd20.dll〃,0

errTitledb〃错误〃,0

noRichEditdb〃无法找到RichEd20.dll"

classNamedb"TextEditor”,0

captionMaindb〃文本编辑器〃,0

classEditdb,,RichEdit20A,,,0

fontFacedb〃Fixedsys〃,0

modifydb〃你已经改动过啦,要不要存一下?〃,0

filterdb"文本文献(*.txt)〃,0,〃*.txt〃,0,〃所有文献

〃,0,〃*.*〃,0,0

defExtdb"txt",0

titleFormatdb"%s-我的记事本”,0

errCreateFiledb〃咦!出现问题了!〃,0

errOpenFiledb〃咦!怎么打不开!”,0

notFounddb〃不给力啊,找不到!〃,0

noNamedb〃还没起名字〃,0

timeFormatdbz/W2d:%02d:%02dz,,0

charsFormatdb〃字节数:%d〃,0

1ineFormatdb〃行:刎〃,0

colFormatdb"列:%d〃,0

helpTitledb〃帮助〃,0

helpTextdb“Sorry!无法提供任何帮助〃,0

aboutTitledb〃关于记事本〃,0

aboutTextdb〃我的记事本〃,Oah,Odh,〃作者:李鹏飞〃,Oah,Odh,“2023年

07月01日〃,0ah,0dh,0

dwStatusWidthdd100,200,300,400,-1

dwMenuIIelpdel0,IDM_MENUHELP,0,0

FINDMSGSTRINGdb,,commdlg_FindReplace,/,0

.code

_CheckModifyStatePROC

invokeSendMessage,hWinEdit,EM_GETMODIFY,0,0

;获取控件内容是否改变的信息

.ifeax!=0

invokeMessagcBox,hWinMain,addrmodify,addrcaptionMain,\

MBYESNOCANCELorMBTCONQUESTTON

.ifeax=IDYES

callSaveFile

;有待改动

.elseifeax==IDCANCEL

moveax,FALSE

ret

.endif

.endif

moveax,TRUE

ret

_CheckModifyStateENDP

;Richedit的流出操作

StreamProcOutPROCusesebxediesidwCookie,IpBuffer,NumBytes,pBytes

invokeWriteFile,hFile,IpBuffer,NumBytes,pBytes,0

xoreax,1

;假如ReadFi1e或WriteFi1e返回11(成功),则最终eax返回0,说明操作成功

ret

_StreamProcOutENDP

;Richedit的流入操作

StreamProcTnPROCusesebxediesidwCookie,IpBuffer,NumBytes,pBytes

invokeReadFile,hFile,IpBuffer,NumBytes,pBytes,0

xoreax,1

;假如RcadFilc或虹itcFilc返回1(成功),则最终eax返回0,说明操作成功

ret

StreamProcInENDP

;设立字体和字体的颜色

_SetFontPROC_lpszl?ont,_dwFontSize,_d\\€olor

local©stCf:CHARFORMAT

invokeRtlZeroMemor5^addr@stCf,sizeof@stCf

;开始填充stCf结构

mov©stCf.cbSize,sizeof@stCf

mov@stCf.dwMask,CFMSIZEorCFMFACEorCFMBOLDorCFMCOLOR

;字段掩码,用来指定结构中哪些字段是有效的

push_dwFontSize

pop©stCf.yHeight

pushdwColor

pop@stCf.crTextColor

mov@stCf.dwEffects,0

invokeIstrcpy,addr@stCf.szFaceName,IpszFont

invokeSendMessage,hWinEdit,EM_SETTEXTMODE,1,0

;设立工作模式

invokeSendMessage,hWinEdit,EMSETCHARFORMAT,SCFALL,addr

@stCf;为控件中的所有文本设立指定的格式

ret

SetFontENDP

;查找文字

FindTextPROC

local©stFindText:FINDTEXTEX

;设立查找区域

invokeScndMcssage,hWinEdit,EMEXGE"SEL,0,addr

©stFindText.chrg

.ifstFind.Flags&FR_DOWN

;向下查找

push@stFindText.chrg.cpMax

pop©stFindText.chrg.cpMin

;将这个选择区域的结束位置用做下一次查找的起始点

.endif

mov©stFindText.chrg.cpMax,-1

;一直查找到所有文本的最后

;设立查找选项

mov@stFindText.IpstrText,offsetszFindText

movecx,stFind.Flags

andecx,FRJIATCHCASEorFR_DOWNorFRJVHOLEWORD

;查找并把光标设立到找到的文本上

invokeSendMessage,hWinEdit,ENLFIND^EXTEX,ecx,addr©stFind^ext

;ccx中存储的是搜索选项

.ifeax==-1

movecx,hWinMain

.ifhFindDialog

movecx,hFindDialog

.endif

invokeMessageBox,ecx,addrnotl?ound,NULL,MB_OKor

MB_ICONINFORMATION

ret

.endif

;找到文本以后,文本的位置在FINDTEXTEX结构的chrgText字段中返

回,chrgToxt字段是一个CHARRANGE结构,直接在EM_EXSETSEL消息中使用它将选

择区域设立到找到的文字上

invokeSendMessage,hWinEdit,EMEXSETSEL,0,addr

©stFindText.chrgText

invokeSendMessage,hWinEdit,EM_SCROLLCARET,NULL,NULL

;卷动文字,以便找到的文本可以出现在用户的视野中

ret

_FindTextENDP

;保存文献,假如没有打开或创建文献则另存为

_SaveFilePROC

local@stES:EDITSTREAM

.if!hFile

call_SaveAs

.if!eax

ret

.endif

.endif

mov@stES.dwCookie,FALSE

;在百2001近的流操作中写文献

mov@stES.dwError,NULL

mov@stES.pfnCallback,offset_StreamProcOut

;回调函数

invokeSendMessage,hWinEdit,EMSTREAMOUT,SFTEXT,addr@stES

;流出操作,文本格式是简朴的文本格式

invokeSendMessage,hWinEdit,EM_SETMODIFY,FALSE,0

;设立修改状态

moveax,TRUE

ret

_SaveFileENDP

;另存为

_SaveAsPROC

local©stOF:OPENFILENAME

local@stEs:EDITSTREAM

invokeRtIZeroMemory,addr@stOF,sizeof@stOF

;显示〃保存文献〃对话框

;填充slOF结构

mov@stOF.IStructSize,sizeof@stOF

pushhWinMain

pop@stOF.hwndOwner

;所属窗口

mov@stOF.IpstrFilter,offsetfilter

;指定文献名筛选字符串

mov@stOF.IpstrFile,offsetszFileName

mov©stOKnMaxFile,MAX_PATII

;指定IpstrFi”参数指向的缓冲区的长度,260

mov@stOF.Flags,OFN_PATHML-STEXIST

;途径必须存在

mov©stOF.IpstrDefExt,offsetdefExt

;默认扩展名

mov@stOF.IpstrTitle,NULL

;标题为“另存为”

invokeGetSavcFileNamc,addr@stOF

.ifeax

;创建新文献

invokeCreateFile,addrszFileName,GENERIC_READor

GENERICJVRITE,\;存取方式:为读写

FILESHAREREAD,\

;共享属性:允许其他进程同时以读方式打开文献

0,\

;安全属性:无法被继承

CREATE_ALWAYS,\

;创建新文献,假如文献己经存在则清除原文献

FILE_ATTRIBUTE_NORMAL,\

;文献属性:普通文献

0

;文献模板句柄

.ifeax!=INVALID_HANDLE_VALUE

pusheax

.ifhFile

;有打开的文献

invokeCloseHandle,hFile

.endif

popeax

;保存文献

movhFile,eax

;文献句柄

call_SaveFile

call_SetCaption

call_SetStatus

moveax,TRUE

ret

.else

invokeMessageBox,hWinMain,addr

errCreateFile,NULL,MB_OKorMB_ICONERROR

.endif

.endif

moveax,FALSE

ret

_SaveAsENDP

;打开及输入文献

_0penFilePROC

local©stOF:OPENFILENAME

local©stES:EDITSTREAM

invokeRtIZeroMemory,addr@stOF,sizeof@stOF

;显示“打开文献”对话框

mov@stOF.IStructSize,sizeof@stOF

pushhWinMain

pop@stOF.hwndOwner

mov@stOF.IpstrFilter,offsetfilter

mov@stOF.IpstrFile,offsetszFileName

mov@stOF.nMaxFile,MAX_PATH

mov@stOF.Flags,OFN_FILEMUSTEXISTorOFN_PATHMUSTEXIST

;文献必须存在

invokeGetOpenFi1eName,addr@stOF

.ifeax

;创建文献

invokeCreateFile,addrszFileName,GENERICREADor

GENERICWRITE,\

FILE_SHARE_READ,0,OPEN_EXIST:NG,FILE_ATTRIBUTE_NORMAL,0

;打开存在的文献,当文献不存在时函数会返回失败

.ifeax=INVALIDHANDLEVALUE

invokeMessageBox,hWinMain,addrerrOpenFile,NULL,MB_OK

orMB_1CONSTOP

ret

.endif

pusheax

.ifhFile

invokeCloscHandle,hFile

.endif

popeax

movhFile,eax

;读入文献

mov@stES.dwCookie,TRUE

;在所所鼠"的流操作中读文献

mov@stES.dwError,NULL

mov©stES.pfnCallback,offset_StrcamProcIn

invokeSendMessage,hWinEdit,EM_STREAMIN,SF_TEXT,addr@stES

;流入操作,文本格式是简朴的文本格式

invokeSendMessage,hWinEdit,EMSETMODIFY,FALSE,0

;设立修改状态

call_SetCaption

call_SetStatus

.endif

ret

_0penFileENDP

;选择字体

_ChooseFontPROC

local@stCF:CHOOSEFONT

invokeRtlZeroMemor5^addr@stCF,sizeof@stCF

mov@stCF.IStructSize,sizeof@stCF

pushhWinMain

pop@stCF.hwndOwner

mov@stCF.IpLogFont,offsetstLogFont

;指定字体的名称和属性

pushdwFontColor

pop@stCF.rgbColors

mov@stCF.Flags,CF_SCREENFONTSorCF_INITTOLOGFONTSTRUCTor

CF_EFFECTS;字体列表中只显示屏幕字体,对话框中显示“效果”复选框

invokeChooseFont,addr@stCF

.ifeax

push@stCF.rgbColors

popdwFontColor

moveax,@stCF.:iPointSize

;用户选择的字体大小,单位是1/10磅

shleax,1

invoke_SctFont,addr

stLogFont.1fFaceName,eax,@stCF.rgbColors

.endif

ret

ChooseFontENDP

;设立标题栏的显示内容

SetCaptionPROC

local@szBuffer[1024]:byte

.ifszFilcNamc

;假如当前是某一文献,则显示文献名

moveax,offsetszFileName

.else

moveax,offsetnoName

;否则显示未命名

.endif

invokewsprintf,addr©szBuffer,addrtitleFormat,eax

invokeSetWindowText,hWinMain,addr^szBuffer

ret

SetCaptionENDP

;设立菜单项,状态栏的状态和信息

SetStatusPROC

local©stRange:CHARRANGE

local@dwLines,@dwLine,©dwLineStart

local@szBuffer[256]:byte

local@stST:SYSTEMTIME

;在状态栏显示行列信息

invokeGetWindowTextLength,hWinEdit

invokewsprintf,addr©szBuffer,addrcharsFormat,eax

invokeSendMessage,hWinStatus,SB_SE7TEXT,2,addr©szBuffer

;总字节数

invokeSendMessage,hWinEdit,EMEXGETSEL,0,addr@stRange

;获取选定区域

invokeSendMessage,hWinEdit,EM_EXLINEFROMCHAR,0,-1

;得知指定的字符位于哪一行中

mov@dwLine,eax

invokeSendMessage,hWinEdit,EMLTNE'NDEX,eax,0

;获取指定行的起始字符的位置

movecx,@stRange.cpMin

subecx,eax

incecx

;显示给用户的列号从1开始编号

invokewsprintf,addr©szBuffer,addrcoll?ormat,ecx

invokeSendMessage,hWinStatus,SB_SETTEXT,1,addr@szBuffer

;光标所在位置的列

inc@dwLine

;显示给用户的行号•从1开始

invokewsprintf,addr@szBuffer,addrlincFormat,@dwLinc

invokeSendMessage,hWinStatus,SBSE^TEXT,0,addr@szBuffer

;光标所在位置的行

;根据情况改变菜单项的状态

moveax,©stRange.cpMin

.ifeax==@stRange.cpMax

;选中区域为空则复制粘贴删除不可用

invokeEnab1eMenuItem,hMenu,IDMCOPY,MFGRAYED

invokeEnab1eMenuItem,hMenu,1DM_CUT,MF_GRAYED

.else

invokeEnableMenuTtem,hMenu,TDMCOPY,MFENABLED

invokeEnab1eMenuItem,hMenu,IDM_CUT,MF_ENABLED

.endif

invokeTsClipboardFormatAvailable,CFTEXT

;判断剪贴板的格式是否是文本格式

.ifeax

;假如剪贴板有内容则可以粘贴

invokeEnab1eMenuItem,hMenu,IDMPASTE,MFENABLED

.else

invokeEnab1eMenuItem,hMenu,IDM_PASTE,MF_GRAYED

.endif

invokeGetWindowTextLength,hWinEdit

.ifeax

;假如可以全选

invokeEnab1eMenuItem,hMenu,IDM_SELECTALL,MF_ENABLED

.else

invokeEnab1eMenuItem,hMenu,JDMSELECTALI,,MFGRAYED

.endif

invokeSendMessage,hWinEdit,EM_GETMODIFY,0,0

.ifeax

;假如可以保存

invokeEnab1eMenuItem,hMenu,1DM_SAVE,MF_ENABLED

.else

invokeEnableMenuTtem,hMenu,TDMSAVE,MFGRAYED

.endif

.ifdwOption&F_STATUSBAR

;假如选中了状态栏

invokeCheckMenuItem,hMenu,IDM_STATUSBAR,MF_CHECKED

.else

invokeChcckMcnuItem,hMcnu,IDM_STATUSBAR,MF_UNCHECKED

.endif

ret

SctStatusENDP

ResizePROC

local@stRect:RECT

local@stRectTemp:RECT

local©dwWidth,©dwlleight

;取得窗口客户区的大小

invokeGetCllentRect,hWinMain,addr@stRect

moveax,@stRect.right

subeax,OstRect.left

mov©dwWidth,eax

moveax,@stRect.bottom

subeax,@stRect.top

mov©dwHeight,eax

;计算及调整状态栏

.ifdwOption&F_STATUSBAR

invokeShowWindow,hWinStatus,SWSHOW

invokeMoveWindow,hWinStatus,0,0,0,0,TRUE

invokeGetWindowRect,hWinStatus,addr©stRectTemp

moveax,@stRectTcmp.bottom

subeax,@stRectTemp.top

sub©dwlleight,eax

.else

invokeShowWindow,hWinStatus,SWHIDE

.endif

;调整Richcdit控件位置

invoke

MoveWindow,hWinEdit,©stRect.left,@stRect.top,@dwWidth,©dwlleight,T

RUE

ret

_ResizeENDP

QuitPROC

invokeCheckModifyState

.ifeax

invokeDestroyWindow,hWinMain

invokePostQuiiMessage,NULL

;产生一条WM_QUIT消息

.ifhFile

;假如有打开的文献则关闭

invokeCloseHandle,hFile

.endif

.endif

invokeKillTimer,hWinMain,1

;取消定期器

ret

QuitENDP

_CreatcWindowPROC

;注册“查找”对话框消息,初始化“查找”对话框的结构

movstFind.IStructSize,sizeofstFind

;结构的长度

pushhWinMain

popstFind.hwndOwner

;指定所属窗口

movstFind.Flags,FR_DOWN

;把“方向”单选钮设立为“向下”

movstFind.IpstrFindWhat,offsetszFindText

;IpstrFindWhat指向包含查找字符串的指针

movstFind.wFindWhatLen,sizeofszFindText

;wFindWhatLcn指示IpstrFindWhat缓存区的长度

movstFind.IpstrReplaceWith,offsetszReplaceText

;指向包含替换为字符串的指针

movstFind.wReplaceWithLen,sizeofszReplaceText

;IpstrReplaceWith缓存区的长度

invokeRegisterWindowMessage,addrFZNDMSGSTRING

;注册自定义的消息

movidFindMessage,eax

;eax中返回消息TD

;建立状态栏

invokeCreatcStatusWindow,SBARS_SIZEGRIPorWS_CHILDor

WS_VISTBLE,\;显示状态栏右下角的斜条

NULL,hWinMain,2

;父窗口为hWinMain,状态栏控件的ID为2,初始化字符串为NULL

movhWinStatus,eax

invokeSendMessage,hWinStatus,SBSETPARTS,5,offset

dwStatusWidth;提成四栏

;建立输出文本窗口

invokeCreateWindowEx,WSEXCLTENTEDGE,offsetclassEdit,NULL,\

;客户区立体边框

WS_CH:LDORWS_VISIBLEORWS_VSCROLLORWS_HSCROLL\

ORES_MULTILINEorES_NOHIDESEL,\

;可以编辑多行文字,失去键盘输入焦点的时候仍然显示选择区域

0,0,0,0,\

hWinMain,0,hlnstance,NULL

;0指定的是子窗口的ID号

movhWinEdit,eax

ordwOption,F_STATUSBAR

;注释

invokeSetCaption

;设立标题

invokeSetStatus

;设立状态栏

invokeSetFont,addrfontFace,9*20,0

;注释

;在使用多行Edit控件时,父窗口发送EM.SETEVENTMASK消息给

RichEdit控件,指定它对哪些消息感爱好

;wParam必须为0,ENMCHANGE发送ENCHANGE告知NMSELCHANGE发

送EN_SELCHANGE告知

invokeSendMessage,hWinEdit,EM_SETEVENTMASK,0,ENM_CHANGEor

ENM_SELCHANGEorENMJIOUSEEVENTS

invokeSendMessage,hWinEdit,EMEXLIMTTTEXT,0,-1

;设立控件中口,以容纳字符的总数,OFFFFFFFFh(T)字节

invokeSendMessage,hWinMain,EM_EMPTVUNDOBUFFER,0,0

;清空undo,redo队列

ret

GreateWindowENDP

;窗口过程

ProcWinMainPROCusescbxcdiesihWnd,uMsg,wParam,1Param

local@stRange:CHARRANGE

local@stST:SYSTEMTIME

local@szBuffer[128]:byte

local@pt:POINT

localhPopup:DWORD

local@stES:EDITSTREAM

moveax,uMsg

.ifeax==WMCREATE

pushhWnd

pophWinMain

invoke_CrcateWindow

invokeSetTimer,hWinMain,1,300,NULL

;设立定期器

.elseifeax==WM_DROPFILES

;拖放文献

call_CheckModifyState

.ifeax=FALSE

call_SaveFile

.endif

invokeDragQueryFile,wParam,0,addrszFileName,128

;获取文献的途径

invokeCreatcFilc,addrszFileNamc,GENERICREADor

GENERICWRITE,\

FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0;打开

文献

movhFile,eax

mov@stES.dwCookie,TRUE

;在版(±嵬"的流操作中读文献

mov©stES.dwError,NULL

mov@stES.pfnCalIback,offsetStreamProcIn

invokeSendMessage,hWinEdit,EM_STREAMIN,SF_TEXT,addr@stES

;流入操作,文本格式是简朴的文本格式

invokeSendMessage,hWinEdit,EM_SETMODIFY,FALSE,0

;设立修改状态

call_SetCaption

call_SetStatus

.elseifcax==W\1_TIMER

invokeGetLocalTime,addr@stST

movzxeax,@stST.wllour

movzxebx,©stST.wMinute

movzxecx,@stST.wSecond

invokewsprintf,addr@szBuffer,addrtimeFormat,eax,ebx,ecx

invokeSendMessage,hWinStatus,SB_SETTEXT,3,addr©szBuffer

.elseifeax==WM_SIZE

invokeResize

.elseifeax=WM_NOTIFY

moveax,1Param

moveax,[eax+NMHDR.hwndFrom]

.ifeax==hWinEdit

invoke_SetStatus

.endif

pushesi

movesi,1Param

assumeesi:ptrNMHDR

.if[esi],code==ENJ1SGFILTER

;鼠标滑轮发送的消息

assumeesi:ptrMSGFTLTER

.if[esi].msg=WM_RBUTTONDOWN

invokeGetMenu,hWinMain

;获取窗口主菜单句柄

invokeGetSubMenu,eax,1

;获取弹出式子菜单的句柄

movhPopup,eax

invokeSetStatus

movedx,[esi].1Param

;位置信息

movecx,edx

andedx,OFFFFh

shrecx,16

mov@pt.x,edx

mov@pt.y,ecx

invokeClientToScreen,hWinMain,addr@pt

invokeTrackPopupMenu,hPopup,TPM_LEFTALIGNor

TPM_BOTTOMALIGN,@pt.x,©pt.y,NULL,hWinMain,NULL

.cndif

.endif

popesi

.elseifeax==WM_MENUSELECT

invoke

MenuHelp,WMMENUSELECT,wParam,1Param,1Param,hTnstance,hWinStalus,

offsetdwMenuHelp

.elseifeax==WM_COMMAND

movcax,wParam

movzxeax,ax

.ifeax=IDMOPEN

invokeCheckModifyState

.ifeax

;eax=TRIE说明没有被修改

call_0penFile

.endif

.elseifeax==IDM.NEW

invoke_CheckModifyState

.ifeax

,ifhFile

invokeCloseHandle,hFile

movhFile,0

.endif

movszFileName,0

invokeSetWindowText,hWinEdit,NULL

invokeSetCaption

invoke_SetStatus

.endif

.elseifeax=TDMSAVE

call_SaveFile

.elseifeax==IDM_SAVEAS

call_SavcAs

.elseifeax=IDM_EXIT

callQuit

.elseifeax==IDMUNDO

invokeSendMessage,hWinEdit,EMUNDO,0,0

.elseifeax==IDM_SELECTALL

mov@stRange.cpMin,0

mov©stRangc.cpMax,-1

invokeSendMessage,hWinEdit,EMEXSETSEL,0,addr©stRange

.elseifeax=IDM_COPY

invokeSendMessage,hWinEdit,WM_COPY,0,0

.elseifeax==IDM_CUT

invokeSendMessage,hWinEdit,WMCUT,0,0

.elseifeax==IDM_PASTE

invokeSendMessage,hWinEdit,VMPASTE,0,0

.elseifeax==IDM_FIND

andstFind.Flags,notFRDTALOGTERM

;FR_DIALOGTERM代表取消按钮

invokeFindText,addrstFind

.ifeax

movhFindDialog,eax

.endif

.elseifeax==IDM_FONT

invoke_ChooseFont

.elseifeax=IDM_STATUSBAR

xordwOption,F_STATUSBAI?

;注释

invokeResize

.elseifeax==IDM_HELP

invokeMessageBox,NULL,offsethelpText,offset

hclpTitle,MB_OKorMB_ICONQUESTION

.elseifeax=TDMABOUT

invokeMessageBox,NULL,offsetaboutText,offset

aboutTitle,MBOK

.endif

.elseifeax二二idFindMessage

.ifstFind.Flags&FR_DIALOGTERM

movhFindDialog,0

.else

invokeFindText

.endif

.elseifeax==WM_ACTIVATE

;窗口激活

moveax,wParam

.if(ax=WA_CLICKACTIVE)||(ax=WA_ACTIVE)

;由鼠标点击激活或被鼠标点击以外的方法激活

invokeSetFocus,hWinEdit

.endif

.elseifeax==WMCLOSE

callQuit

.else

invokeDefWindowProc,hWnd,uMsg,wParam,1Param

ret

.endif

xoreax,eax

ret

ProcWinMainENDP

_WinMainPROC

local@stWndClass:WNDCLASSEX

local@stMsg:MSG

local@hAccelerator

invokeGetModuleHandle,NULI,;得到

应用程序的句柄

movhlnstance,eax

invokeLoadMcnu,hlnstance,IDMMAIN;加载

菜单,IDM_MAIN指定要装入的菜单资源ID

movhMenu,eax;eax返回

菜单句柄

invokeLoadAccelerators,hlnstance,IDAMAIN;

加载加速键

mov©hAccelerator,eax

;注册窗口类

;注册窗口之前,先填充传递给RegisterClassEx函数的结构体参数,指

定窗口的属性

invokeRtlZeroMemory,addr©stWndClass,sizeof@stWndClass

;把$113也1a$$变量初始化为0

invokeLoadIcon,hlnstance,IC0_MAIN

mov@stWndClass.hlcon,eax;指定

显示在窗口标题栏左上角的图标

mov@stWndClass.hlconSm,eax

invokeLoadCursor,0,IDCARROW

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论