?
Solved

Detect program names currently running?

Posted on 1998-06-12
9
Medium Priority
?
249 Views
Last Modified: 2010-04-03
Using Delphi 1 (preferably) is there code available that would enable my application to detect the names of the programs currently running in memory?  (Preferably the text that appears in the program's title bar.)

0
Comment
Question by:Kapusta
9 Comments
 
LVL 4

Expert Comment

by:d003303
ID: 1352491
See
http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10042477
Cost only 1 point with an excellent answer from inter.

Slash/d003303
0
 
LVL 5

Expert Comment

by:inter
ID: 1352492
Wow,
Thanks for your compliment friend,
Igor
0
 

Author Comment

by:Kapusta
ID: 1352493
Slash,

Yes, you are correct.  The example was excellent.  Thank you "inter/Igor" also.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
jannes earned 400 total points
ID: 1352494
{Here's the unit you need}

unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure StringGrid1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  Form1: TForm1;

implementation
uses ToolHelp;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
Var
  te: TTaskEntry;
  MoreTasks: Boolean;
  count: Integer;
  buffer: Array [0..80] of Char;
begin
  With StringGrid1 Do Begin
    FixedCols := 0;
    Cells[0,0] := 'hTask'; {Headings for the information.}
    Cells[1,0] := 'hInst';
    Cells[2,0] := 'hModule';
    Cells[3,0] := 'ModuleName';
    Cells[4,0] := 'Filename';
    te.dwSize := Sizeof(te);

    count := 1;
    MoreTasks := TaskFirst( @te );
    While MoreTasks Do Begin
      If RowCount <= count Then RowCount := count + 1;
      Cells[0, count] := '$' + IntToHex( te.hTask, 4 );
      Cells[1, count] := '$' + IntToHex( te.hInst, 4 );
      Cells[2, count] := '$' + IntToHex( te.hModule, 4 );
      Cells[3, count] := StrPas( te.szModule );
      GetModuleFilename( te.hModule, buffer, 81 );
      buffer[80] := #0;
      Cells[4, count] := StrPas( buffer );

      MoreTasks := TaskNext( @te );
      inc( count );
    end;
  end;
end;

procedure TForm1.StringGrid1Click(Sender: TObject);
begin
  with StringGrid1 do {To see the strings that don't fit the cell.}
    caption := cells[col, row];
end;

end.

0
 
LVL 5

Expert Comment

by:inter
ID: 1352495
Hi, TOOLHELP is fine but it sadly does not work on NT.
Regards, Igor
0
 

Author Comment

by:Kapusta
ID: 1352496
>> TOOLHELP is fine but it sadly does not work on NT.


Will it work with Delphi 2/3 under Win 95/98?
0
 
LVL 5

Expert Comment

by:inter
ID: 1352497
Yes,
check your system32 dir for toolhelp32.dll(or something like that)
Igor
0
 

Author Comment

by:Kapusta
ID: 1352498

>> check your system32 dir for toolhelp32.dll(or something like that)

Are you saying that TOOLHELP and TOOLHELP32 are both DLLs?   I just assumed that TOOLHELP was a PAS file somewhere in the search path.   If these TOOLHELPs are DLLs, then that must mean I must distribute this DLL with my application?  No?
0
 
LVL 5

Expert Comment

by:inter
ID: 1352499
Hi friends,
NO. do not worry, toolhelp is a DLL library which is a common system component for Win95(if Microsoft will not suprise use).  ToolHelp.pas is and interface unit to that dynamic link library. You do not need to distribute it. In the current situation if one has Win95 and does not have that library thatll be weird. So use it do not worry.
Regards, Igor
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question