Solved

Application clones

Posted on 1997-08-14
1
145 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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