如何使用GetProcessImageFileName?

时间:2016-12-06 09:07:44

标签: windows delphi delphi-2007

我正在尝试使用GetProcessImageFileName,但我收到以下错误:

  

未声明的标识符:'GetProcessImageFileName'

我尝试将PsAPITlHelp32添加到uses子句中,但它没有解决问题。

1 个答案:

答案 0 :(得分:4)

我不确定RTL是否在任何地方提供此功能,但您可以随时导入它:

function GetProcessImageFileName(hProcess: THandle; 
                                 lpImageFileName: LPTSTR;
                                 nSize: DWORD): DWORD; stdcall;
                                 external 'PSAPI.dll' 
                                 name 'GetProcessImageFileNameA';

上面导入了ANSI版本(适用于Delphi 2007)。或者,如果支持更高版本的delphi(使用unicode字符串),您将有条件地导入GetProcessImageFileNameW

相关问题