Solved

Detect when an application...

Posted on 1998-03-28
2
184 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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 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