Is my OCX already in use?
Posted on 2000-03-30
This is probably a bit strange but it is important...
I have an OCX that is going to have some very special code in it. This OCX is not to be used by more than one program at a time on any given machine (which I know is not the point of an OCX). I only want one copy running in memory and only one application to use it at any given moment.
Why? There are some hook codes in there along with special file connection routines. If more than one program access these commands problems could be caused. Such as a system crash when it comes to the hooks.
It is being written mainly to make it really easy to get various user interface forms and these routines into new programs without the need to recode or include the original code.
HERE IS THE QUESTION
In the initialization routine, is there a way to check if this routine is already in use by another program and send an error message or better yet trigger an event telling the calling program to shut down?
Help me detect another program already using this OCX. I can figure out how to best cause a program shut down later.