Solved

grabtext

Posted on 1998-12-20
6
141 Views
Last Modified: 2010-04-04
how can i build in Delphi an app that get every runing aplication em send it to a editbox?
0
Comment
Question by:lalala
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 1

Expert Comment

by:rpetruni
ID: 1352233
Pls be more specific, i don't untherstand what you wannt...
 do you wannt to count how many times your app is beein started?
0
 
LVL 1

Expert Comment

by:rpetruni
ID: 1352234
Pls be more specific, i don't untherstand what you wannt...
 do you wannt to count how many times your app is beein started?
0
 
LVL 10

Accepted Solution

by:
viktornet earned 200 total points
ID: 1352235
Try this one... This sends the name of the app to a ListBox and not to an Edit Box...

function GetWinProc(Handle : HWND;  lParam : LPARAM) : Boolean; stdcall;
var
  Name : array [0..MAX_PATH] of char;
begin
  if IsWindowVisible(Handle) then begin
    GetClassName(Handle, Name, sizeof(Name));
    if(strpas(StrUpper(Name)) = 'TAPPLICATION') then begin
      GetWindowText(Handle, name, sizeof(name));
      if strpas(name) <> '' then
        Form1.ListBox1.Items.Add(strpas(Name));
    end;
  end;
  Result := true;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  EnumWindows(@GetWinProc, 0);
end;

Hope this helps. If you need moe help with this, let me know and I'll help you till you're satisfied...

-Viktor
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!

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1352236
Viktor, This will only get Delphi applications!

The code below will put all names of all running processes (applications) into a treeview...

Cheers,

Raymond.

implementation

uses
  tlHelp32;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  hSnapshot : THandle;
  pe : TPROCESSENTRY32;
begin
  hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  if hSnapshot = THandle(-1) then
    Exit;

  pe.dwSize := sizeof(pe);
  if Process32First(hSnapshot, pe) then
    repeat
      TreeView1.Items.AddChild(TreeView1.items[0], pe.szExeFile);
    until not Process32Next(hSnapshot, pe);

  CloseHandle(hSnapshot);
end;

end.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1352237
lalala: Have you used an answer posted here? If so which one?

Cheers,

Raymond.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352238
Raymond, you going through all your proposed answers/comments? ;-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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