还有一个问题,接上个关于罗云彬书9.2
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include<resource.h>
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#defineICO_MAIN1000
#defineDLG_MAIN1000
#defineIDM_MAIN1000
#defineIDM_OPEN1101
#defineIDM_SAVEAS1102
#defineIDM_PAGESETUP1103
#defineIDM_EXIT1104
#defineIDM_FIND1201
#defineIDM_REPLACE1202
#defineIDM_SELFONT1203
#defineIDM_SELCOLOR1204
#defineIDM_MENUOPTION1300
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAINICON"Main.ico"
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_MAIN DIALOG 150, 180, 250, 130
MENU IDM_MAIN
STYLE DS_MODALFRAME | WS_POPUP |WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "状态栏示例"
FONT 9, "宋体"
{
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IDM_MAINmenudiscardable
BEGIN
popup"文件(&F)"
BEGIN
menuitem"打开文件(&O)...",IDM_OPEN
menuitem"文件另存为(&C)...",IDM_SAVEAS
menuitemseparator
menuitem"页面设置(&P)...",IDM_PAGESETUP
menuitemseparator
menuitem"退出(&X)",IDM_EXIT
END
popup"查看(&V)"
BEGIN
menuitem"查找字符串(&S)...",IDM_FIND
menuitem"替换字符串(&R)...",IDM_REPLACE
menuitemseparator
menuitem"选择字体(&F)...",IDM_SELFONT
menuitem"选择颜色(&B)...",IDM_SELCOLOR
END
END
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
stringtablediscardable
BEGIN
IDM_MENUOPTION "包含文件操作的命令"
IDM_MENUOPTION+1"包含操作视图的命令"
IDM_OPEN"打开需要编辑的文件"
IDM_SAVEAS"以另外一个文件名保存文件"
IDM_PAGESETUP"选择打印机以及设置页边距、纸张大小等打印参数"
IDM_EXIT"退出本程序"
IDM_FIND"在窗口中搜索文字"
IDM_REPLACE"在窗口中搜索文字并替换"
IDM_SELFONT"选择窗口中文字使用的字体"
IDM_SELCOLOR "选择窗口的背景颜色"
END
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
includewindows.inc
includeuser32.inc
includelibuser32.lib
includekernel32.inc
includelibkernel32.lib
includeComctl32.inc
includelibComctl32.lib
ICO_MAINequ1000
DLG_MAINequ1000
IDM_MAINequ1000
IDM_OPENequ1001
IDM_SAVEASequ1002
IDM_PAGESETUPequ1003
IDM_EXITequ 1004
IDM_FINDequ1005
IDM_REPLACEequ1006
IDM_SELFONTequ1007
IDM_SELCOLORequ1008
IDM_MENUOPTIONequ1009
ID_STATUSBARequ1
ID_EDITequ2
.data?
hInstancedd?
hWinMaindd?
hWinStatusdd?
hWinEditdd?
lpsz1dd?
lpsz2dd?
.const
szClassdb'EDIT',0
szFormat0db'%02d:%02d:%02d',0
;szBufferSizeTdb'left=%d,top=%d,right=%d,bottom=%d',0
szBufferSizeT1db'eax=%d,ecx=%d',0
szFormat1db'字节数:%d',0
sz1db'插入',0
sz2db'改写',0
dwStatusWidthdd60,140,172,-1
dwMenuHelpdd0,IDM_MENUOPTION,0,0
;szStatusTextdb'状态栏',0
.code
_Resizeproc
local@stRect:RECT,@stRect1:RECT
local@szBufferSize[128]:byte
invokeMoveWindow,hWinStatus,0,0,0,0,TRUE
invokeGetWindowRect,hWinStatus,addr @stRect
invokeGetClientRect,hWinMain,addr @stRect1
movecx,@stRect1.right
subecx,@stRect1.left
moveax,@stRect1.bottom
subeax,@stRect1.top
subeax,@stRect.bottom
addeax,@stRect.top
invokeMoveWindow,hWinEdit,0,0,ecx,eax,TRUE
ret
_Resizeendp
_ProcDlgMainprocuses ebx esi edi hWnd,wMsg,wParam,lParam
local@szBuffer[128]:byte
local@stST:SYSTEMTIME
local@stPoint:POINT,@stRect:RECT
local@szBufferSize[128]:byte
moveax,wMsg
.ifeax == WM_TIMER
invokeGetLocalTime,addr @stST
movzxeax,@stST.wHour
movzxebx,@stST.wMinute
movzxecx,@stST.wSecond
invokewsprintf,addr @szBuffer,addr szFormat0,\
eax,ebx,ecx
invokeSendMessage,hWinStatus,SB_SETTEXT,\
0,addr @szBuffer
.elseifeax == WM_CLOSE
invokeKillTimer,hWnd,1
invokeEndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
moveax,hWnd
mov hWinMain,eax
invokeCreateStatusWindow,WS_CHILD OR WS_VISIBLE OR\
SBARS_SIZEGRIP,NULL,hWinMain,ID_STATUSBAR
movhWinStatus,eax
invokeSendMessage,hWinStatus,SB_SETPARTS,\
4,offset dwStatusWidth
movlpsz1,offset sz1
movlpsz2,offset sz2
invokeSendMessage,hWinStatus,SB_SETTEXT,2,lpsz1
invokeCreateWindowEx,WS_EX_CLIENTEDGE,\
addr szClass,NULL,WS_CHILD or WS_VISIBLE or\
ES_MULTILINE or ES_WANTRETURN or WS_VSCROLL or\
ES_AUTOHSCROLL,0,0,0,0,hWnd,ID_EDIT,hInstance,NULL
movhWinEdit,eax
call_Resize
invokeSetTimer,hWnd,1,300,NULL
.elseifeax == WM_COMMAND
MOVeax,wParam
.ifax == IDM_EXIT
invokeEndDialog,hWnd,NULL
.elseifax == ID_EDIT
invokeGetWindowTextLength,hWinEdit
invokewsprintf,addr @szBuffer,addr szFormat1,eax
invokeSendMessage,hWinStatus,SB_SETTEXT,\
1,addr @szBuffer
.endif
.elseifeax == WM_MENUSELECT
invokeMenuHelp,WM_MENUSELECT,wParam,lParam,lParam,\
hInstance,hWinStatus,offset dwMenuHelp
.elseifeax == WM_SIZE
;call_Resize
invoke_Resize
.elseif eax == WM_NOTIFY
.ifwParam == ID_STATUSBAR
moveax,lParam
moveax,[eax+NMHDR.code]
.ifeax == NM_CLICK
invokeGetCursorPos,addr @stPoint
invokeGetWindowRect,hWinStatus,addr @stRect
moveax,@stRect.left
movecx,eax
addeax,140
addecx,172
.if(@stPoint.x>=eax)&&(@stPoint.x<=ecx)
moveax,lpsz1
xchgeax,lpsz2
movlpsz1,eax
invokeSendMessage,hWinStatus,SB_SETTEXT,2,lpsz1
.endif
.endif
.endif
.else
mov eax,FALSE
ret
.endif
moveax,TRUE
ret
_ProcDlgMainendp
start:
invokeInitCommonControls ;首先将通用空间库加载进内存
invokeGetModuleHandle,NULL
movhInstance,eax
invokeDialogBoxParam,hInstance,DLG_MAIN,NULL,\ ;创建模态对话框,非模态对话框时CreateDialogParam
offset _ProcDlgMain,NULL
invokeExitProcess,NULL
endstart