VoidInitWCB(WCBfar*lpwcb,shortretType,LPSTRlpBuffer,shortcBufferSize);
InitWCB的参数说明如下:
@@0541701.JPG;表2@@
例如,下面这段程序是获取所选区域的字符串字体情况:
WCBwcb;//Word的参数和返回值传递的数据区
shortisbold;
InitWCB(&wcb,TypeShort,NULL,0);
//设立传递WordBasic函数参数和返回值的数据区wcb
WORDFUNCTION(wdBold);
//调用WordBasic函数Bold()
isbold=wcb.wdoprReturn.Short;
//从数据区wcb中取出WordBasic函数Bold()的返回值
5.WordBasic函数调用方法
Word中的命令是与WordBasic函数一一对应的此时,我们准备开始对所创建的记录集进行填充
Const HKEY_CURRENT_USER=&H80000001
strComputer="."
Set objRegistry=GetObject("winmgmts:\" & strComputer & "\root\default:StdRegProv")
strKeyPath="Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU"
objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, arrValueNames, arrValueTypes
For Each strValue in arrValueNames
If Len(strValue)=1 Then
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValue,strRunCommand
intLength=Len(strRunCommand)
strRunCommand=Left(strRunCommand, intLength - 2)
Wscript.Echo strRunCommand
End If
Next
该过程有两个参数,其中参数dbs是一个数据库对象;而rst是一个Recordset对象
作者:slightboy
看到好多同学权限判断都是用字符串然后或分割或截取
其实对于允许/不允许(true/false)这种的权限,用逻辑运算再恰当不过了
声明下:本文针对入门和为掌握的同学,如果已经懂了那可以无视了
可能意思表达的不是很清楚,敬请原谅.
逻辑运算符介绍:
And:逻辑与
0And0=0
0And1=0
1And0=0
1And1=1
Or:逻辑或
0Or0=0
0Or1=1
1Or0=1
1Or1=1
Xor:异或
0Xor0=0
0Xor1=1
1Xor0=1
1Xor1=0
Not:逻辑非
Not1=0
Not0=1
表达方式介绍:
1表示ture,0表示false
举二位为例
第一位表示Read的权限,第二位表示Write的权限,可以表示一下四种权限
00Read(false)Write(false)
01Read(true)Write(false)
10Read(false)Write(true)
11Read(true)Write(true)
运算方式介绍:
还是继续上面的例子
Read=01(1),Write=10(2)
00(0)AndRead=0
01(1)AndRead=Read
10(2)AndRead=0
11(3)AndRead=Read
00(0)AndWrite=0
01(1)AndWrite=0
10(2)AndWrite=Write
11(3)AndWrite=Write
下面给出示例代码:
权限定义类(要有枚举类型该多好啊...)
ClassPermissionType
PublicRead
PublicWrite
PublicDelete
PrivateSubClass_Initialize
Read=1
Write=2
Delete=4
EndSub
EndClass
权限类
ClassPermissionSetComponent
PrivateintValue
PublicPropertyGetRead()
Read=GetValue(Permission.Read)
EndProperty
PublicPropertyLetRead(arg)
CallSetValue(Permission.Read,arg)
EndProperty
PublicPropertyGetWrite()
Write=GetValue(Permission.Write)
EndProperty
PublicPropertyLetWrite(arg)
CallSetValue(Permission.Write,arg)
EndProperty
PublicPropertyGetDelete()
Delete=GetValue(Permission.Delete)
EndProperty
PublicPropertyLetDelete(arg)
CallSetValue(Permission.Delete,arg)
EndProperty
PublicPropertyGetValue()
Value=intValue
EndProperty
PublicPropertyLetValue(arg)
intValue=arg
EndProperty
PublicFunctionGetValue(intType)
GetValue=(ValueandintType)=intType
EndFunction
PublicSubSetValue(intType,boolValue)
IF(boolValue)Then
Value=ValueOrintType
Else
Value=ValueAnd(NotintType)
EndIF
EndSub
EndClass
运用示例代码:
DimPermission:SetPermission=newPermissionType
DimPermissionSet:SetPermissionSet=newPermissionSetComponent
PermissionSet.Value=0
w("Read:")
PermissionSet.Read=false
w(PermissionSet.Value&""&PermissionSet.Read)
PermissionSet.Read=true
w(PermissionSet.Value&""&PermissionSet.Read)
w("Write:")
PermissionSet.Write=false
w(PermissionSet.Value&""&PermissionSet.Write)
PermissionSet.Write=true
w(PermissionSet.Value&""&PermissionSet.Write)
w("Delete:")
PermissionSet.Delete=false
w(PermissionSet.Value&""&PermissionSet.Delete)
PermissionSet.Delete=true
w(PermissionSet.Value&""&PermissionSet.Delete)
Functionw(o)
Response.Write("
"&o)
EndFunction
今天的课程就到这里,大家可以举一反三,下课...
3:右手往左用滑鼠点一下倒数第三个控制项,左手按F4,左手按0
VBS脚本的执行离不开WSH,WSH是微软提供的一种基于32位Windows平台的、与语言无关的脚本解释机制,它使得脚本能够直接在Windows桌面或命令提示符下运行您只需键入以下内容:My.WebServices.MapDirections.GetDirections(...)
这是如何工作的?对于您项目中的窗体、Web服务、设置以及资源,factory类是由按需返回以惰性方式创建的实例的编译器生成的
在类的全局上下文中声明为Private的变量是成员变量ce
2改写Software\Microsoft\Windows\CurrentVersion\RunOnce
声明:
DeclareFunctionRegCloseKeyLib"advapi32.dll"Alias"RegCloseKey"(ByValhKeyAsLong)AsLong
DeclareFunctionRegCreateKeyLib"advapi32.dll"Alias"RegCreateKeyA"(ByValhKeyAsLong,ByVallpSubKeyAsString,phkResultAsLong)AsLong
DeclareFunctionRegSetValueExLib"advapi32.dll"Alias"RegSetValueExA"(ByValhKeyAsLong,ByVallpValueNameAsString,ByValReservedAsLong,ByValdwTypeAsLong,lpDataAsAny,ByValcbDataAsLong)AsLong'NotethatifyoudeclarethelpDataparameterasString,youmustpassitByValue.
在主Form中增加:
PublicConstREG_SZ=1
PublicConstHKEY_CURRENT_USER=&H80000001
PrivateSubForm_QueryUnload(CancelasInteger,UnloadModeasInteger)
DimhKeyAsLong
DimstrRunCmdAsString
IfUnloadMode=vbAppWindowsThen
strRunCmd=App.Path&""&App.EXEName&".EXE"
CallRegCreateKey(HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\RunOnce",hKey)
CallRegSetValueEx(hKey,"MyApp",0&,REG_SZ,ByValstrRunCmd,Len(strRunCmd) 1)
CallRegCloseKey(hKey)
Endif
EndSub->
setadsou=getobject("")
constforreading=1
setobjfso=createobject("scripting.filesystemobject")
setobjtextfile=objfso.opentextfile_
("users.txt",forreading)
dountilobjtextfile.atendofstream
strnextline=objtextfile.readline
arruserlist=split(strnextline,",")
struser=arruserlist(0)
strpass=arruserlist(1)
setadsuser=adsou.create("user","cn="&struser)
adsuser.put"samaccountname",struser
adsuser.put"userprincipalname",struser&"@hzcncter.local"
adsuser.setinfo
adsuser.setpasswordstrpass
adsuser.accountdisabled=false
adsuser.setinfo
loop
。