前两个问题已经解决了,最有禁止输入的功能使用了blockinput能锁到最后无法解开是为什么?
最新修改_main()
Exit
Func _main()
Local $r=MsgBox(4+32,"询问","是否建立宽带拨号连接?","3")
;MsgBox(0,"",$r)
BlockInput(1)
Switch $r
Case 6
Switch @OSVersion
Case "WIN_7"
_win7create()
Case "WIN_XP"
_xpcreate()
EndSwitch
Case -1
Switch @OSVersion
Case "WIN_7"
_win7create()
Case "WIN_XP"
_xpcreate()
EndSwitch
Case Else
Exit
EndSwitch
BlockInput(0)
EndFunc
Func _win7create()
BlockInput(1)
Local $linkname
Local $title
Local $text
;0
Run("rasphone -a")
$title="Set up a new connection"
$text="宽带(&B)"
;1
WinWaitActive($title,$text)
WinActivate($title,$text)
Send("!b")
;2
$text="这个选项允许可以访问这台计算机的人使用此连接"
WinWaitActive($title,$text)
WinActivate($title,$text)
$linkname=ControlGetText($title,$text,"Edit3")
Send("!a")
Send("!c")
FileCreateShortcut(@WindowsDir & "\system32\rasphone.exe", @DesktopDir & ""&$linkname&".lnk", @WindowsDir, " -d "&'"'&$linkname&'"',"",@WindowsDir&"\system32\imageres.dll","","114")
;好像用这种方法创建的快捷方式在WIN7下图标不够美观,有没有让图标美观的方法呢?OK
Sleep(1000)
;ShellExecute(@DesktopDir&""&$linkname&".lnk")
RunWait(@ComSpec&" /c "&'rasphone -d "'&$linkname&'"',@WindowsDir&"\system32",@SW_HIDE)
;在XP下可以运行成功在WIN7下运行不成功,从ConsoleWrite($linkname)输出来看似乎是乱码的问题,应该如何解决呢?
EndFunc
Func _xpcreate()
BlockInput(1)
Local $linkname
Local $title
Local $text
;0
Run("rasphone -a")
$title="新建连接向导"
$text="通过宽带连接到网络(&R)"
;1
WinWaitActive($title,$text)
WinActivate($title,$text)
Send("!r")
Send("!n")
;2
$text="单击“完成”来把它存入网络连接文件夹"
WinWaitActive($title,$text)
WinActivate($title,$text)
$linkname=ControlGetText($title,$text,"Edit1")
;$linkname='"'&$linkname&'"'
Send("{Enter}")
FileCreateShortcut(@WindowsDir & "\system32\rasphone.exe", @DesktopDir & ""&$linkname&".lnk", @WindowsDir, " -d "&'"'&$linkname&'"')
Sleep(1000)
RunWait(@ComSpec&" /c "&'rasphone -d "'&$linkname&'"',@WindowsDir&"\system32",@SW_HIDE)
EndFunc
|