Samuel Learning
联系
管理
文章分类
(203)
01 ASP/HTML(6)
02 Script/CSS(16)
03 C/C++
04 XML(4)
05 微软编程(26)
06 J2EE(60)
09 Linux(14)
10 Database(27)
11 报表打印
12 打包安装(1)
13 模式重构(2)
14 系统架构
15 敏捷开发(11)
16 案例分析(30)
17 Workflow(1)
18 配置管理(1)
19 项目管理
20 英语(4)
新闻分类
(52)
CXF学习
Hibernate学习(1)
iBatis学习(16)
Struts1学习(1)
Struts2学习(34)
.NET资源
adxmenu
C# Open Source
DNN Directory
M2Land
Windows Form FAQ
中国DNN
中国DNN联盟
Ajax
DoJo
GWT
JQuery
jquery autocomplete
jquery flexgrid
JQuery Form
jquery masked input
JQuery UI
jquery validation
Jquery 图表
jquery报表
jquery插件集合
Qooxdoo
Tibco GI
YUI
YUI-EXT
ZeroKode
Java开源
ABLE
Agile Tao
Ajax4JSF
Alfresco
AppFuse
Compiere
Equinox
Findbugs
Geronimo
Grails
Harmony
Hibernate论坛
JAG
Java开源大全
Java视线论坛
jBPM工作流
JSFTutorials
Nereide ERP
Ofbiz ERP
Opentaps ERP
operamasks
Petstore
Prototype.js
RIFE
Runa
SpringSide
Struts Menu
Sun Glassfish
Trails
YUI4JSF
满江红
Mobile
Sencha
WEB资源
DHTML中心
DHTML参考手册
DHTML文档
EclipsePlugin
Firebug
GRO Clinux
jMaki
JSTL文档
LoadIcon
Openlaszlo
Struts Menu 展示
Web Test Tools
WebCtrs
Webdeveloper
中国RIA开发者论坛
Workflow
E-Workflow
JBPM
OpenWFE
OSWorkflow
WFMC
Workflow Research
其他连接
confach
CPP
ejay
Giovanni
丹佛
交大e-learning
交大研究生院
可恶的猫
天天@blog
我的相册
阿飞
大牛人
32篇JBPM
David.Turing
HongSoft@业务集成
Joel
Koen Aers
Martinfowler
Raible Matt
Raible Wiki
Scott W.Ambler
Tom Baeyens
Uncle Bob
一个世界在等待
子在川上曰
小布老师
小明
差沙
徐昊
江南白衣
汪博士
汪小金
银狐999
开源软件
2Bizbox ERP
CompiereCRM&ERP
EGW
Vtiger CRM
webERP
敏捷
Canoo
Cruisecontrol
DBUnit
EL4Ant
Extreme Programming
Fit
Fitnesse
JFrog
Liquibase
Maven
MockObjects
Selenium
Squish
xpairtise
XPlanner
XProgramming
敏捷联盟
数据库
Oracle 中国
Oracle-ERP
Oracle在线社区
未归类
Aquarius Orm Studio
mambo建站系统
Oracle产品下载
远程同步管理工具Capivara
经典框架
Apache Shale
formdef-struts
FreeMarker 主页
JBoss Seam
JSF 中心
JSF 入门应用
JSF中国
MyFaces官方
Spring 社区
Spring专业网站
Spring中文论坛
Spring参考手册
Spring官方网站
strecks-struts
Struts1
Struts2
Struts-layout
StrutsWiKi
Tapestry WIKI
Tapestry 官方
Tapestry4开发指南
Tapestry中文文档
Webwork2文档
Wicket
网络教程
Laliluna
RoseIndia
Sang Shin
Visualbuilder
著名站点
Buildix
Dev2Dev
IBM dev中国
InfoQ
ITPub
Java Eye
Java Research
JavaRead
JavaWorldTW
Matrix
PHP100
PHPX
SpringSideWiKi
TheServerSide
TWPHP
中国工作流论坛
项目管理
管理人网
最新评论
View Post
VB读写INI文件
Private
Declare
Function
GetPrivateProfileString Lib
"
kernel32
"
Alias
"
GetPrivateProfileStringA
"
(ByVal lpApplicationName
As
String
, ByVal lpKeyName
As
Any, ByVal lpDefault
As
String
, ByVal lpReturnedString
As
String
, ByVal nSize
As
Long
, ByVal lpFileName
As
String
)
As
Long
Private
Declare
Function
WritePrivateProfileString Lib
"
kernel32
"
Alias
"
WritePrivateProfileStringA
"
(ByVal lpApplicationName
As
String
, ByVal lpKeyName
As
Any, ByVal lpString
As
Any, ByVal lpFileName
As
String
)
As
Long
'
以下两个函数,读/写ini文件,固定节点setting,in_key为写入/读取的主键
'
仅仅针对是非值
'
Y:yes,N:no,E:error
Public
Function
GetIniTF(ByVal In_Key
As
String
)
As
Boolean
On
Error
GoTo
GetIniTFErr
GetIniTF
=
True
Dim
GetStr
As
String
GetStr
=
VBA.String(
128
,
0
)
GetPrivateProfileString
"
Setting
"
, In_Key,
""
, GetStr,
256
, App.Path
&
"
\config.ini
"
GetStr
=
VBA.Replace(GetStr, VBA.Chr(
0
),
""
)
If
GetStr
=
"
1
"
Then
GetIniTF
=
True
GetStr
=
""
Else
GoTo
GetIniTFErr
End
If
Exit
Function
GetIniTFErr:
Err.Clear
GetIniTF
=
False
GetStr
=
""
End Function
Public
Function
WriteIniTF(ByVal In_Key
As
String
, ByVal In_Data
As
Boolean
)
As
Boolean
On
Error
GoTo
WriteIniTFErr
WriteIniTF
=
True
If
In_Data
=
True
Then
WritePrivateProfileString
"
Setting
"
, In_Key,
"
1
"
, App.Path
&
"
\config.ini
"
Else
WritePrivateProfileString
"
Setting
"
, In_Key,
"
0
"
, App.Path
&
"
\config.ini
"
End
If
Exit
Function
WriteIniTFErr:
Err.Clear
WriteIniTF
=
False
End Function
'
以下两个函数,读/写ini文件,不固定节点,in_key为写入/读取的主键
'
针对字符串值
'
空值表示出错
Public
Function
GetIniStr(ByVal AppName
As
String
, ByVal In_Key
As
String
)
As
String
On
Error
GoTo
GetIniStrErr
If
VBA.Trim(In_Key)
=
""
Then
GoTo
GetIniStrErr
End
If
Dim
GetStr
As
String
GetStr
=
VBA.String(
128
,
0
)
GetPrivateProfileString AppName, In_Key,
""
, GetStr,
256
, App.Path
&
"
\config.ini
"
GetStr
=
VBA.Replace(GetStr, VBA.Chr(
0
),
""
)
If
GetStr
=
""
Then
GoTo
GetIniStrErr
Else
GetIniStr
=
GetStr
GetStr
=
""
End
If
Exit
Function
GetIniStrErr:
Err.Clear
GetIniStr
=
""
GetStr
=
""
End Function
Public
Function
WriteIniStr(ByVal AppName
As
String
, ByVal In_Key
As
String
, ByVal In_Data
As
String
)
As
Boolean
On
Error
GoTo
WriteIniStrErr
WriteIniStr
=
True
If
VBA.Trim(In_Data)
=
""
Or
VBA.Trim(In_Key)
=
""
Or
VBA.Trim(AppName)
=
""
Then
GoTo
WriteIniStrErr
Else
WritePrivateProfileString AppName, In_Key, In_Data, App.Path
&
"
\config.ini
"
End
If
Exit
Function
WriteIniStrErr:
Err.Clear
WriteIniStr
=
False
End Function
posted on 2005-11-30 20:34
MingIsMe
阅读(593)
评论(0)
编辑
收藏
所属分类:
05 微软编程