Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetActiveWindow
Message
From
02/06/2003 11:40:38
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
GetActiveWindow
Miscellaneous
Thread ID:
00795263
Message ID:
00795263
Views:
65
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
Next
Reply
Map
View

Click here to load this message in the networking platform