Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maximizing an iconized exe
Message
De
25/11/2003 09:02:36
 
 
À
25/11/2003 07:51:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00853210
Message ID:
00853252
Vues:
21
Hello Francesco;
>
>I mean an exe called with the "RUN myexe...": I need API statement

All applications on OS. receives a number named HANDLE.. This procedures gets this #HANDLE based on it's Windows captions.. The best deal was if you use some special character on it's title..
Declare Sleep IN Win32API;
    INTEGER dwMilliseconds

Declare INTEGER GetActiveWindow ;
    IN Win32API

Declare INTEGER GetWindow IN Win32API ;
    INTEGER HWND, INTEGER nType

Declare INTEGER GetWindowText IN Win32API ;
    INTEGER HWND, STRING @cText, INTEGER nType

Declare INTEGER BringWindowToTop IN Win32API ;
    INTEGER HWND

Declare integer SetActiveWindow in user32.dll ;
    integer hwnd

oShell = CREATEOBJECT("WScript.Shell")

nhandler = 0
ntetivas = 0
*
Do while nhandler = 0 .and. ntetivas < 99
    nhandler = ais_running("My form caption")
    ntetivas = ntetivas + 1
Enddo
* is running, so activate it
If  nhandler = 0
    * application not  running, run it
Else
    BringWindowToTop(nhandler)
    Wait window "Activating windows.. Wait !!" nowait
    SetActiveWindow(nhandler)
Endif
return

Function ais_running
* check if a given application is running
Lparameter ctitle
*
hnext = GetActiveWindow()
*
* iterate through the open windows
Do WHILE hnext<>0
    cText = REPLICATE(CHR(0),80)
    GetWindowText(hnext,@cText,80)         && get window title
    If  UPPER(ALLTRIM(ctitle)) $ UPPER(cText)
        *
        Return hnext
    Endif
    hnext = GetWindow(hnext,2)            && next window
Enddo
* required window not found
Return 0
Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform