Solved

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

Posted on 2004-04-06
3
451 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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 42
Microsoft Access combo box help 2 50
vbModal 12 57
transition to visual .net from vb6 5 41
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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