Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ER - only allow the app to run once
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00688594
Message ID:
00688716
Vues:
33
>Seems I've just loaded some more work on my shoulders < g >. There should a way to find out the handle of the parent window (= VFP main window), so we could use your piece of of code where you bring the window on top. BTW: I wouldn't maximize it, restoring it should be ok.
>

I decided to maximize it thinking that they may have goofed up the window position or something weird. I want them to be able to find my app ;-)

>I will have a look into this in the next days and post the result.
>

I was hoping there was an API call that would do a wildcard-type search on the window name. No such luck. You can use EnumWindows from a DLL to look through the windows for you, though. Hmm...I wonder if the GetParent() API call would work? That would be a lot easier, assuming it works.

OK, I just tested it and it (appears) to work. I added a property called cAppID to goApp; this stores my applications unique name. My new code looks like:
#DEFINE SW_MAXIMIZE		   3   

LOCAL llRunning, ;     
      lnHWnd, ;
      lnParentHWnd

llRunning = .F.

IF WEXIST("_Semaphore_")
   RETURN .T.
ENDIF

lnHWnd = FindWin(This.cAppID)		

IF lnHWnd <> 0   
   
   DECLARE INTEGER ShowWindow IN user32 ;
           INTEGER hwnd, ;
           INTEGER nCmdShow
   
   DECLARE INTEGER GetParent IN user32 ;
           INTEGER hwnd
           
   lnParentHWnd = GetParent(lnHWnd)

   ShowWindow(lnParentHWnd, SW_MAXIMIZE)

   llRunning = .T.
ELSE
   DEFINE WINDOW _Semaphore_ IN DESKTOP FROM 1,1 to 2,2 TITLE This.cAppID
ENDIF

RETURN llRunning
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform