1

我已经从这里和以下部分测试了代码

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

编译时...

Undeclared identifier InfName and InfSection

我该如何解决?还有其他适当的变体吗?

4

1 回答 1

2

DeviceHelper似乎是链接代码中未包含的类或记录,但除了您发布的行之外,它也没有在其他任何地方使用(为了方便其他人,我将在该代码的最底部提及) . 因此,您可以将它们声明为局部变量,为InfNameand分配您想要的值InfSection,然后继续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);
于 2012-08-11T21:42:54.357 回答