|
This is sample code. Add error handling and adjust to your requirements as necessary. |
#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
DECLARE Long GetWindow IN WIN32API Long hWnd, Long uCmd
DECLARE Long GetWindowText IN WIN32API Long hWnd, String @lpString, Long nMaxCount
DECLARE INTEGER GetDesktopWindow IN Win32API
DECLARE LONG GetWindowLong IN WIN32API Long hWnd, Long nIndex
#define GWL_EXSTYLE -20
#define GWL_STYLE -16
#define WS_EX_APPWINDOW 0x00040000
#define WS_VISIBLE 0x10000000
#define WS_POPUP 0x80000000
CREATE CURSOR crsWindows ( ;
hwnd I, WindTitle C(50))
lhWnd = GetDesktopWindow()
lhWnd = GetWindow(lhwnd, GW_CHILD)
* Itterate through all TOP-Level windows
DO WHILE lhWnd > 0
m.WindTitle = GetTitle(lhWnd)
IF NOT EMPTY(m.WindTitle)
m.hwnd = lhWnd
m.Style = GetWindowLong(lhWnd, GWL_STYLE)
m.hex = TRANSFORM(m.Style, "@0")
* Check if window is visible and isn't WS_POPUP style
IF BITAND(m.Style, WS_VISIBLE) > 0 ;
AND BITAND(m.Style, WS_POPUP) = 0
INSERT INTO crsWindows FROM MEMVAR
ENDIF
ENDIF
* Get next window in Z order
lhWnd = GetWindow(lhWnd, GW_HWNDNEXT )
ENDDO
*BROWSE NOWAIT
RETURN
FUNCTION GetTitle(lhWnd)
LOCAL lcTitle
lcTitle = Space(512)
lnTitle = GetWindowText(lhWnd , @lcTitle, 256)
IF lnTitle > 0
lcTitle = Left(lcTitle, lnTitle )
ELSE
lcTitle = ""
ENDIF
RETURN lcTitle
Recent comments
1 week 5 days ago
1 week 5 days ago
2 weeks 1 hour ago
2 weeks 1 day ago
2 weeks 2 days ago
2 weeks 5 days ago
3 weeks 5 days ago
3 weeks 6 days ago
4 weeks 13 hours ago
4 weeks 4 days ago