Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:15:23+00:00 2026-06-11T04:15:23+00:00

I am using this non visual open source component called TProcessInfo to get a

  • 0

I am using this non visual open source component called TProcessInfo to get a list of processes, the ProcessID and the full path which I put into a ListView.

The code I am using to do this:

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
  Process: TProcessItem;
begin
  for i := 0 to ProcessInfo1.RunningProcesses.Count -1 do
  begin
    Process := ProcessInfo1.RunningProcesses[i];
    with lv.Items.Add do
    begin
      Caption := Process.ExeFile;
      SubItems.Add(IntToStr(Process.ProcessID));
      SubItems.Add(Process.FullPath);
    end;
  end;
end;

The code will always break on the last line: SubItems.Add(Process.FullPath); and I receive an Error Message:

System Error. Code: 87
The Parameter is incorrect.

The code that gets the FullPath in the Component is:

function TProcessItem.GetFullPath: TFileName;
var
  hProcess: THandle;
begin
  hProcess := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,False,FProcessID);
  if hProcess <> 0 then
  begin
    try
      SetLength(Result,MAX_PATH);
      FillChar(Result[1],Length(Result) * SizeOf(Char), 0);
      if GetModuleFileNameEx(hProcess,0,PChar(Result),Length(Result)) > 0 then
        Result := Trim(Result)
      else
       RaiseLastOSError;
    finally
      CloseHandle(hProcess)
    end;
  end
  else
    RaiseLastOSError;
end;

If like the Error states – the parameter is incorrect, then how can I change this?

** The component uses PsAPI and I am using Delphi XE2 on Windows 7 Ultimate x64 also happens on Windows XP Pro x86

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:15:25+00:00Added an answer on June 11, 2026 at 4:15 am

    This happens because “System Idle Process” has PID = 0 and OpenProcess fails with such a ProcessID value. Patch the library to avoid using it or uset try/except in your loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get this done in a C++ program on Windows, using visual
I know how to implement the non generic IEnumerable, like this: using System; using
I've purchased a non-consumable product using my test user, but when I call this:
Problem Description: Occassionally when debugging, I get the following error. I'm using visual studio
I get this error in my c++ code Variable length array of non-POD element
Using the Source Control Explorer for TFS in Visual Studio, is there a way
In Visual Studio 2012RC there are some non-standard extensions. For example this code compiles:
I am using Visual Studio 2010 and this morning the Project Components in my
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using this to load the json var jsonParsed = JSON.parse(localStorage.getItem('test')); Using this to save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.