Detect when an application...

Posted on 1998-03-28
Medium Priority
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
Question by:kort77
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

Accepted Solution

paulo_psa earned 30 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;

  Unit1 in 'UNIT1.PAS' {Form1};

{$R *.RES}

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



Expert Comment

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.


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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

771 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