只增加了19,20,21这三行。未测试#include <GuiConstants.au3>
Local $alldrive[2]=[0,0]
$gui = GUICreate("获取移动设备", 200, 200, -1, -1)
Local $DriverLabel = GUICtrlCreateLabel("请选择盘符:", 20, 55)
$DriverCombo = GUICtrlCreateCombo("", 100, 55, 70, 15)
GUISetState()
AdlibRegister("GetRemoveDriver", 2000)
While 1
$eMSG = GUIGetMsg()
Switch $eMSG
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func GetRemoveDriver()
$alldrive[1]=DriveGetDrive("all")
If $alldrive[1]<>$alldrive[0] Then
$alldrive[0]=$alldrive[1]
$ver = DriveGetDrive("REMOVABLE")
If Not @error Then ;搜索到移动设备
For $i = 1 To $ver[0]
$Driver = StringUpper(StringLeft($ver[$i], 1))
;将获取的盘符转换成大写并写入到下列控件中
GUICtrlSetData($DriverCombo, $Driver, StringUpper(StringLeft($ver[1], 1)))
;AdlibUnRegister('GetRemoveDriver')
Next
Else
GUICtrlSetData($DriverCombo, "None", "None")
EndIf
EndIf
EndFunc ;==>GetRemoveDriver
|