请问如何将检测出的U盘盘符和容量分别传递给text1和text
VFP9.0,把下面代码放到你的 Combo1 控件的 Init 事件:This.Clearm.loWMI = Getobject("winmgmts:\\.\root\cimv2")m.loDisks = m.loWMI.ExecQuery([Select * From Win32_DiskDrive Where InterfaceType="USB"])m.loParts = m.loWMI.ExecQuery([Select * From Win32_LogicalDiskToPartition])For Each m.loDisk In m.loDisks m.lcDevID = 'Disk #' + Transform(m.loDisk.Index) For Each m.loPart In m.loParts If At(m.lcDevID, m.loPart.Antecedent) > 0 This.AddItem(Strextract(m.loPart.Dependent, [DeviceID="], ["], 1)+' 容量:'+Transform(Diskspace(Strextract(m.loPart.Dependent, [DeviceID="], ["], 1),1)/1024/1024/1024)+'G') Endif EndforEndforRelease m.loWMI然后再加个 Timer 控件,此控件的 Interval 值为1000,意思是1秒执行一行此控件的 Timer 事件代码为:This.Enabled= .F.Thisform.Combo1.Init()This.Enabled= .T.