Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 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