Solved

Detect when an application...

Posted on 1998-03-28
2
182 Views
Last Modified: 2010-04-06

   How can i detect when an application starts and
   how when finish???

                 !!!Thanks for your time!!!

    e-mail: scortega@javercol.javeriana.edu.co
0
Comment
Question by:kort77
[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 Comments
 

Accepted Solution

by:
paulo_psa earned 10 total points
ID: 1361000
Hi kort77,

Use HPrevInst to analize the handle of previous instance. If "0"  then the application run just once.

Note: You need add the units(Dialogs and WinProcs).

program Project1;

uses
  Forms,
  Dialogs,
  WinProcs,
  Unit1 in 'UNIT1.PAS' {Form1};

{$R *.RES}

begin
  if HPrevInst = 0 then
  begin
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end else
  begin
    ShowMessage('Application is already running');
    SetFocus(FindWindow('TForm1', nil));
  end;

end.

Regards
0
 

Expert Comment

by:mmmbeer
ID: 1361001
Hiya kort77.  If you're looking to track the start and stop of programs other than yours, a good way to do THAT is to SetWindowsHookEX with the WH_SHELL parameter.  Then, you'll get a callback for every top-level window created.  I'd assume from there that you should be able to determine when apps start and stop.

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

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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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