rejetto forum
May 21, 2012, 09:56:29 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [HELP] only 1 instance  (Read 2074 times)
0 Members and 2 Guests are viewing this topic.
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11822


View Profile
« on: November 20, 2003, 07:19:57 AM »

i want to make this feature

as far as i got, when a new instance is started, i have to use DDE to pass datas to the old instance, then terminate

the problem is: i'm not able to use DDE in delphi, i spent several hours on it, but...ugh...nothing

please help
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11822


View Profile
« Reply #1 on: March 17, 2004, 11:13:48 AM »

after 4 months, leo suggested me to use WM_COPYDATA
i will try later
Logged
Anonymous
Guest
« Reply #2 on: March 17, 2004, 01:31:36 PM »

i think its no problem if there will be only one instance
Logged
Anonymous
Guest
« Reply #3 on: March 17, 2004, 06:34:37 PM »

can you use mutex?

http://www.google.com/search?q=mutex+instance+delphi

http://www.ibrtses.com/delphi/singleinstance.html

i played with a delphi dde demo some time ago
it created a window with a counter
the second program used dde to connect to the first program
and transferred the count using dde
so the second window was counting in sync with the first

it seemed like a lot of code to do something so simple

linux apps often uses lock files
the first instance of hfs would check to see a file called C:\HFS.LOC exists
if it doesn't, it starts and creates the file
a second instance of hfs would see the lock file, and shut down
when the first instance shuts down, it deletes the lock file
the trouble is, if hfs crashes, the lock file may not be deleted
this happens to linux apps sometimes ... you have to delete the lock file to start the app again
Logged
Anonymous
Guest
« Reply #4 on: March 17, 2004, 06:47:58 PM »

if you want to prevent a new instance maybe you can use mutex

if you want to pass information from the old to the new
then shut down the old
maybe a temp file or registry key could pass the parameters
like C:\~HFS.TMP maybe
it would require hfs to watch for the creation of the file

i guess dde would be a more elegant method
Logged
Anonymous
Guest
« Reply #5 on: March 17, 2004, 07:11:13 PM »

would a component like this work?

http://www.torry.net/instance.htm

OneInstance v.2.3    FWS   5 Kb

By Andrew Johnson. To allow only a single instance of an application - can warn user, terminate new instance, use custom handler, and/or Raise Former Instance of Application when another instance is found. Simply drop one on your main form.
 
Fully functional
Source: Included

if the licence is not suitable, you can see how it works and write your own
Logged
rejetto forum
« Reply #5 on: March 17, 2004, 07:11:13 PM »

Do you like this software? Consider even $2
 Logged
Anonymous
Guest
« Reply #6 on: March 17, 2004, 07:18:24 PM »

how about this?

http://www.programmersheaven.com/zone2/cat69/29762.htm

Multiinstance 1.1
TMultiInstance component controls behavior of multiple intances of the same program. Default allows only one instance of program. Next instance terminates immediatly. Behaviour is configurable in program.

Language:    Delphi 5-6-7
Platform:    Windows 2000-95-98-CE-ME-NT-XP
File type:    Open Source
Size:    3 KBytes
Price/fee (US$):    0.00$
Logged
Anonymous
Guest
« Reply #7 on: March 17, 2004, 07:40:31 PM »

maybe this might help?

http://delphi.about.com/library/weekly/aa100703a.htm
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11822


View Profile
« Reply #8 on: March 18, 2004, 04:55:12 AM »

Quote from: "Suicide"
i think its no problem if there will be only one instance
it won't be a problem
it will be a feature
Smiley


many thanks Guest, i will have a look at those resources
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 16, 2012, 07:50:03 PM
anything