Archived

This topic is now archived and is closed to further replies.

Windows permissions

This topic is 5399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How would one find if there were more then one instances of an application running? Is there a sequence were an application needs to request permission from Windows before it can be instantiated? If so, is it controllable? How would one find out if another instance of there application is trying to run, and then close it out immediately? This should be done programmatically of course, but how?

Share this post


Link to post
Share on other sites
quote:
Original post by sakky
How would one find if there were more then one instances of an application running?


Use the toolhelp functions on newer versions of windows and psapi on NT4. If the program itself needs to know if other instances of itself are running, use a mutex.

quote:
Original post by sakky
Is there a sequence were an application needs to request permission from Windows before it can be instantiated? If so, is it controllable?


A different terminology is used with Windows.

quote:
Original post by sakky
How would one find out if another instance of there application is trying to run, and then close it out immediately? This should be done programmatically of course, but how?


google: single instance mutex

Share this post


Link to post
Share on other sites
I need this for Internet Explorer. I need to find out if there is another instance of IE running. When it requests permission from windows to be created I want it to be denied. I also need to know how I can read javascript in webpages prior to IE reading them then if there safe to go ahead and load them. This is for a popup blocker.

Share this post


Link to post
Share on other sites
What I do, which is probably the worst way to do it, but it worked for my needs was just make sure that I used a unique class name for the app, and before the I register the class for the app, I use the FindWindow function to make sure that the class has not been registered before. If it was, then kill that instance of the program, if it wasn''t, then keep running.

Share this post


Link to post
Share on other sites
Rather than going through all that trouble to accomplish very little, why not simply write a proxy program like Proximitron. You configure IE (or whatever your browser you have) to use a proxy server on 127.0.0.1:8000 (or any other free port of your choosing), then have your program act as a proxy on that port (forwarding and filtering data from port X to port 80, and vice versa). In this way you can control exactly what IE (or any other browser) sees and what IE can tell. Since it is highly configurable you might even be able to use Proximitron to do what you want.

Share this post


Link to post
Share on other sites