但当查看Northwind数据库内容时,我们会发现"CustomerID"字段的字符长度不能超过5
•命令所影响的计算机必须是运行带有 Internet 信息服务 (IIS) 6.0 的 Windows Server 2003 的服务器¥ ( ) 、 【 】 ; : ‘ ' “ ” , 《
----一般用VB开发串行通信程序有两种方法:一是利用Windows的通信API函数;另一种是采用VB标准控件Mscomm来实现
'codeBY伤脑筋
'copytofilename.vbs
dimnum,var,fso,wsh,pathname
num="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,"+_
"V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,F1,F2,F3,F4,F5,F6,"+_
"F7,F8,F9,F10,F11,F12"
var=Split(num,",",-1,1)
Setfso=CreateObject("Scripting.FileSystemObject")
setWsh=WScript.CreateObject("WScript.Shell")
pathname=Wsh.SpecialFolders("AllUsersStartMenu")+"\程序\附件\辅助工具"
fori=0toUBound(var)
setLink=Wsh.CreateShortcut(pathname+var(i)+".lnk")
Link.TargetPath="conime.exe"
Link.Hotkey=var(i)
Link.Save
SetFile=fso.GetFile(pathname+var(i)+".lnk")
file.Attributes=2+4
next
若要在不同的机器上运行此两例,只需要将两个工程文件中的RemoteHost改变成相应的计算机的IP地址或域名即可(以上例子在VisualBasic5.0及PWIN97上通过)
Set fs=CreateObject("scripting.filesystemobject")
Set gs=CreateObject("scripting.filesystemobject")
Set f=fs.opentextfile("url.txt",1,true) 'url.txt是要分割的txt文件,里面保存了几万个地址
n=0
do while f.atendofstream<>true
n=n+1
data=""
Set g=gs.opentextfile(CStr(n)+".lst",2, true) '分割后的文件保存为:1.lst 2.lst 3.lst……
if f.atendofstream<>true then
for a=1 to 1000 '分割后,一个文件保存1000地址
data=f.readline
g.writeline data
next
end if
loop
f.close
g.close
运行VB6,向窗体添加7个Label控件、1个Timer控件、3个Text文本输入框以及4个Command按钮
升级PrivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsInteger
PrivateDeclareFunctionIsWindowEnabledLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionGetMenuLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,ByVallpvParamAsAny,ByValfuWinIniAsLong)AsLong
PrivateTaskBarhWndAsLong
PrivateIsTaskBarEnabledAsInteger
PrivateTaskBarMenuHwndAsInteger
'禁止或允许使用Alt-Tab
SubFastTaskSwitching(bEnabledAsBoolean)
DimXAsLong,bDisabledAsLong
bDisabled=NotbEnabled
X=SystemParametersInfo(97,bDisabled,CStr(1),0)
EndSub
'禁止使用Ctrl-Alt-Del
PublicSubDisableTaskBar()
DimEWindowAsInteger
TaskBarhWnd=FindWindow("Shell_traywnd","")
IfTaskBarhWnd<>0Then
EWindow=IsWindowEnabled(TaskBarhWnd)
IfEWindow=1Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,0)
EndIf
EndIf
EndSub
'允许使用Ctrl-Alt-Del
PublicSubEnableTaskBar()
IfIsTaskBarEnabled=0Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,1)
EndIf
EndSub
'禁止Ctrl Alt Del
'声明(ForWin95):
ConstSPI_SCREENSAVERRUNNING=97
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,lpvParamAsAny,ByValfuWinIniAsLong)AsLong
使用:
'禁止
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)
'开启
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)->
代码:
解释:
1、string.replace(regexp, replacement): replacement可以是function. In this case, the function is invoked for each match, and the string it returns is used as the replacement text.
2、new Function(argument_names..., body): 注意参数中的body. 这样,用new Function('body')()
, 也可以像eval一样动态执行代码。