|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.586
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;Indicate the instruction set
;on the right in
;Case sensitive
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;Include
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include gdi32.inc
includelib gdi32.lib
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;data segment
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IDC_MAIN equ 10000
IDR_MENU equ 10000
IDM_FILE equ 10001
IDM_OPEN equ 10002
IDM_SAVE equ 10003
IDM_SAP equ 10004
IDM_EXIT equ 10005
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
.data
szClassName db "E Note++",0
szCaptionMain db "E Note",0
editClass db "ChildWindow",0
.data?
hInstance HINSTANCE ?
hMenu dd ?
hEdit HWND ?
CommandLine LPSTR ?
.const
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;data segment
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;process
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
;--------------------------------------------------------------------------------
; 填充windows的窗口结构体
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 hInstance ; 传递程序的实例句柄给窗口类
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1 ; 创建窗口时的默认背景颜色
mov wc.lpszMenuName,NULL ; 为此窗口建立一个主菜单
mov wc.lpszClassName,OFFSET szClassName ; 窗口类的名称
invoke LoadIcon, NULL, IDC_MAIN ; 为此应用程序建立一个图标
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW ; 指定窗口上的鼠标指针类型
mov wc.hCursor,eax
;--------------------------------------------------------------------------------
; 向Windows注册一个窗口
invoke RegisterClassEx, addr wc
;***************************************************************
;create window
;***************************************************************
invoke CreateWindowEx,NULL,addr szClassName,\
addr szCaptionMain, WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\
NULL,NULL,hInstance,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 TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
.ELSEIF uMsg == WM_CREATE
; 创建一个文本编辑框
invoke CreateWindowEx, WS_EX_CLIENTEDGE, offset editClass, NULL, WS_MAXIMIZE or \
ES_AUTOHSCROLL or ES_AUTOVSCROLL or ES_MULTILINE or WS_CHILDWINDOW OR \
WS_VISIBLE OR WS_VSCROLL OR WS_HSCROLL, \
0, 0, 300, 300, hWnd, NULL, hInstance, NULL
mov hEdit, eax
invoke ShowWindow,hEdit,SW_SHOWNORMAL
invoke UpdateWindow,hEdit
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
|
|