We
solved the problem using a little pointer manipulation. I did try this long ago,
but I did not realist that I needed to cast my pointer as PChar to do pointer
arithmetic.
procedure
TForm1.Button1Click(Sender: TObject);
var LProcessInfoArray: PWF_PROCESS_INFO; LProcessInfo: PWF_PROCESS_INFO; LCount: DWord; var i: Integer; begin if EnsureWFAPIDLLLoaded then begin if WFEnumerateProcesses(WF_CURRENT_SERVER_HANDLE, 0, // reserved 1, // version 1 @LProcessInfoArray, LCount) then begin LProcessInfo := LProcessInfoArray; for i := 0 to LCount - 1 do begin LProcessInfo := PWF_PROCESS_INFO(PChar(LProcessInfoArray) + (i * SizeOf(WF_PROCESS_INFO))); end; WFFreeMemory(LProcessInfoArray); end; end; end; Stacey
|