跪求高手帮我写一个控件
希望大家不要来鄙视我,我没学过VB,之前一直都是在C/C++板块混的
下面我有个从网上查到的VB的代码,是查询U盘的VID,我想弄成个控件,我可以引入到C程序中去,希望高手们帮我写下
Private Sub Command1_Click()Text1.Text = CCEnd SubFunction CC() On Error Resume Next Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * From Win32_USBHub") For Each objItem In colItems a = objItem.DeviceID 'U盘识别为:USB\VID_09A6&PID_800\20040418154911-00,故用VID判别 If a Like "*VID*" Then b = Split(a, "\") CC = b(UBound(b)) '上句亦可:If InStr(a, "VID") Then b = Split(a, "\"): MsgBox b(UBound(b)) NextEnd Function