调用 DOS命令吧 看一下这个 mountvol
给你个例子:
#NoTrayIcon;隐藏小图标
#Include <process.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $tm,$pf,$label_tell,$gui,$ti=60,$su
If $CmdLine[0] <= 0 Then
$su=''
Else
For $k=1 To $CmdLine[0]
$su=$su&' "'&$CmdLine[$k]&'"'
Next
EndIf
If FileExists("M:\") Then _start()
Run(@ComSpec & " /c " & 'iscsicli AddTargetPortal 192.168.0.253 3260', "", @SW_HIDE)
Run(@ComSpec & " /c " & 'iscsicli LoginTarget iqn.2005-02.com.ricecake.iscsi:00 T * * * * * * * * * * * * * * * 0', "", @SW_HIDE)
$gui = GUICreate("连接服务器", 400, 50,-1,-1,$WS_POPUP)
GUISetBkColor (0x3A6EA5)
$label_tell=GUICtrlCreateLabel('正在连接服务器,请稍候……'&@TAB&'60', 0,0,400, 50,0x01+0x0200,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 10,800,0, "Comic Sans MS")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
_GuiRoundCorners($gui, 0, 0, 16, 16)
GUISetState(@SW_SHOW)
AdlibEnable ( "_time", 1000)
For $w=1 To 600
If FileExists("M:\") Then
GUIDelete($gui)
_start()
ElseIf FileExists("H:\") And DriveGetType ( "H:" )='Fixed' Then
$pf='H'
ExitLoop
ElseIf FileExists("G:\") And DriveGetType ( "G:" )='Fixed' Then
$pf='G'
ExitLoop
ElseIf FileExists("J:\") And DriveGetType ( "J:" )='Fixed' Then
$pf='J'
ExitLoop
EndIf
Sleep(500)
Next
GUIDelete($gui)
If $pf<>'' Then
$temp=_TempFile()
_RunDOS('mountvol /L >'&$temp)
_FileReadToArray($temp,$tm)
For $x = 1 to $tm[0]
$xy=StringSplit(StringStripWS ($tm[$x],8), ":")
If $xy[0]=2 Then
If $xy[1]=$pf Then
_RunDOS('mountvol '&$pf&': /d')
_RunDOS('mountvol M: '&StringStripWS ($tm[$x-1],8))
FileDelete($temp)
_start()
EndIf
EndIf
Next
EndIf
Func _start()
Run('游戏菜单.exe')
Sleep(1500)
Run('C:\WINDOWS\explorer.exe http://192.168.0.252/book/','C:\WINDOWS\')
Exit
EndFunc
#Region ### GUI圆角
Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ; thanks gafrost
Local $XS_pos, $XS_ret, $XS_ret2
$XS_pos = WinGetPos($h_win)
$XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
If $XS_ret[0]Then
$XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
EndIf
EndFunc
#endregion
Func _time()
$ti =$ti - 1
If $ti < 0 Then
MsgBox(16,'错误','连接服务器超时,请联系管理员!')
Exit
EndIf
GUICtrlSetData ( $label_tell, '正在连接服务器,请稍候……'&@TAB&$ti)
[ 本帖最后由 qin147 于 2008-8-25 18:37 编辑 ] |