-
if i have a program that hide her window...
now the user run another copy of her.
i don't want the other copy to run(thats i know how to do)
but i want that the hide window will know that the user try
to run another copy of her and respond...
somebody have and idea how i do it???
-
If I correctly understand your post, you want only a single instance of the program to run at a time, no other copies running on the computer, check this vb-world tips section, I am positive there is something there about only one instance of your program.
-
no ...
i mean that i want that the hide program to know when the user try to run another copy (how to prevent the other copy to run , this i know!).
but thanks anyway...
-
I see, with the normal only run one thing, the copy thats new knows it's a second copy then closes, but the original copy will not know another has been opened. hmm, maybe a timmer checking the the classname, or a DDE session to tell the original copy before closing the new.
-
If "the other app" is yours, you may put a code that does it instead by itself:
Code:
if app.previnstance then unload me
Also it's preferable to put this in a sub main so you wont even need to load any forms
Code:
if app.previsntance then exit sub
-
but he wants his currently opened program to detect the attempt to run a second copy.
-
Sorry i missunderstood, well you can check for the running window classname, using findwindow api, also if you don't have a window in that app you could enumerate the the processes
-
i have a question...
i think i can do it like this:
when the prog start she write a file with her DC, when you run antoer copy it checks the app.previnstance and if it's True then he get the DC (from the file) of the run copy and just show it (if it hide...) or send it any other message and kill it self.
i try it...
-
I would suggest using the window handle (HWND) rather than the device context, as VB has a habit of reorganising those.