DO declare
LOCAL hWindow
hWindow = GetActiveWindow()
? "GetActiveWindow():", hWindow
? "Window Class:", GetWindowClass(hWindow)
? "Window Caption:", GetWindowCaption(hWindow)
?
? "_vfp.hWnd:", _vfp.hWnd
? "_screen.hWnd:", _screen.hWnd
? "_SCREEN.Caption:", _screen.Caption
FUNCTION GetWindowClass(lnWindow)
LOCAL lnLength, lcText
lcText = SPACE(250)
lnLength = RealGetWindowClass(lnWindow,;
@lcText, Len(lcText))
RETURN IIF(lnLength > 0,;
Left(lcText, lnLength), "#empty#")
FUNCTION GetWindowCaption(lnWindow)
LOCAL lnLength, lcText
lcText = SPACE(250)
lnLength = GetWindowText(lnWindow,;
@lcText, Len(lcText))
RETURN IIF(lnLength > 0,;
Left(lcText, lnLength), "#empty#")
PROCEDURE declare
DECLARE INTEGER GetActiveWindow IN user32
DECLARE INTEGER RealGetWindowClass IN user32;
INTEGER hWindow, STRING @ pszType,;
INTEGER cchType
DECLARE INTEGER GetWindowText IN user32;
INTEGER hWindow,;
STRING @lpString, INTEGER cch
GetActiveWindow
GetWindowText
RealGetWindowClass
Compare the results when:
- running this code using DO in the Command Window;
- running from an open Program Edit window using Ctrl+E