Hi, i find a tip to launch one instance of my app, but how do i show the first window when the user want to launch it for the second time. FindWindow need the name of the class, since my app is a dialog based application i can't do that. can anyone tell me how to find the HWND of my dialog based app ?
I recommend you to use the Mutexes to prevent multiple application instances... it's better, faster, more secure than the FindWindow tip. You will find some interesting information about that on this page. Happy coding. This message was edited by Readiosys, on 5/9/2001 7:05:55 AM
thanks for replying, i've read this article, and i've used the third method (the one who used the Atom table), but the problem wasn't that. i'm gonna re-explain it : i want to show my app, when the user click for the second time on the icon (the first one, launch the app, and register a string in the atom table, and the second one, found that there's a string matchin, and before exit, it show the app, so the user know that there's an instance there), but i don't know how to get the handle of my window, since it is a dialog based app how do we can retrieve the handle, of a dialog based app ?
You got the handle in your DialogProc so you might wanna use the broadcast method and send back the hwnd in response to the calling app.
I would suggest using an event to sync between processes as it is the least complicated global object. Lookup CreateEvent
Download ErrShow from Iczelion site. It's exactly what you need. Start code shows how to communicate between two instances of dlg based apps. It not only prevent the second instance from running but also in start on second instance brings the first on top and even pass parameters of command line from second instance to the first and make the first instance to react on parameters passed to the second instance. How to get handles and class names in dlg apps all shown. The Svin.
i didn't find the file "ErrShow" of the Iczelion site can u give a link, where i can download it ? thanks
It's called ErrorShow. I can see it on the first page of Iczelion site.