?
Solved

Detect program names currently running?

Posted on 1998-06-12
9
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 

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

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!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 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