Solved

Detect program names currently running?

Posted on 1998-06-12
9
242 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Check Delphi Seattle IOS app without MAC ? 1 97
Reconfigure Delphi Install? 2 51
Wincontrol not (correctly) drawn 15 38
firemonkey keyboard covers the controls 1 25
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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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