You could have the unique ID in a file and open the file with exclusive
access (fmShareExclusive when using TFileStream.Create).  So if a second app
tries to open the file and can't cause the first has it open, just get it to
wait a bit and try again.

That type of thing worked in my dos days anyhow.


Nahum Wild

-----Original Message-----
From: Jason Webb [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 1 June 1999 11:33
To: Multiple recipients of list delphi
Subject: [DUG]: Two Delphi programs need a single source


I hope someone has some ideas as I'm stuck.

I have a situation where two delhi programs need to obtain an incrimenting
unique ID number from the single source.


So an example.

Delphi progrm 1 processes and gets unique ID 1000
Delphi program 2 processes and gets inque ID 1001
Delphi progrm 1 processes and gets unique ID 1002
Delphi program 2 processes and gets inque ID 1003
Delphi progrm 2 processes and gets unique ID 1004
Delphi program 2 processes and gets inque ID 1005
and so on....

So it's reasonably easy to use a single ini file or share a registry entry
but what hapens when both programs want to get a unique ID at the same time.

In future I'll have more delhi programs that need to get the uniqie ID form
the same source.


Thanks for any help.

Jason Webb



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to