下面这个函数如何可以使用:
function GetHardwardIDs(const Drive: Char): string;
var
Buffer: array[0..MAX_PATH- 1] of Char;
hDevInst, DevInstParent: DEVINST;
Num: Integer;
begin
Result := '';
//根据设备取得设备号
Num := GetDeviceNumberByDrive(Drive);
if Num = -1 then Exit; hDevInst := GetDevInstByNum(Num);
if hDevInst = INVALID_HANDLE_VALUE then Exit;
FillChar(Buffer, MAX_PATH, 0);
CM_Get_Parent(DevInstParent, hDevInst, 0);
CM_Get_Device_ID(DevInstParent, Buffer, MAX_PATH, 0);
Result := StrPas(Buffer);
end;
GetHardwardIDs(Drive);
function GetHardwardIDs(const Drive: Char): string;
var
Buffer: array[0..MAX_PATH- 1] of Char;
hDevInst, DevInstParent: DEVINST;
Num: Integer;
begin
Result := '';
//根据设备取得设备号
Num := GetDeviceNumberByDrive(Drive);
if Num = -1 then Exit; hDevInst := GetDevInstByNum(Num);
if hDevInst = INVALID_HANDLE_VALUE then Exit;
FillChar(Buffer, MAX_PATH, 0);
CM_Get_Parent(DevInstParent, hDevInst, 0);
CM_Get_Device_ID(DevInstParent, Buffer, MAX_PATH, 0);
Result := StrPas(Buffer);
end;
GetHardwardIDs(Drive);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货