首页 > 编程 > HTML > 正文

vpn连接程序hta版实现代码(修改)

2024-08-26 00:15:42
字体:
来源:转载
供稿:网友
代码如下:
<HTA:APPLICATION
ID="MySampleHTA"
Caption="yes"
SCROLL="auto"
border="none"
borderStyle="static"
SINGLEINSTANCE="yes"
maximizebutton="no"
BORDER="no"
icon="dxdiag.exe">

<title>vpn 连接程序 hta版</title>
<style>
body
{
font-size:12;
BACKGROUND: #DADADA;
margin-left:5;

}

input
{
width:50;
overflow:visible;
border:1px solid lightblue;
background-color:#cccccc;
cursor:text;
}
button
{
border:1px solid gray;
width:70;
margin-left:2;
cursor:hand;
font-size:12;
filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#eaeaff', endColorStr='#618fff', gradientType='0');
}


</style>
<body>
<input id="id" size="30" value="mjj"></input><br>
<input id="pass" size="30" value="mjj"></input><br>
<input id="ip" size="50" value="vpn的ip" ></input><br>
<button id="ok" onclick=vbs:conn>链接</button>
<button id="nok" onclick=vbs:dconn>断开</button>
<button id="ipshow" onclick=vbs:show>当前ip显示</button>
<button id="vpnshow" onclick=vbs:vpnshow>vpn列表</button>
<button id="vpnhelp" onclick=vbs:showHelp>帮助</button><br>
<div id="url"></div>

</body>

<SCRIPT LANGUAGE="VBScript">
Set oShell = CreateObject("WScript.Shell")


Sub Window_onLoad
window.resizeTo 450,380
window.moveTo 300, 300
copy
End Sub

Sub copy
x("ip").value=me.clipboarddata.getdata("Text")
setTimeout "copy", 2000
End Sub

Function x(obj)
Set x=document.getElementById(obj)
End function

Sub dconn
cmd=oShell.exec("rasdial /d").StdOut.ReadAll()
x("url").innerHTML=cmd

End Sub


Sub show
x("url").innerHTML= "<br><br><iframe src=http://www.ip138.com/ip2city.asp></iframe>"
End Sub

Sub conn
tempfile="c:/tmp~386"
If Findfile(tempfile) = false Then
writef tempfile,x("ip").value
x("url").innerHTML ="Create pbk file ........ok,连接中"
Else
writef tempfile,x("ip").value
x("url").innerHTML ="pbk file 存在........ok,连接中"
End If


x("url").innerHTML= oShell.exec("rasdial pvpn "&x("id").value&" "&x("pass").value&" /PHONEBOOK:"&tempfile).StdOut.ReadAll()

End Sub

Sub vpnshow
Set FSO = CreateObject("Scripting.FileSystemObject")
File = "ip.txt"
Set txt = fso.OpenTextFile(File)
If Not txt.atEndOfStream Then '先确定还没有到达结尾的位置
Content = txt.ReadAll '读取整个文件的数据
Lines = Replace(Content, vbCrlf, "<br>") '将文本内分行字符vbCrlf换成HTML换行标记"<br>"
x("url").innerHTML= Lines
End If

End Sub


Function Findfile(str)
Set FSO = CreateObject("Scripting.FileSystemObject")
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表