如何获取到组合列表框的值?
谢谢。
现在只能读到到D:\Personal,我想能正常选择其他目录时,也能获取到当前选择的什么值?
#RequireAdmin
; *** Start added by AutoIt3Wrapper ***
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;复制文件显示进度条功能api
#include <APIShellExConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIShellEx.au3>
;包含数据函数文件
#include <File.au3>
#include <Array.au3>
Dim $Input_Personal_TargetDir
Dim $Input_Personal_TargetDir_Read,$TestDir,$Input_Personal_TargetDir_Read2
$Form1_1 = GUICreate("个人文件转移工具 v1.0.20231002", 441, 601, 465, 114)
$Label_Dir = GUICtrlCreateLabel(" 目标文件夹:", 36, 471, 73, 20)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
;$Input_Personal_TargetDir = GUICtrlCreateInput("D:\Personal", 129, 471, 218, 21) ;要转移到的目录
$Input_Personal_TargetDir = GUICtrlCreateCombo("D:\Personal", 129, 471, 218, 21) ;要转移到的目录 20240521注释
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
;GUICtrlSetState(-1, $GUI_DISABLE)
;取磁盘分区盘符并添加到组合框中
Local $aArray_TargetDir = DriveGetDrive($DT_FIXED)
If @error Then
; 检索驱动器时出现错误.
MsgBox($MB_SYSTEMMODAL, "", "检索驱动器时出现错误.")
Else
For $i = 2 To $aArray_TargetDir[0] ;i从2开始读取,0是分区数量,1是C盘
; 显示找到的所有驱动器, 并将驱动器盘符转换为大写.
;MsgBox($MB_SYSTEMMODAL, "", "驱动器 " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i]))
;GUICtrlSetData($Input_Personal_TargetDir, StringUpper($aArray_TargetDir[$i])&"\Personal", $aArray_TargetDir[2])
GUICtrlSetData($Input_Personal_TargetDir, StringUpper($aArray_TargetDir[$i])&"\Personal")
$Input_Personal_TargetDir_Read=GUICtrlRead($Input_Personal_TargetDir)
Next
EndIf
MsgBox(0,"test",String($Input_Personal_TargetDir_Read),2)
;GUICtrlSetData($Input_Personal_TargetDir, $Input_Personal_TargetDir_Read)
;$Input_Personal_TargetDir = GUICtrlCreateCombo($Input_Personal_TargetDir_Read, 129, 471, 218, 21) ;要转移到的目录
;GUICtrlSetData($Input_Personal_TargetDir, $Input_Personal_TargetDir_Read)
;$Input_Personal_TargetDir = $Input_Personal_TargetDir_Read
$Button3_Test = GUICtrlCreateButton("测试", 64, 550, 83, 31)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button3_Test ;临时测试
MsgBox(0+32+64,"Info",$Input_Personal_TargetDir_Read,5)
;Exit
EndSwitch
WEnd
|