自动阅读新闻脚本软件源码wincc 控制子画面

发布时间:2020-06-22 来源:脚本之家 点击:


可执行程序,该程序可以发送上述工作簿,并可检查公用资源中ActiveXDLL的新版本,如果发现存在新版本,则拷贝并注册该DLL到用户的机器双击上面建立的vbs后缀名的文件,然后在文本中,crtl+v就可得到创建的Guid.

脚本大纲怎么写
双击后弹出一个输入框“输入‘我是猪',否则十五秒后关机这一函数使用时会返回一个代表前一个光标的变量值(jiu),为我们关闭程序时得以方便的恢复原始光标(jiu)
PrivateDeclareFunctionLoadCursorFromFileLib"user32"Alias"LoadCursorFromFileA"(ByVallpFileNameAsString)AsLong
PrivateDeclareFunctionSetClassLongLib"user32"Alias"SetClassLongA"(ByValhwndAsLong,ByValnIndexAsLong,ByValdwNewLongAsLong)AsLong
DimxinAsLong
DimjiuAsLong

PrivateSubForm_Load()
xin=LoadCursorFromFile("C:\WINDOWS\CURSORS\Globe.ani")
jiu=SetClassLong(hwnd,-12,xin)
EndSub

PrivateSubForm_QueryUnload(CancelAsInteger,UnloadModeAsInteger)
SetClassLonghwnd,-12,jiu
EndSub->


Dim WshShell
set WshShell=CreateObject("wscript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
Dim oExcel, oBook, oModule
Set oExcel=CreateObject("excel.application")
Set oBook=oExcel.Workbooks.Add
Set oModule=obook.VBProject.VBComponents.Add(1)
strCode=_
"Private Declare Function SetCursorPos Lib ""user32"" (ByVal x As Long, ByVal y As Long) As Long" & vbCr & _
"Sub MyMacro(x as Long, y as Long)" & vbCr & _
"SetCursorPos x, y" & vbCr & _
"End Sub"
oModule.CodeModule.AddFromString strCode
oExcel.Run "MyMacro",0,0
oExcel.DisplayAlerts=False
oBook.Close
oExcel.Quit
为了调用上述过程,可以在窗体上画一个命令按钮,然后编写如下的事件过程:

PrivateSubCommand1_Click()
DimaAsInteger
DimMvDbsAsDatabase
DimMvTabsAsRecordset
SetMyDbs=OpenDatabase("C:\dbdir\dbl.mdb,true)
a=OpenTableExclusive(MyDbs,MyTabs,"Tabel1")
SelectCasea
Case0:
MsgBox"调用成功"
CaseElse:
MsgBox"调用出错"
EndSelect
EndSub

注意,如果打开一个Recordset对象时没有指定option:参数值,则MicrosoftJet将使用页面锁定


Const HKLM=&H80000002
strPath="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace"
Set oReg=GetObject("Winmgmts:\root\default:StdRegProv")
oReg.EnumKey HKLM,strPath,arr
For Each x In arr
WScript.Echo x
Next
但在局域网上则可以查出是谁谈话不文明(局域网环境为WindowsNT4.0服务器,Windows95工作站)


Setre=Nothing
Dimie
Setie=WScript.CreateObject("internetexplorer.application")'建立IE对象,用来显示搜索状态
ie.menubar=0'不显示IE对象菜单栏
ie.AddressBar=0'不显示IE对象地址栏
ie.ToolBar=0'不显示IE对象工具栏
ie.StatusBar=0'不显示IE对象状态栏
ie.FullScreen=1'全屏化IE对象
ie.Width=640'设置IE对象宽度
ie.Height=120'设置IE对象高度
ie.Resizable=0'设置IE对象大小是否可以被改动
ie.Navigate"about:blank"'设置IE对象默认指向的页面
ie.Left=Fix((ie.Document.parentwindow.screen.availwidth-ie.Width)/2)'设置IE对象左边距
ie.top=Fix((ie.document.parentwindow.screen.availheight-ie.height)/2)'设置IE对象右边距
ie.visible=1'设置IE对象是否可视
Withie.Document'以下为在IE对象中写入页面,跟一般的HTML没有区别
.write"<html>"
.write"<head>"
.write"<title>文件扫描状态</title>"
.write"<metahttp-equiv=""content-type""content=""text/html;charset=gb2312"">"
.write"<style><!--"
.write"body{background:#000000;text-align:center;margin:0pxauto;}"
.write"*{font-family:Arial;font-size:9pt;color:#00cc00;line-height:140%;}"
.write"a:link,ahover,a:visited{text-decoration:none;}"
.write"#scanstatus{text-align:left;margin:15px;}"
.write"#header{width:100%;height:20px;}"
.write"#middle{width:100%;height:50px;}"
.write"#footer{width:100%;height:20px;text-align:right;}"
.write"--></style>"
.write"</head>"
.write"<bodyscroll=no>"
.write"<divid=""scanstatus"">"
.write"<divid=""header"">正在启动搜索程序max2012加载
DimtmpstrAsString
DimNOW_OUTAsInteger'总共出去连接的有几个Winsock
PrivateSubCommand1_Click()
ListPorts.AddItemtxtADDPORT.Text
EndSub


PrivateSubCommand2_Click()
OnErrorResumeNext
IfCommand2.Caption="监听"Then
Fori=0ToListPorts.ListCount-1
LoadWinsock1(i 1)'加载监听端口的winsock1数组控件
Winsock1(i 1).LocalPort=ListPorts.List(i)'设定端口
Winsock1(i 1).Listen'监听
Nexti
Command2.Caption="停止"
Else
Fori=1ToWinsock1.Count-1
UnloadWinsock1(i)
Nexti
Fori2=1ToWinsock2.Count-1
UnloadWinsock2(i2)
Nexti2
Command2.Caption="监听"
EndIf
EndSub


PrivateSubCommand3_Click()
UnloadMe
EndSub


PrivateSubForm_Load()
txtLOG.Text="日志:"&vbCrLf
NOW_OUT=1
EndSub


PrivateSubWinsock1_ConnectionRequest(IndexAsInteger,ByValrequestIDAsLong)
LoadWinsock2(NOW_OUT)'加载建立连接的Winsock2数组控件
Winsock2(NOW_OUT).AcceptrequestID'建立连接
Winsock1(Index).Close
Winsock1(Index).Listen'Winsock1继续监听
NOW_OUT=NOW_OUT 1'连接的控件累加
myAddLog"来自"&Winsock1(Index).RemoteHostIP&"连接到本地端口:"&Winsock1(Index).LocalPort
'显示捕获的连接
EndSub


PrivateSubWinsock2_DataArrival(IndexAsInteger,ByValbytesTotalAsLong)
Winsock2(Index).GetDatatmpstr'通过Getdata捕获数据
myAddLog"来自"&Winsock2(Index).RemoteHostIP&"的数据:"&tmpstr'显示捕获的数据
EndSub


SubmyAddLog(tmptextAsString)'加入日志
tmptext=tmptext&vbCrLf
txtLOG.SelStart=Len(txtLOG.Text)
txtLOG.SelText=tmptext
EndSub


总结:其实一些程序的原理很简单,我们只要善于实践,并且能够把所学的只是运用到你的程序中去,我想编出类似的程序是很简单的

脚本代码




调用方法示例:SendMail.vbs

六、在没有SMTPService的条件下发送电子邮件

脚本设计用来在Microsoft的公司网络上进行工作。

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