我正在尝试使用 GetProcessImageFileName但我收到以下错误:
Undeclared identifier: 'GetProcessImageFileName'
我已经尝试将 PsAPI
和 TlHelp32
添加到 uses 子句中,但它并没有解决问题。
最佳答案
我不确定这个函数是否由 RTL 在任何地方提供,但你总是可以直接导入它:
function GetProcessImageFileName(hProcess: THandle;
lpImageFileName: LPTSTR;
nSize: DWORD): DWORD; stdcall;
external 'PSAPI.dll'
name 'GetProcessImageFileNameA';
上面导入了 ANSI 版本(适用于 Delphi 2007)。或者,如果支持更高版本的 delphi(带有 unicode 字符串),您将有条件地导入 GetProcessImageFileNameW
。
关于windows - 如何使用GetProcessImageFileName?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40991522/