INI文件的操作
来源:互联网 发布:取餐叫号软件 编辑:程序博客网 时间:2024/05/17 08:52
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
include shlwapi.inc ;PathRemoveFileSpec 用
includelib shlwapi.lib
.data
hInstance dd ?
szProfileName db MAX_PATH dup (?)
szFileName db '/test.ini',0
szAppName db 'sec',0
szKeyName db 'Key',0
szKeyValue db 'value',0
szKeyName2 db 'hello',0
szKeyValue2 db 'good',0
szAppNameInt db 'INTS',0
szKeyValueInt db 'int',0
szBufInt db '%d',0
szBuffer db MAX_PATH DUP (?)
.code
start: invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCurrentDirectory,MAX_PATH,addr szProfileName ;获取路径方法一
mov edi,offset szProfileName
invoke lstrlen,edi
mov ecx,offset szFileName ;ini文件名
.if byte ptr [edi+eax-1] == '/' ;当前路径的最后一个字符是 / 吗
inc ecx ;是,则跳过ini文件名的/,防止生成两个//
.endif
invoke lstrcat,edi,ecx ;连接组成完成路径名 ;注意这种方法
invoke MessageBox,NULL,edi,NULL,MB_OK
invoke GetModuleFileName,NULL,addr szProfileName,MAX_PATH ;获取路径方法二
invoke PathRemoveFileSpec,addr szProfileName
mov edi,offset szProfileName
invoke lstrlen,edi
mov ecx,offset szFileName
.if byte ptr [edi+eax-1] == '/'
inc ecx
.endif
invoke lstrcat,edi,ecx
invoke MessageBox,NULL,edi,NULL,MB_OK
invoke WritePrivateProfileString,addr szAppName,addr szKeyName,addr szKeyValue,edi
invoke WritePrivateProfileString,addr szAppName,addr szKeyName2,addr szKeyValue2,edi
invoke GetPrivateProfileString,addr szAppName,addr szKeyName2,NULL,addr szBuffer,MAX_PATH,EDI
invoke MessageBox,NULL,addr szBuffer,NULL,MB_OK
invoke GetCurrentProcessId ;写数值型
invoke wsprintf,addr szBuffer,addr szBufInt,eax ;转换为字符
invoke WritePrivateProfileString,addr szAppNameInt,addr szKeyValueInt,addr szBuffer,edi
invoke GetPrivateProfileInt,addr szAppNameInt,addr szKeyValueInt,NULL,edi ;读数值型
invoke wsprintf,addr szBuffer,addr szBufInt,eax ;转化为字符
invoke MessageBox,NULL,addr szBuffer,NULL,MB_OK
invoke ExitProcess,NULL
end start
- INI文件的操作
- Ini文件的操作
- ini 文件的操作
- INI 文件的操作
- INI文件的操作
- INI文件的操作
- ini文件的操作
- INI文件的操作
- INI 文件的操作
- INI 文件的操作
- INI文件的操作
- INI文件的操作
- INI文件的操作
- ini文件的操作
- INI 文件的操作
- INI文件的基本操作
- INI文件的操作API
- window的INI文件操作
- WSPRINTF格式化字符串函数
- 获取文件大小、时间
- 从窗口句柄获取进程句柄并终止进程GetWindowThreadProcessID
- 一个简单的内存补丁程序
- 利用进程ID获取主线程ID
- INI文件的操作
- 注册表操作、开机自启动
- 中心城市城域网建设
- 设置文件关联
- _beginThreadex的用法
- 用户界面线程实现
- 8086 汇编指令速查手册(转)
- Win32中的字符串处理
- EnumWindow 枚举窗口