Solved

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

Posted on 2004-04-06
3
447 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
Comment Utility
0
 
LVL 2

Author Comment

by:molar
Comment Utility
Thanks mirzas, Just what I needed.
0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now