Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetActiveWindow
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
GetActiveWindow
Divers
Thread ID:
00795263
Message ID:
00795263
Vues:
66
Hello,

I want to do check the name of the currently active window, using GetActiveWindow(). But what happens is, that the window handle is zero when the VFP application is not anymore active.

For example, when minimizing the VFP application and opening Paint, the VFP application should find the active window, that is Paint, but the window handle is zero (I use a time to check this). When I activate the VFP appliation again, then the window handle is OK, and it shows the right active window name.

The code is like this:
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindowText IN Win32API ;
INTEGER hwnd, STRING @lptstr, INTEGER cbmax

LOCAL lnhwnd, lctitle_bar, lntext_len
lnhwnd = GetActiveWindow()
lctitle_bar = SPACE(200) + CHR(0)
lntext_len = GetWindowText(lnhwnd, @lctitle_bar, 200)
lctitle_bar = UPPER(LEFT(lctitle_bar, lntext_len))
IF !EMPTY(lcTitle_bar)
? lcTitle_Bar
ENDIF
Christian Isberner
Software Consultant
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform