|
From: Pedro M. Espinosa on 7 Jul 2008 22:03 Hi all: I remember I saw this a long ago, but cannot find it. I want that whenever I open an specific window, if an instance of it is already open, just to give it focus and show it up front. And the same also for my app, i.e. just have one instance running. TIA Pedro
From: Stephen Quinn on 7 Jul 2008 23:03 Pedro > I want that whenever I open an specific window, if an instance of it > is already open, just to give it focus and show it up front. If calling from a menu METHOD MyWindow() CLASS MyShellWindow IF SELF:oWin = NULL_OBJECT SELF:oWin := MyWindow{ SELF } ENDIF SELF:oWin:Show() You'll need to do our own cleanup if you close it via the 'x' button Eg METHOD CloseMyWin() CLASS MyShellWindow IF SELF:oWin != NULL_OBJECT SELF:oWin:Close() SELF:oWin := NULL_OBJECT ENDIF RETURN CYA Steve
From: Alessandro Antonangeli on 8 Jul 2008 04:37 Hi Pedro, this is to get what you need for the application local sNomeApplicazione as string local hApplicazione as ptr sNomeApplicazione:="Name of Your application" hApplicazione := FindWindow(NULL_PSZ, PSZ(sNomeApplicazione)) IF (hApplicazione != NULL_PTR) SetForegroundWindow(hApplicazione) //Mette in primo piano l'applicazione gi� in esecuzione ShowWindow(hApplicazione,SW_RESTORE) //Visualizza l'apllicazione se � iconizzata RETURN 0 //e chiude ENDIF
From: Kevin on 8 Jul 2008 12:25 Pedro, If you want to allow the user to open more than one window but allow only one instance of a particular window then do the following: 1. Create the open method on the ShellWindow (child windows call this) 2. In the above method call the GetAllChildren method of the ShellWindow - this will return an array of all child windows 3. Scan the array returned in step 2 and check for the window you are opening 4. If found use its SetFocus method, otherwise open it Hope this helps. Kevin Pedro M. Espinosa wrote: > Hi all: > I remember I saw this a long ago, but cannot find it. > I want that whenever I open an specific window, if an instance of it > is already open, just to give it focus and show it up front. > And the same also for my app, i.e. just have one instance running. > TIA > Pedro --
|
Pages: 1 Prev: VODC 08 - German Vulcan Conference Announcement Next: Changing from VO2.7 to 2.8 |