1 界面
用RadASM新建一个汇编项目,RichEdit模板;完成后,运行,该模板生成一个富文本编辑器的窗口;
用RadASM做如下界面;变富文本编辑器为四个;
运行一下,第一个会自动扩充其窗口大,阻挡了其余三个;
注释掉MoveWindow函数一句,再运行,如下;代码见后;
2 改变窗口标题
因为有四个编辑框,当光标移动到不同编辑框,改变窗口标题为不同;如何实现,在哪个消息中来改变?这是个问题;Petzold的书中有说吗?记不清;
下面决定用spy++工具来观察一下;
用VC++开发如下一个程序;
运行上面程序;打开spy++,搜索定位到 dddd 窗口;
从菜单中弹出消息选项对话框,在消息组中仅选中 键盘 和 鼠标 项;确定;
在 dddd 对话框中,在两个编辑框之间切换输入提示的光标,观察产生的消息是什么;
观察到产生的消息是WM_SETCURSOR;
3 error A2070
添加如下图的消息处理代码,在其他处添加相应代码;构建;出现error A2070;
不论是.if wParam==hREd1 还是 .if wParam==[hREd1 ],都不行;暂时卡住;
4 代码
rich4.Asm
.386
.model flat,stdcall
option casemap:none
include rich4.Inc
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke InitCommonControls
mov iccex.dwSize,sizeof INITCOMMONCONTROLSEX ;prepare common control structure
mov iccex.dwICC,ICC_DATE_CLASSES
invoke InitCommonControlsEx,addr iccex
invoke LoadLibrary,addr RichEditDLL
mov hRichEdDLL,eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
push eax
invoke FreeLibrary,hRichEdDLL
pop eax
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,DLGWINDOWEXTRA
push hInst
pop wc.hInstance
mov wc.hbrBackground,NULL
mov wc.lpszMenuName,IDM_MENU
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov hIcon,eax
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx,addr wc
invoke CreateDialogParam,hInstance,IDD_DLG,NULL,addr WndProc,NULL
mov hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
.while TRUE
invoke GetMessage,addr msg,NULL,0,0
.break .if !eax
invoke IsDialogMessage,hFind,addr msg
.if !eax
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endif
.endw
mov eax,msg.wParam
ret
WinMain endp
StreamInProc proc hFile:DWORD,pBuffer:DWORD,NumBytes:DWORD,pBytesRead:DWORD
invoke ReadFile,hFile,pBuffer,NumBytes,pBytesRead,0
xor eax,1
ret
StreamInProc endp
StreamOutProc proc hFile:DWORD,pBuffer:DWORD,NumBytes:DWORD,pBytesWritten:DWORD
invoke WriteFile,hFile,pBuffer,NumBytes,pBytesWritten,0
xor eax,1
ret
StreamOutProc endp
SetWinCaption proc
LOCAL buffer[sizeof AppName+3+MAX_PATH]:BYTE
LOCAL buffer1[4]:BYTE
;Add filename to windows caption
invoke lstrcpy,addr buffer,addr AppName
mov eax,' - '
mov dword ptr buffer1,eax
invoke lstrcat,addr buffer,addr buffer1
invoke lstrcat,addr buffer,addr FileName
invoke SetWindowText,hWnd,addr buffer
ret
SetWinCaption endp
SaveFile proc lpFileName:DWORD
LOCAL hFile:DWORD
LOCAL editstream:EDITSTREAM
invoke CreateFile,lpFileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
.if eax!=INVALID_HANDLE_VALUE
mov hFile,eax
;stream the text to the file
mov editstream.dwCookie,eax
mov editstream.pfnCallback,offset StreamOutProc
invoke SendMessage,hREd1,EM_STREAMOUT,SF_TEXT,addr editstream
invoke CloseHandle,hFile
;Set the modify state to false
invoke SendMessage,hREd1,EM_SETMODIFY,FALSE,0
mov eax,FALSE
.else
invoke MessageBox,hWnd,addr SaveFileFail,addr AppName,MB_OK
mov eax,TRUE
.endif
ret
SaveFile endp
SaveEditAs proc
LOCAL ofn:OPENFILENAME
LOCAL buffer[MAX_PATH]:BYTE
;Zero out the ofn struct
invoke RtlZeroMemory,addr ofn,sizeof ofn
;Setup the ofn struct
mov ofn.lStructSize,sizeof ofn
push hWnd
pop ofn.hwndOwner
push hInstance
pop ofn.hInstance
mov ofn.lpstrFilter,NULL
mov buffer[0],0
lea eax,buffer
mov ofn.lpstrFile,eax
mov ofn.nMaxFile,sizeof buffer
mov ofn.Flags,OFN_FILEMUSTEXIST or OFN_HIDEREADONLY or OFN_PATHMUSTEXIST or OFN_OVERWRITEPROMPT
mov ofn.lpstrDefExt,NULL
;Show save as dialog
invoke GetSaveFileName,addr ofn
.if eax
invoke SaveFile,addr buffer
.if !eax
;The file was saved
invoke lstrcpy,addr FileName,addr buffer
invoke SetWinCaption
mov eax,FALSE
.endif
.else
mov eax,TRUE
.endif
ret
SaveEditAs endp
SaveEdit proc
;Check if filrname is (Untitled)
invoke lstrcmp,addr FileName,addr NewFile1
.if eax
invoke SaveFile,addr FileName
.else
invoke SaveEditAs
.endif
ret
SaveEdit endp
WantToSave proc
LOCAL buffer[512]:BYTE
LOCAL buffer1[2]:BYTE
invoke SendMessage,hREd1,EM_GETMODIFY,0,0
.if eax
invoke lstrcpy,addr buffer,addr WannaSave
invoke lstrcat,addr buffer,addr FileName
mov ax,'?'
mov word ptr buffer1,ax
invoke lstrcat,addr buffer,addr buffer1
invoke MessageBox,hWnd,addr buffer,addr AppName,MB_YESNOCANCEL or MB_ICONQUESTION
.if eax==IDYES
invoke SaveEdit
.elseif eax==IDNO
mov eax,FALSE
.else
mov eax,TRUE
.endif
.endif
ret
WantToSave endp
OpenEdit proc
LOCAL ofn:OPENFILENAME
LOCAL hFile:DWORD
LOCAL editstream:EDITSTREAM
LOCAL buffer[MAX_PATH]:BYTE
LOCAL chrg:CHARRANGE
;Zero out the ofn struct
invoke RtlZeroMemory,addr ofn,sizeof ofn
;Setup the ofn struct
mov ofn.lStructSize,sizeof ofn
push hWnd
pop ofn.hwndOwner
push hInstance
pop ofn.hInstance
mov ofn.lpstrFilter,NULL
mov buffer[0],0
lea eax,buffer
mov ofn.lpstrFile,eax
mov ofn.nMaxFile,sizeof buffer
mov ofn.lpstrDefExt,NULL
mov ofn.Flags,OFN_FILEMUSTEXIST or OFN_HIDEREADONLY or OFN_PATHMUSTEXIST
;Show the Open dialog
invoke GetOpenFileName,addr ofn
.if eax
;Open the file
invoke CreateFile,addr buffer,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
.if eax!=INVALID_HANDLE_VALUE
mov hFile,eax
;Copy buffer to FileName
invoke lstrcpy,addr FileName,addr buffer
;stream the text into the richedit control
push hFile
pop editstream.dwCookie
mov editstream.pfnCallback,offset StreamInProc
invoke SendMessage,hREd1,EM_STREAMIN,SF_TEXT,addr editstream
invoke CloseHandle,hFile
invoke SendMessage,hREd1,EM_SETMODIFY,FALSE,0
mov chrg.cpMin,0
mov chrg.cpMax,0
invoke SendMessage,hREd1,EM_EXSETSEL,0,addr chrg
invoke SetWinCaption
mov eax,FALSE
.else
invoke MessageBox,hWnd,addr OpenFileFail,addr AppName,MB_OK
mov eax,TRUE
.endif
.endif
ret
OpenEdit endp
FindDlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL hCtl:DWORD
mov eax,uMsg
.if eax==WM_INITDIALOG
mov eax,hWin
mov hFind,eax
.if !lParam
;Disable replace
invoke GetDlgItem,hWin,IDC_REPLACETEXT
mov hCtl,eax
invoke GetWindowLong,hCtl,GWL_STYLE
xor eax,WS_VISIBLE
invoke SetWindowLong,hCtl,GWL_STYLE,eax
invoke GetDlgItem,hWin,IDC_REPLACESTATIC
mov hCtl,eax
invoke GetWindowLong,hCtl,GWL_STYLE
xor eax,WS_VISIBLE
invoke SetWindowLong,hCtl,GWL_STYLE,eax
invoke GetDlgItem,hWin,IDC_BTN_REPLACEALL
invoke EnableWindow,eax,FALSE
.else
invoke SetWindowText,hWin, addr Replace
.endif
.elseif eax==WM_COMMAND
mov eax,wParam
mov edx,eax
shr edx,16
and eax,0FFFFh
.if edx==BN_CLICKED
.if eax==IDOK
.elseif eax==IDCANCEL
invoke SendMessage,hWin,WM_CLOSE,NULL,NULL
.endif
.endif
.elseif eax==WM_CLOSE
mov hFind,0
invoke EndDialog,hWin,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
FindDlgProc endp
DoToolBar proc hInst:DWORD,hToolBar:HWND
LOCAL tbab:TBADDBITMAP
;Set toolbar struct size
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
;Set toolbar bitmap
push hInst
pop tbab.hInst
mov tbab.nID,IDB_TBRBMP
invoke SendMessage,hToolBar,TB_ADDBITMAP,15,addr tbab
;Set toolbar buttons
invoke SendMessage,hToolBar,TB_ADDBUTTONS,ntbrbtns,addr tbrbtns
mov eax,hToolBar
ret
DoToolBar endp
SetFormat proc hWin:DWORD
LOCAL chrg1:CHARRANGE
LOCAL chrg2:CHARRANGE
LOCAL pf:PARAFORMAT2
LOCAL cf:CHARFORMAT
LOCAL tp:DWORD
LOCAL buffer[16]:BYTE
LOCAL pt:POINT
LOCAL hDC:HDC
;Save modify state
invoke SendMessage,hWin,EM_GETMODIFY,0,0
push eax
;Save selection
invoke SendMessage,hWin,EM_EXGETSEL,0,addr chrg1
invoke SendMessage,hWin,EM_HIDESELECTION,TRUE,0
;Select all text
mov chrg2.cpMin,0
mov chrg2.cpMax,-1
invoke SendMessage,hWin,EM_EXSETSEL,0,addr chrg2
;Set font charset
mov cf.cbSize,sizeof cf
mov cf.dwMask,CFM_CHARSET or CFM_FACE or CFM_SIZE or CFM_COLOR
mov al,lfnt.lfCharSet
mov cf.bCharSet,al
mov al,lfnt.lfPitchAndFamily
mov cf.bPitchAndFamily,al
invoke lstrcpyn,addr cf.szFaceName,addr lfnt.lfFaceName,LF_FACESIZE
mov eax,lfnt.lfHeight
neg eax
mov ecx,15
mul ecx
mov cf.yHeight,eax
mov eax,rgb
mov cf.crTextColor,eax
invoke SendMessage,hWin,EM_SETCHARFORMAT,SCF_SELECTION,addr cf
;Get tab width
invoke GetDC,hWin
mov hDC,eax
invoke SelectObject,hDC,hFont
push eax
mov eax,'WWWW'
mov dword ptr buffer,eax
invoke GetTextExtentPoint32,hDC,addr buffer,4,addr pt
pop eax
invoke SelectObject,hDC,eax
invoke ReleaseDC,hWin,hDC
mov eax,pt.x
mov ecx,TabSize
mul ecx
mov ecx,15
mul ecx
shr eax,2
mov tp,eax
;Set tab stops
mov pf.cbSize,sizeof pf
mov pf.dwMask,PFM_TABSTOPS
mov pf.cTabCount,MAX_TAB_STOPS
xor eax,eax
xor edx,edx
mov ecx,MAX_TAB_STOPS
@@:
add eax,tp
mov dword ptr pf.rgxTabs[edx],eax
add edx,4
loop @b
invoke SendMessage,hWin,EM_SETPARAFORMAT,0,addr pf
;Restore modify state
pop eax
invoke SendMessage,hWin,EM_SETMODIFY,eax,0
;Restore selection
invoke SendMessage,hWin,EM_EXSETSEL,0,addr chrg1
invoke SendMessage,hWin,EM_HIDESELECTION,FALSE,0
ret
SetFormat endp
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL pt:POINT
LOCAL rect:RECT
LOCAL ht:DWORD
LOCAL hCtl:HWND
LOCAL chrg:CHARRANGE
LOCAL cf:CHOOSEFONT
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
mov fView,3
mov TabSize,4
;Set the toolbar buttons
invoke GetDlgItem,hWin,IDC_TBR
invoke DoToolBar,hInstance,eax
;Set FileName to NewFile1
invoke lstrcpy,addr FileName,addr NewFile1
invoke SetWinCaption
;Get handle of RichEdit window and give it focus
invoke GetDlgItem,hWin,IDC_RED
mov hREd1,eax
invoke SendMessage,hREd1,EM_SETTEXTMODE,0,TM_PLAINTEXT
;Set event mask
invoke SendMessage,hREd1,EM_SETEVENTMASK,0,ENM_SELCHANGE
;Set the text limit. The default is 64K
invoke SendMessage,hREd1,EM_LIMITTEXT,-1,0
;Create font
invoke lstrcpy,addr lfnt.lfFaceName,offset szFont
mov lfnt.lfHeight,-12
mov lfnt.lfWeight,400
invoke CreateFontIndirect,addr lfnt
mov hFont,eax
;Set font & format
invoke SetFormat,hREd1
;Init RichEdit
invoke SendMessage,hREd1,EM_SETMODIFY,FALSE,0
invoke SendMessage,hREd1,EM_EMPTYUNDOBUFFER,0,0
invoke SetFocus,hREd1
.elseif eax==WM_COMMAND
;Menu and toolbar has the same ID's
mov eax,wParam
and eax,0FFFFh
.if eax==IDM_FILE_NEW
invoke WantToSave
.if !eax
invoke SetWindowText,hREd1,addr szNULL
invoke lstrcpy,addr FileName,addr NewFile1
invoke SetWinCaption
.endif
invoke SetFocus,hREd1
.elseif eax==IDM_FILE_OPEN
invoke WantToSave
.if !eax
invoke OpenEdit
.endif
invoke SetFocus,hREd1
.elseif eax==IDM_FILE_SAVE
invoke SaveEdit
invoke SetFocus,hREd1
.elseif eax==IDM_FILE_SAVEAS
invoke SaveEditAs
invoke SetFocus,hREd1
.elseif eax==IDM_FILE_PRINT
.elseif eax==IDM_FILE_EXIT
invoke SendMessage,hWin,WM_CLOSE,0,0
.elseif eax==IDM_EDIT_UNDO
invoke SendMessage,hREd1,EM_UNDO,0,0
.elseif eax==IDM_EDIT_REDO
invoke SendMessage,hREd1,EM_REDO,0,0
.elseif eax==IDM_EDIT_DELETE
invoke SendMessage,hREd1,EM_REPLACESEL,TRUE,0
.elseif eax==IDM_EDIT_CUT
invoke SendMessage,hREd1,WM_CUT,0,0
.elseif eax==IDM_EDIT_COPY
invoke SendMessage,hREd1,WM_COPY,0,0
.elseif eax==IDM_EDIT_PASTE
invoke SendMessage,hREd1,WM_PASTE,0,0
.elseif eax==IDM_EDIT_SELECTALL
mov chrg.cpMin,0
mov chrg.cpMax,-1
invoke SendMessage,hREd1,EM_EXSETSEL,0,addr chrg
.elseif eax==IDM_EDIT_FIND
.if hFind==0
invoke CreateDialogParam,hInstance,IDD_FINDDLG,hWin,addr FindDlgProc,FALSE
.else
invoke SetFocus,hFind
.endif
.elseif eax==IDM_EDIT_REPLACE
.if hFind==0
invoke CreateDialogParam,hInstance,IDD_FINDDLG,hWin,addr FindDlgProc,TRUE
.else
invoke SetFocus,hFind
.endif
.elseif eax==IDM_VIEW_TOOLBAR
invoke GetDlgItem,hWin,IDC_TBR
mov hCtl,eax
xor fView,1
mov eax,fView
and eax,1
.if eax
invoke ShowWindow,hCtl,SW_SHOWNA
.else
invoke ShowWindow,hCtl,SW_HIDE
.endif
invoke SendMessage,hWin,WM_SIZE,0,0
.elseif eax==IDM_VIEW_STATUSBAR
invoke GetDlgItem,hWin,IDC_SBR
mov hCtl,eax
xor fView,2
mov eax,fView
and eax,2
.if eax
invoke ShowWindow,hCtl,SW_SHOWNA
.else
invoke ShowWindow,hCtl,SW_HIDE
.endif
invoke SendMessage,hWin,WM_SIZE,0,0
.elseif eax==IDM_OPTION_FONT
invoke RtlZeroMemory,addr cf,sizeof cf
mov cf.lStructSize,sizeof cf
mov eax,hWin
mov cf.hwndOwner,eax
mov cf.lpLogFont,offset lfnt
mov cf.Flags,CF_SCREENFONTS or CF_EFFECTS or CF_INITTOLOGFONTSTRUCT
mov eax,rgb
mov cf.rgbColors,eax
invoke ChooseFont,addr cf
.if eax
invoke DeleteObject,hFont
invoke CreateFontIndirect,addr lfnt
mov hFont,eax
mov eax,cf.rgbColors
mov rgb,eax
invoke SetFormat,hREd1
.endif
invoke SetFocus,hREd1
.elseif eax==IDM_HELP_ABOUT
invoke ShellAbout,hWin,addr AppName,addr AboutMsg,hIcon
invoke SetFocus,hREd1
.endif
.elseif eax==WM_NOTIFY
.if wParam==IDC_RED
;Auto horizontal scroll text into view
invoke GetCaretPos,addr pt
invoke GetClientRect,hREd1,addr rect
mov eax,rect.right
sub eax,pt.x
.if eax<20
;Caret near right edge
invoke SendMessage,hREd1,EM_GETSCROLLPOS,0,addr pt
add pt.x,70
invoke SendMessage,hREd1,EM_SETSCROLLPOS,0,addr pt
.endif
.endif
.elseif eax==WM_SETCURSOR
.if wParam==hREd1
invoke lstrcpy,addr FileName,addr NewFile1
invoke SetWinCaption
.endif
.if wParam==hREd2
invoke lstrcpy,addr FileName,addr NewFile2
invoke SetWinCaption
.endif
.if wParam==hREd3
invoke lstrcpy,addr FileName,addr NewFile3
invoke SetWinCaption
.endif
.if wParam==hREd4
invoke lstrcpy,addr FileName,addr NewFile4
invoke SetWinCaption
.endif
.elseif eax==WM_SIZE
mov eax,fView
and eax,1
.if eax
;Resize toolbar
invoke GetDlgItem,hWin,IDC_TBR
mov hCtl,eax
invoke MoveWindow,hCtl,0,0,0,0,TRUE
;Get height of toolbar
invoke GetWindowRect,hCtl,addr rect
mov eax,rect.bottom
sub eax,rect.top
.endif
push eax
mov eax,fView
and eax,2
.if eax
;Resize statusbar
invoke GetDlgItem,hWin,IDC_SBR
mov hCtl,eax
invoke MoveWindow,hCtl,0,0,0,0,TRUE
;Get height of statusbar
invoke GetWindowRect,hCtl,addr rect
mov eax,rect.bottom
sub eax,rect.top
.endif
push eax
;Get size of windows client area
invoke GetClientRect,hWin,addr rect
;Subtract height of statusbar from bottom
pop eax
sub rect.bottom,eax
;Add height of toolbar to top
pop eax
add rect.top,eax
;Get new height of RichEdit window
mov eax,rect.bottom
sub eax,rect.top
mov ht,eax
;Resize RichEdit window
;invoke MoveWindow,hREd1,0,rect.top,rect.right,ht,TRUE
.elseif eax==WM_CLOSE
invoke WantToSave
.if !eax
invoke DestroyWindow,hWin
.endif
.elseif eax==WM_DESTROY
invoke DeleteObject,hFont
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
end start
rich4.Inc
include windows.inc
include user32.inc
include kernel32.inc
include shell32.inc
include comctl32.inc
include comdlg32.inc
include gdi32.inc
includelib user32.lib
includelib kernel32.lib
includelib shell32.lib
includelib comctl32.lib
includelib comdlg32.lib
includelib gdi32.lib
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
;Find.dlg
IDD_FINDDLG equ 2000
IDC_FINDTEXT equ 2001
IDC_BTN_REPLACE equ 2007
IDC_REPLACETEXT equ 2002
IDC_REPLACESTATIC equ 2009
IDC_BTN_REPLACEALL equ 2008
IDC_CHK_WHOLEWORD equ 2004
IDC_CHK_MATCHCASE equ 2003
IDC_RBN_DOWN equ 2005
IDC_RBN_UP equ 2006
;rich4.dlg
IDD_DLG equ 1000
IDC_SBR equ 1003
IDC_TBR equ 1001
IDC_RED equ 1002
IDB_TBRBMP equ 1212
IDM_MENU equ 10000
;rich4.mnu
IDM_FILE_NEW equ 10001
IDM_FILE_OPEN equ 10002
IDM_FILE_SAVE equ 10003
IDM_FILE_SAVEAS equ 10004
IDM_FILE_PRINT equ 10005
IDM_FILE_EXIT equ 10006
IDM_EDIT_UNDO equ 10101
IDM_EDIT_REDO equ 10102
IDM_EDIT_DELETE equ 10103
IDM_EDIT_CUT equ 10104
IDM_EDIT_COPY equ 10105
IDM_EDIT_PASTE equ 10106
IDM_EDIT_SELECTALL equ 10107
IDM_EDIT_FIND equ 10108
IDM_EDIT_FINDNEXT equ 10110
IDM_EDIT_FINDPREV equ 10111
IDM_EDIT_REPLACE equ 10109
IDM_VIEW_TOOLBAR equ 10008
IDM_VIEW_STATUSBAR equ 10009
IDM_OPTION_FONT equ 10007
IDM_HELP_ABOUT equ 10201
.const
;structure for ToolBar buttons
tbrbtns TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <6,IDM_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <7,IDM_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <8,IDM_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <0,IDM_EDIT_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <1,IDM_EDIT_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <2,IDM_EDIT_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <3,IDM_EDIT_UNDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <4,IDM_EDIT_REDO,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <5,IDM_EDIT_DELETE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <12,IDM_EDIT_FIND,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <13,IDM_EDIT_REPLACE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
TBBUTTON <14,IDM_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0>
TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0>
;Number of buttons in tbbtns
ntbrbtns equ 18
RichEditDLL db 'riched20.dll',0
ClassName db 'DLGCLASS',0
AppName db 'RichEdit editor',0
AboutMsg db 'RadASM RichEdit editor',13,10,'KetilO (C) 2002',0
Replace db 'Replace ..',0
OpenFileFail db 'Cannot open the file',0
SaveFileFail db 'Cannot save the file',0
WannaSave db 'Want to save changes to',0Dh,0
NewFile1 db '学习1',0
NewFile2 db '工作1',0
NewFile3 db '生活1',0
NewFile4 db '计划1',0
szNULL db 0
szFont db 'Courier New',0
.data?
hRichEdDLL dd ?
hInstance dd ?
CommandLine dd ?
hIcon dd ?
hWnd HWND ?
hREd1 HWND ?
hREd2 HWND ?
hREd3 HWND ?
hREd4 HWND ?
hFind HWND ?
FileName db MAX_PATH dup(?)
;structure for DateTimePicker
iccex INITCOMMONCONTROLSEX <?>
fView dd ?
TabSize dd ?
lfnt LOGFONT <?>
hFont dd ?
rgb dd ?