Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maximizing an iconized exe
Message
De
15/02/2004 06:08:09
 
 
À
20/01/2004 08:43:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00853210
Message ID:
00877472
Vues:
23
Claudio, "hnext = GetWindow(hnext,2)" return .F. not the next window handle. Showwindow(nhandle,1) only do what I need, but not complitely because shows the window as a child window: Showwindow(nhandle,2) do nothing. Sorry if I do not understand easy, but this is not my job, is my hobby!
Francesco

>>
>>this works only for windows in one executable program, not for external executable program. I have no problem to get the handle of the external executable programs, but I do not know how to maximize and kill the external executable program within VFP, the right code...
>>sorry for the answer so late
>
>Hello Francesco;
>
>What you meant ? There is external applications and applications running into the VFP's environment..
>
>
>The process to get #handler of an application, it is generally based on their captions..
>
>So, no diferences must have in your application..
>
>Claudio
>
>>>>
>>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform