2012-08-11 55 views
1

我已經測試的代碼from here,並在後續部分如何獲取設備的驅動程序文件?

begin 
    Paths := TStringList.Create(); 
    try 
    ParseInfFile(LocateInfFile(DeviceHelper.InfName), DeviceHelper.InfSection) 
    ... 
... 

當編譯...

Undeclared identifier InfName and InfSection 

我該如何解決呢?有其他人適當變異?

+1

我刪除了C#標籤,因爲沒有什麼,甚至遠程與C#在這個問題上。 – 2012-08-11 20:29:16

回答

2

DeviceHelper似乎是一個沒有包含在鏈接代碼中的類或記錄,但它在其他任何地方也不會被使用,除了在您發佈的行中(爲了方便其他人,我會提到的是該代碼的底部)。所以,你可以聲明爲局部變量代替,指定要用於InfNameInfSection值,並進行無DeviceHelper

var 
    InfName, InfSection: string; 
begin 
    InfName := 'WhatEver.Inf'; 
    InfSection := 'WhatEverSection`; 
    Paths := TStringList.Create(); 
    try 
    ParseInfFile(LocateInfFile(InfName), InfSection); 
    ... 

    // You'll need to remove these lines, too. They add the returned items 
    // to a TListView using functionality that's available in Vista and above 
    ListView_InsertGroup(lvAdvancedInfo.Handle, 'Driver Files', 2); 
    for I := 0 to Paths.Count - 1 do 
    ListView_AddItemsInGroup(lvAdvancedInfo, '', Paths[I], 2); 
+0

感謝您的回覆。 是的,我知道這些變量(InfName,InfSection)不包含在DeviceHelper中,有什麼方法可以自動獲取inf的名稱和存儲驅動程序文件路徑的部分?因爲通過這種方式,我必須手動完成這一切,驅動程序由司機。 – user1591987 2012-08-13 04:27:45