 |
建站必读 |
 |
|
|
 |
|
 |
|
| |
| 当前位置:首页 -> 建站必读 -> ASP技术 |
|
我翻译并整理的 AspLib中的GenObj组件的中文说明 |
写在前面:翻译整理这篇文档前,满以为该组件也能在VB中使用,结果后来一看,好像只能应用在Asp环境中,真是大失所望。但其功能对于asp编程者来说,实在不错,所以贴在这里,如有翻译和理解上的错误,欢迎指正[a]jiangjianxiao@163.net[/a]。
GenObj是AspLib 1.1的组成部分之一,其它几个是 Aspfile、AspConv、AspSortie。它是一个ActiveX组件,其中封装了一些常见的功能:
Ⅰ NT服务控制
Ⅱ NT事务日志支持
Ⅲ INT文件和注册表操作
Ⅳ 增加、删除ODBC系统DSN
Ⅴ 信用卡验证
Ⅵ Base 64编码和译码
Ⅶ 常见系统信息
大家可以从这个地址下载试用版http://www.ServerObjects.com
怎样安装GenObj
■ 拷贝GenObj.Dll到Windows的系统目录,如windows 9x一般为windowsSystem,NT则为WinNTSystem32
■ 使用RegSvr32 GenObj.Dll注册GenObj.Dll
■ 拷贝GenObj.ini到windows所在目录,Windows 9x一般为Windows,而NT一般为Winnt
■ 可通过通过编辑GenObj.ini关闭或允许GenObj的功能,设置为0为关闭此功能,设置为1为允许此功能。如AllowIniRead=1,即表示GetObj允许读取Ini文件,AllowIniRead=0,表示不允许GetObj对象读取Ini文件。此功能还可通过设置GetObj对象相应的属性来实现,详细见下面属性。
GetObj.ini文件
[Configuration]
AllowIniRead=1
AllowIniWrite=1
AllowRegRead=1
AllowRegWrite=1
AllowServiceStart=1
AllowServiceStop=1
AllowStopW3SVC=1
AllowCheckServiceStatus=1
AllowSystemDSNAdd=1
AllowSystemDSNRemove=1
AllowSystemInfo=1
AllowEventLog=1
AllowNetwork=1
AllowFileDir=1
使用GenObj
Dim objGenObj
Set objGenObj=Server.CreateObject("ASPsvr.GenObj")
方法清单
网络支持
1. NetGetUserName
说明:返回某一设备的使用者姓名,如果为Null,表示返回当前机器登录者姓名
语法:NetGetUserName(device)
参数:device,可选
2. NetAddConnection
说明:增加网络资源连接
语法:GenObj.NetAddConnection(RemoteResource,LocalName,Password )
参数:RemoteResource-资源UNC描述(\计算机名共享名),LocalName-资源本地名称,Password-口令,可选
返回值:0表示成功,其它失败
3. NetCancelConnection
说明:断开某一网络资源连接
语法:GenObj.NetCancelConnection(Device,True)
参数:Device:资源本地名称,第二个参数文档中没有描述,按例子中的值为True
返回值:0表示成功,其它失败
NT服务控制(仅适用于NT)
1. StopW3SVC
说明:停止Web服务
2. StartService
说明:启动某一NT服务
语法:GenObj.StartService(ServiceName)
参数:ServiceName-服务名称
3. StopService
说明:停止某一NT服务
语法:GenObj.StopService(ServiceName)
参数:ServiceName-服务名称
4. ServiceStatus
说明:返回某一NT服务状态
语法:GenObj.ServiceStatus(ServiceName)
参数:ServiceName-服务名称
返回值:1-服务停止,2-服务正在开始,3-服务正在停止,4-服务正在运行,5—服务正在继续,6-服务正在暂停,7-服务暂停,8—未知
事务日志支持(仅适用于NT)
1. WriteAppEventLogError
2. WriteAppEventLogWarning
3. WriteAppEventLogInfo
说明:在系统事物日志中写入Error/Warning/Info等内容
语法:WriteAppEventLogXXX(消息标题,消息内容,消息代号)
INI文件处理
1. IniWriteBool
说明:写一布尔值到Ini文件
语法:GenObj.IniWriteBool (IniFileName, Section, Ident, Value)
参数:IniFileName-Ini文件名,Section-小节名,Ident-关键字名称,Value-值,取True或False
2. IniWriteInteger
说明:写一整型值到Ini文件
语法:GenObj.IniWriteInteger (IniFileName, Section, Ident, Value)
参数:IniFileName-Ini文件名,Section-小节名,Ident-关键字名称,Value-值,取Integer值(整数)
3. IniWriteString
说明:写一字符串到Ini文件
语法:GenObj.IniWriteString (IniFileName, Section, Ident, Value)
参数:IniFileName-Ini文件名,Section-小节名,Ident-关键字名称,Value-值,取字符串
4. IniReadBool
说明:从Ini文件中读取一布尔值
语法:GenObj.IniReadBool(IniFileName,Sectin,Ident,default)
参数:IniFileName-ini文件名,Section-小节名,Ident-关键字名,default-缺省值,可省略,当Ident的值为Null时用Default代替。取值为True或false
5. IniReadInteger
说明:从Ini文件中读取一整数值
语法:GenObj.IniReadBool(IniFileName,Sectin,Ident,default)
参数:IniFileName-ini文件 |
| |
|
| |
本站关键词: |
|
|
|
|
 |
|
 |
|