Reputation: 8043
I'm trying to use GetProcessImageFileName but I'm getting the following error:
Undeclared identifier: 'GetProcessImageFileName'
I've tried adding PsAPI
and TlHelp32
to the uses clause but it has not solved the problem.
Upvotes: 1
Views: 2999
Reputation: 31433
I'm not sure if this function is supplied by the RTL anywhere, but you can always just import it :
function GetProcessImageFileName(hProcess: THandle;
lpImageFileName: LPTSTR;
nSize: DWORD): DWORD; stdcall;
external 'PSAPI.dll'
name 'GetProcessImageFileNameA';
The ANSI version (for Delphi 2007) is imported above. Alternatively, if supporting higher versions of delphi (with unicode strings) you would conditionally import GetProcessImageFileNameW
.
Upvotes: 4