Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Maximizing an iconized exe
Message
From
25/11/2003 09:54:40
 
 
To
25/11/2003 09:02:36
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00853210
Message ID:
00853279
Views:
23
>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
OK Claudio, thank you
Francesco
Previous
Reply
Map
View

Click here to load this message in the networking platform