Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to have the list of programs on the taskbar ?
Message
 
 
To
28/12/2002 12:52:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735395
Message ID:
00737104
Views:
38
This message has been marked as the solution to the initial question of the thread.
The code below will create a list of applications (Window handle and title) that are presented on the TaskBar.
#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
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform