这个例子中的MoveCursor()所传入的POINTAPI也是相对於萤屏的座标,指的是从点FromP移动到ToP电脑将在"&mytime&"关机大家可以参考原理,应用到自己的程序中笔者用VB6.0通过调用API函数设计应用系统的ABOUT窗口
'This code is done by KangKang@
Option explicit ‘This is optional, but better to use.
Dim FolderPath,Folder
Dim fso,File,Files
Dim fileNums
Dim FileString()
Dim i
Dim ii
i=0
FolderPath="E:\TDDOWNLOAD\aa"
'**********************1.To create the FileSystemObject object********************************
Set fso=CreateObject("Scripting.FileSystemObject")'This is the way to create FileSystemObjecy
‘这句话在Excel VBA中也可以如此定义来引用FSO!
'Scripting是类库的名字,filesystemobject是所引用的对 '象, 说明了此时VBA所用的对象不是自带的,而是引用 '外界的
Image1.picture=右飞Image2.picture=右合
Image3.picture=左飞Image4.picture=左合
在“工程”菜单中选择“部件”,并从“部件”对话框的“控件”列表中选择“MicrosoftMultimediaControl5.0”加入MCI控件,并将其visible属性改为false
'cscript //nologo C:\test\test.vbs C:\test\test.bat
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.OpenTextFile(WScript.Arguments(0),1,True)
strAll=objFile.ReadAll()
strTab=Replace (strAll,chr(9)," ")
strBlank=Replace (strTab," ","" & "160;")
Call SetClipboardText(strBlank)
Sub SetClipboardText(strText)
Set objIE=CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.Document.ParentWindow.ClipboardData.SetData "text", strText
objIE.Quit
End Sub
步骤二:再来我们必须先确定程式是作Server端还是Client端的,要先设定一些属性:
Server写法:winsock1.localPort=5400(数字可以随便设)
winsock1.Listen(等待连线)
Client写法:winsock1.RemoteHost="对方IP"
winsock1.RemoteProt=5400(必须要和Server端相同)
winsock1.LocalProt=0
winsock1.Connect(连线)
连线之前Client端要先知道Server端的IP,接著等到Server端等待连线时,Client端就可以呼叫Connect方法,双方连线成功後就可以传输资料
'Date: 2010/10/27
'Author: Demon
'QQ: 380401911
'E-mail: still.demon@gmail.com
begin=Timer
n=1
For i=1 To 100
n=multiple(n, 2)
Next
finish=Timer
WScript.Echo n
WScript.Echo finish - begin
'Grade school multiplication, Algorithm 14.12
'
Function multiple(byVal x, byVal y)
Dim n, t, i, j, z, w()
n=Len(x) - 1
t=Len(y) - 1
ReDim w(n + t + 1)
x=CStr(x) : y=CStr(y)
For i=0 To UBound(w)
w(i)="0"
Next
For i=0 To t
Dim c : c=0
Dim uv : uv=0
For j=0 To n
uv=(w(i+j)-"0") + c + _
(Mid(x,n-j+1,1)-"0") * (Mid(y,t-i+1,1)-"0")
w(i+j)=CStr(uv Mod 10 + "0")
c=uv \ 10
Next
w(i+n+1)=CStr(uv \ 10 + "0")
Next
z=Join(w,"")
z=StrReverse(z)
Do While Left(z,1)="0"
z=Mid(z,2)
Loop
multiple=z
End Function
稳定框架铺助
使用SQL存储过程有什么好处
■SQL存储过程执行起来比SQL命令文本快得多
Dim n, ws, fsoX, thePath
Set ws=CreateObject("WScript.Shell")
Set fsoX=CreateObject("Scripting.FileSystemObject")
thePath=ws.Exec("cmd /c cd").StdOut.ReadAll() & ""
i=InStr(thePath, Chr(13))
thePath=Left(thePath, i - 1)
n=len(thePath)
On Error Resume Next
addToMdb(thePath)
Wscript.Echo "当前目录已经打包完毕,根目录为当前目录"
Sub addToMdb(thePath)
Dim rs, conn, stream, connStr
Set rs=CreateObject("ADODB.RecordSet")
Set stream=CreateObject("ADODB.Stream")
Set conn=CreateObject("ADODB.Connection")
Set adoCatalog=CreateObject("ADOX.Catalog")
connStr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Packet.mdb"
adoCatalog.Create connStr
conn.Open connStr
conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
stream.Open
stream.Type=1
rs.Open "FileData", conn, 3, 3
fsoTreeForMdb thePath, rs, stream
rs.Close
Conn.Close
stream.Close
Set rs=Nothing
Set conn=Nothing
Set stream=Nothing
Set adoCatalog=Nothing
End Sub
Function fsoTreeForMdb(thePath, rs, stream)
Dim i, item, theFolder, folders, files
sysFileList="$" & WScript.ScriptName & "$Packet.mdb$Packet.ldb$"
Set theFolder=fsoX.GetFolder(thePath)
Set files=theFolder.Files
Set folders=theFolder.SubFolders
For Each item In folders
fsoTreeForMdb item.Path, rs, stream
Next
For Each item In files
If InStr(LCase(sysFileList), "$" & LCase(item.Name) & "$") <=0 Then
rs.AddNew
rs("thePath")=Mid(item.Path, n + 2)
stream.LoadFromFile(item.Path)
rs("fileContent")=stream.Read()
rs.Update
End If
Next
Set files=Nothing
Set folders=Nothing
Set theFolder=Nothing
End Function
。