windows - 如何使用GetProcessImageFileName?

标签 windows delphi delphi-2007

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

Undeclared identifier: 'GetProcessImageFileName'

我已经尝试将 PsAPITlHelp32 添加到 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/

相关文章:

windows - Eclipse,导入项目但不复制

windows - aws cli 没有输出

delphi - Delphi和PowerPoint

delphi - 如何在Windows 7上插入工作的TAB字符?

delphi - 为什么释放内存后我的程序的内存使用量没有恢复正常?

delphi - 创建自定义表单设计器

c - Visual Studio - 找不到 ntoskrnl.exe

ruby - Windows 中的 `gem install berkshelf` 失败

delphi - RTTI TRttiMethod.Invoke、stdcall 和 const 参数的错误

delphi - 无法加载 SSL 库