|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 xing59741 于 2012-7-26 22:40 编辑
版本学习列子.asm
======================================
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat, stdcall
option casemap :none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Equ 等值定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAIN equ 1000h ;图标
DLG_MAIN equ 2000h ;对话框资源
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hInstance dd ?
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax == WM_CLOSE ;关闭对话框窗口所作操作
invoke EndDialog,hWnd,NULL ;结束对话框窗口
.elseif eax == WM_INITDIALOG ;在对话框窗口还没有显现出来就处理的消息
invoke LoadIcon,hInstance,ICO_MAIN ;载入图标返回句柄
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax ;发送消息到对话框过程来设置菜单图标
.elseif eax == WM_COMMAND
mov eax,wParam ;wParam存储了菜单命令
movzx eax,ax
.if eax == IDOK ;如果按下了OK按钮
invoke EndDialog,hWnd,NULL ;结束对话框窗口
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL ;创建模态对话框
;函数从hInstance模块装载DLG_MAIN的资源
;父窗口就是本身,对话框过程是_ProcDlgMain
;dwInitParam是当做WM_INITDIALOG消息的lParam传给对话框过程,用来自定义消息
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
版本学习列子.inc
=====================================================
/******************************************
//版本头文件
******************************************/
#define VS_VERSION_INFO 1
#define VS_USER_DEFINED 100
#define VS_FFI_SIGNATURE 0x0FEEF04BD
#define VS_FFI_STRUCVERSION 0x10000
#define VS_FFI_FILEFLAGSMASK 0x3F
#define VS_FF_DEBUG 1
#define VS_FF_PRERELEASE 2
#define VS_FF_PATCHED 4
#define VS_FF_PRIVATEBUILD 8
#define VS_FF_INFOINFERRED 0x10
#define VS_FF_SPECIALBUILD 0x20
#define VOS_UNKNOWN 0
#define VOS_DOS 0x10000
#define VOS_OS216 0x20000
#define VOS_OS232 0x30000
#define VOS_NT 0x40000
#define VOS_BASE 0
#define VOS_WINDOWS16 1
#define VOS_PM16 2
#define VOS_PM32 3
#define VOS_WINDOWS32 4
#define VOS_DOS_WINDOWS16 0x10001
#define VOS_DOS_WINDOWS32 0x10004
#define VOS_OS216_PM16 0x20002
#define VOS_OS232_PM32 0x30003
#define VOS_NT_WINDOWS32 0x40004
#define VFT_UNKNOWN 0
#define VFT_APP 1
#define VFT_DLL 2
#define VFT_DRV 3
#define VFT_FONT 4
#define VFT_VXD 5
#define VFT_STATIC_LIB 7
#define VFT2_UNKNOWN 0
#define VFT2_DRV_PRINTER 1
#define VFT2_DRV_KEYBOARD 2
#define VFT2_DRV_LANGUAGE 3
#define VFT2_DRV_DISPLAY 4
#define VFT2_DRV_MOUSE 5
#define VFT2_DRV_NETWORK 6
#define VFT2_DRV_SYSTEM 7
#define VFT2_DRV_INSTALLABLE 8
#define VFT2_DRV_SOUND 9
#define VFT2_DRV_COMM 0x0A
#define VFT2_DRV_INPUTMETHOD 0x0B
#define VFT2_FONT_RASTER 1
#define VFT2_FONT_VECTOR 2
#define VFT2_FONT_TRUETYPE 3
版本学习列子.RC
============================================
#include <resource.h>
#include <版本学习列子.inc>
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define ICO_MAIN 0x1000 //图标
#define DLG_MAIN 0x2000 //对话框
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAIN ICON "Main.ico" //图标文件
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_MAIN DIALOG 250, 150, 113, 64 //对话框资源定义:X坐标,Y坐标,宽度,高度
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU//风格定义
CAPTION "版本学习列子" //定义显示在窗口标题栏上的文字
FONT 8, "微软雅黑" //定义对话框包括子窗口控件使用的字体和大小
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN
ICON ICO_MAIN, -1, 10, 11, 18, 21
CTEXT "简单的对话框例子\n用Win32ASM编写", -1, 36, 14, 70, 19
DEFPUSHBUTTON "确定(&X)", IDOK, 58, 46, 50, 13
CONTROL "", -1, "Static", SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 6, 39, 103, 1
END
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1 VERSIONINFO
FILEVERSION 2,0,1,2
PRODUCTVERSION 2,0,1,2
FILEOS VOS_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 0x4b0
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "Comments", "自学Win32汇编\0"
VALUE "CompanyName", "个人版本\0"
VALUE "FileDescription", "版本列子加强版\0"
VALUE "FileVersion", "2, 0, 1, 2\0"
VALUE "InternalName", "版本学习列子\0"
VALUE "LegalCopyright", "Xingdiy\0"
VALUE "LegalTrademarks", "版本学习列子\0"
VALUE "OriginalFilename", "Version.exe\0"
VALUE "PrivateBuild", "版本学习列子\0"
VALUE "ProductName", "版本学习\0"
VALUE "ProductVersion", "2, 0, 1, 2\0"
VALUE "SpecialBuild", "版本学习列子加强版\0"
END
END
END
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//WS_POPUP :弹出式窗口
//WS_VISIBLE :初始状态可见
//WS_SYSMENU :创建一个在其标题条中具有系统菜单框的窗口,仅适用于带标题条的窗口
//DS_MODALFRAME :指定带模式对话框边界的对话框,此风格和WS_CAPTION、WS_SYSMENU风格一起,创建带标题条和系统菜单的对话框
//WS_CAPTION :创建一个有标题的窗口,包含了WS_BORDER,不能和WS_DLGFRAME一起使用
//WS_BORDER :创建一个有边框的窗口
//WS_DLGFRAME :创建一个带有双层边框但没有标题的窗口
//CONTROL 文本, ID, 类, 风格, X, Y, 宽度, 高度 [,扩展风格]
//invoke CreateWindow, 类名, 文本, 风格, X, Y, 宽度, 高度, 对话框窗口句柄, ID, hInstance, NULL
//控件名称 [文本,] ID,X,Y,宽度,高度[,风格][,扩展风格]
//类介绍 :按钮(Button)、静态(Static)、编辑(Edit)、滚动条(ScrollBar)、列表框(ListBox)、组合框(ComboBox)
|
评分
-
查看全部评分
|