Solved

Which way to semaphore? File? Registry? CreateWindow? Something else?

Posted on 2004-04-06
3
452 Views
Last Modified: 2008-02-26
I am writing a class which sometimes needs to pass semaphores (interprocess flags) to other instances of itself.  (I don't want some functions run by more than one instance of the class on the same machine simultaneously.)  I am hoping to distribute the class for use in a wide variety of environments and have been trying to figure out the best way to semaphore.

The component may be installed in an environment where it is not able to write to the disk, so I can't rely on temporary files.

I have considered using registry read/writes, but as it is possible to protect the registry, I am guessing that I can't really rely on any given key in the registry being writable either, plus I guess there's a bit of a performance overhead if I have to keep reading and writing to the registry all the time.

My current best guess is to use CreateWindow and FindWindow API calls, to create a window, and then check for it's existence. The only problem I can see with this method is that it assumes a single device context and so would probably not work in Terminal Server/Citrix environments.

Is there another method that I don't know about. How do you guys do it?
0
Comment
Question by:molar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
mirzas earned 500 total points
ID: 10764062
0
 
LVL 2

Author Comment

by:molar
ID: 10764985
Thanks mirzas, Just what I needed.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 10765000
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

732 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