Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to have only one instance of your application run on a PC. Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
force one copy of your application to run. 22-Jan-04
Category
Win API
Language
Delphi All Versions
Views
623
User Rating
8
# Votes
3
Replies
1
Publisher:
Darley, F. Joe
Reference URL:
			1   
2   procedure TForm1.FormCreate(Sender: TObject);
3   var
4     iHandle:Hwnd;
5   begin
6      Application.Title:='Temp'; //sets your application title to temp
7   
8   //looks for a pervious copy is running or not
9      iHandle:=Findwindow(pchar('TApplication'),pchar('One Copy'));
10    if iHandle>0 then begin // if found then display message
11  
12     messagedlg('You can only have one copy of this application running on a 
13  PC!'rror,[mbok],0);
14     application.Terminate; //terminates application
15  
16     exit;
17    end;
18  
19    //sets back to the current application title;
20    Application.Title:='One Copy';
21  end;
22  



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC