Solved

Application clones

Posted on 1997-08-14
1
142 Views
Last Modified: 2010-04-06
Hi yee,

Can anybody tell me, how can I build such an application
under Delphi3 development environment, that my application can be started only once.

Thanks in advance

Andrew Kabdebon
0
Comment
Question by:bandi081497
1 Comment
 
LVL 3

Accepted Solution

by:
mirek071497 earned 50 total points
ID: 1341400
You can do this with FileMapping.

It is example :

procedure TForm1.FormCreate(Sender: TObject);
var hMapping : THandle;
begin
  hMapping := $FFFFFFFF;
  hMapping := CreateFileMapping( hMapping, nil, PAGE_READONLY, 0, 32, 'MyTestMap' );
  if( hMapping<>0 ) then
  begin
      if( GetLastError=ERROR_ALREADY_EXISTS ) then
      begin
        ShowMessage( 'Application is running' );
        ExitProcess(1);
      end
   end
   else
     begin
       ShowMessage( 'Error creating mapping' );
       ExitProcess(1);
      end;
end;

p.s. what we can do with you'r second question with the same name ?
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
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: …

757 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

23 Experts available now in Live!

Get 1:1 Help Now