友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!阅读过程发现任何错误请告诉我们,谢谢!! 报告错误
热门书库 返回本书目录 我的书架 我的书签 TXT全本下载 进入书吧 加入书签

windows环境下32位汇编语言程序设计-第60章

按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!




                   ret

 

_SaveAs            endp

;》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

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

;》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

_OpenFile          proc

                   local  @stOF:OPENFILENAME

 

                   invoke RtlZeroMemory;addr @stOF;sizeof @stOF

                   mov    @stOF。lStructSize;sizeof @stOF

                   push   hWinMain

                   pop    @stOF。hwndOwner

                   mov    @stOF。lpstrFilter;offset szFilter

                   mov    @stOF。lpstrFile;offset szFileName

                   mov    @stOF。nMaxFile;MAX_PATH

                   mov    @stOF。Flags;OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST

                   invoke GetOpenFileName;addr @stOF

                   。if    eax

                          invoke    MessageBox;hWinMain;addr szFileName;

                                    addr szCaption;MB_OK

                   。endif

                   ret

 

_OpenFile          endp

;》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

; 选择颜色

;》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

_ChooseColor       proc

                   local  @stCC:CHOOSECOLOR

 

                   invoke RtlZeroMemory;addr @stCC;sizeof @stCC

                   mov    @stCC。lStructSize;sizeof @stCC

                   push   hWinMain

                   pop    @stCC。hwndOwner

                   push   dwBackColor

                   pop    @stCC。rgbResult

                   mov    @stCC。Flags;CC_RGBINIT or CC_FULLOPEN

                   mov    @stCC。lpCustColors;offset dwCustColors

                   invoke ChooseColor;addr @stCC

                   。if    eax

                          push  @stCC。rgbResult

                          pop   dwBackColor

                           invoke  wsprintf;addr szBuffer;addr szFormatColor;

                                dwBackColor

                          invoke MessageBox;hWinMain;addr szBuffer;

                                addr szCaption;MB_OK

                   。endif

                   ret

 

_ChooseColor       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;offset stLogFont

                   push   dwFontColor

                   pop    @stCF。rgbColors

                   mov     @stCF。Flags;CF_SCREENFONTS or CF_INITTOLOGFONTSTRUCT

                          or CF_EFFECTS

                   invoke ChooseFont;addr @stCF

                   。if    eax

                          push  @stCF。rgbColors

                          pop   dwFontColor

                          mov   eax;@stCF。iPointSize

                          shl   eax;1

                              invoke  wsprintf;addr szBuffer;addr szFormatFont;

                                addr stLogFont。lfFaceName;

                                dwFontColor;eax

                          invoke MessageBox;hWinMain;addr szBuffer;

                                addr szCaption;MB_OK

                   。endif

                   ret

 

_ChooseFont        endp

;》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

_ProcDlgMain       proc    uses ebx edi esi hWnd;wMsg;wParam;lParam

                   local   @szBuffer'128':byte

 

                   mov     eax;wMsg

                   。if     eax    WM_CLOSE

                           invoke   EndDialog;hWnd;NULL

                   。elseif eax    WM_INITDIALOG

;********************************************************************

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

;********************************************************************

                          mov   eax;hWnd

                          mov   hWinMain;eax

                          mov   stFind。hwndOwner;eax

                          mov   stFind。lStructSize;sizeof stFind



 
来源:电子工业出版社 作者:罗云彬 上一页         回书目         下一页          
上一页         回书目         下一页          
  


第8章 通用对话框


8。1 通用对话框简介(3)

    
                       mov      stFind。Flags;FR_DOWN

                       mov        stFind。lpstrFindWhat;offset szFindText

                       mov      stFind。wFindWhatLen;sizeof szFindText

                         mov       stFind。lpstrReplaceWith;offset szReplaceText

                           mov        stFind。wReplaceWithLen;sizeof szReplaceText

                       invoke     RegisterWindowMessage;addr FINDMSGSTRING

                       mov      idFindMessage;eax

               。elseif eax    WM_MAND

                       mov      eax;wParam

                       。if      ax    IDM_EXIT

                                invoke  EndDialog;hWnd;NULL

                       。elseif  ax    IDM_OPEN

                                invoke  _OpenFile

                       。elseif  ax    IDM_SAVEAS

                                invoke  _SaveAs

                       。elseif  ax    IDM_PAGESETUP

                                invoke  _PageSetup

                       。elseif  ax    IDM_FIND

                                and     stFind。Flags;not FR_DIALOGTERM

                                invoke  FindText;addr stFind

                       。elseif  ax    IDM_REPLACE

                                and     stFind。Flags;not FR_DIALOGTERM

                                invoke  ReplaceText;addr stFind

                       。elseif  ax    IDM_SELFONT

                                invoke  _ChooseFont

                       。elseif  ax    IDM_SELCOLOR

                                invoke  _ChooseColor

                       。endif

;********************************************************************

               。elseif eax    idFindMessage

                       xor      ecx;ecx

                       。if      stFind。Flags & FR_FINDNEXT

                                mov     ecx;offset szFindNext

                       。elseif  stFind。Flags & FR_REPLACE

                                mov     ecx;offset szReplace

                       。elseif  stFind。Flags & FR_REPLACEALL

                                mov     ecx;offset szReplaceAll

                       。endif

                       。if      ecx

                                invoke wsprintf;addr szBuffer;

                                        addr szFormatFind;

                                        ecx;addr szFindText;addr szReplaceText

                                invoke  MessageBox;hWinMain;addr szB
返回目录 上一页 下一页 回到顶部 0 0
未阅读完?加入书签已便下次继续阅读!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!