2012-08-11 81 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