iczelion tut35[3]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

example

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\gdi32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

winmain proto :dword,:dword,:dword,:dword

wordinfo struct
	wordlen dd ?		; the length of the word: used as a quick comparison
	pszword dd ?		; pointer to the word
	pcolor dd ?		; point to the dword that contains the color used to hilite the word
	nextlink dd ?		; point to the next wordinfo structure
wordinfo ends

.const
idr_mainmenu                   equ 101
idm_open                      equ  40001
idm_save                       equ 40002
idm_close                      equ 40003
idm_saveas                     equ 40004
idm_exit                       equ 40005
idm_copy                      equ  40006
idm_cut                       equ  40007
idm_paste                      equ 40008
idm_delete                     equ 40009
idm_selectall                  equ 40010
idm_option 			equ 40011
idm_undo			equ 40012
idm_redo			equ 40013
idd_optiondlg                  equ 101
idc_backcolorbox               equ 1000
idc_textcolorbox               equ 1001
idr_mainaccel                 equ  105
idd_finddlg                    equ 102
idd_gotodlg                    equ 103
idd_replacedlg                 equ 104
idc_findedit                  equ  1000
idc_matchcase                  equ 1001
idc_replaceedit                 equ 1001
idc_wholeword                  equ 1002
idc_down                       equ 1003
idc_up                       equ   1004
idc_lineno                   equ   1005
idm_find                       equ 40014
idm_findnext                  equ  40015
idm_replace                     equ 40016
idm_gotoline                   equ 40017
idm_findprev                  equ  40018
richeditid 			equ 300

.data
classname db "iczeditclass",0
appname  db "iczedit version 3.0",0
richeditdll db "riched20.dll",0
richeditclass db "richedit20a",0
norichedit db "cannot find riched20.dll",0
asmfilterstring 		db "asm source code (*.asm)",0,"*.asm",0
				db "all files (*.*)",0,"*.*",0,0
openfilefail db "cannot open the file",0
wannasave db "the data in the control is modified. want to save it?",0
fileopened dd false
backgroundcolor dd 0ffffffh		; default to white
textcolor dd 0		; default to black
wordfilename db "\wordfile.txt",0
asmsection db "assembly",0
c1key db "c1",0
c2key db "c2",0
c3key db "c3",0
c4key db "c4",0
c5key db "c5",0
c6key db "c6",0
c7key db "c7",0
c8key db "c8",0
c9key db "c9",0
c10key db "c10",0
zerostring db 0
asmcolorarray dd 0ff0000h,0805f50h,0ffh,666f00h,44f0h,5f8754h,4 dup(0ff0000h)
commentcolor dd 808000h

.data?
hinstance dd ?
hrichedit dd ?
hwndrichedit dd ?
filename db 256 dup(?)
alternatefilename db 256 dup(?)
customcolors dd 16 dup(?)
findbuffer db 256 dup(?)
replacebuffer db 256 dup(?)
uflags dd ?
findtext findtextex <>
asmsyntaxarray dd 256 dup(?)
hsearch dd ?		; handle to the search/replace dialog box
haccel dd ?
hmainheap dd ?		; heap handle
oldwndproc dd ?
richeditversion dd ?

.code
start:
	mov byte ptr [findbuffer],0
	mov byte ptr [replacebuffer],0
	invoke getmodulehandle, null
	mov    hinstance,eax
	invoke loadlibrary,addr richeditdll
	.if eax!=0
		mov hrichedit,eax
		invoke getprocessheap
		mov hmainheap,eax
		call fillhiliteinfo
		invoke winmain, hinstance,0,0, sw_showdefault
		invoke freelibrary,hrichedit
	.else
		invoke messagebox,0,addr norichedit,addr appname,mb_ok or mb_iconerror
	.endif
	invoke exitprocess,eax
	
winmain proc hinst:dword,hprevinst:dword,cmdline:dword,cmdshow:dword
	local wc:wndclassex
	local msg:msg
	local hwnd:dword
	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,null
	push  hinst
	pop   wc.hinstance
	mov   wc.hbrbackground,color_window+1
	mov   wc.lpszmenuname,idr_mainmenu
	mov   wc.lpszclassname,offset classname
	invoke loadicon,null,idi_application
	mov   wc.hicon,eax
	mov   wc.hiconsm,eax
	invoke loadcursor,null,idc_arrow
	mov   wc.hcursor,eax
	invoke registerclassex, addr wc
	invoke createwindowex,null,addr classname,addr appname,           ws_overlappedwindow,cw_usedefault,           cw_usedefault,cw_usedefault,cw_usedefault,null,null,           hinst,null
	mov   hwnd,eax
	invoke showwindow, hwnd,sw_shownormal
	invoke updatewindow, hwnd
	invoke loadaccelerators,hinstance,idr_mainaccel
	mov haccel,eax
	.while true
		invoke getmessage, addr msg,0,0,0
		.break .if (!eax)
		invoke isdialogmessage,hsearch,addr msg
		.if eax==false

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top