Solved

Detect when an application...

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

Accepted Solution

by:
paulo_psa earned 10 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now