Solved

Detect program names currently running?

Posted on 1998-06-12
9
240 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now