Solved

Detect program names currently running?

Posted on 1998-06-12
9
244 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
Technology Partners: 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 100 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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