INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

API Functions

How to determine what application are iconified on the taskbar. by mgagnon
Posted: 10 Oct 04 (Edited 10 Oct 04)

Rather than listing all the processes running, it migh be easier just to list the ones that are running iconified on the taskbar.

CODE

#Define GW_HWNDNEXT         2
#Define GW_CHILD            5
#Define GWL_STYLE             -16
#Define WS_VISIBLE             0x10000000
#Define WS_POPUP               0x80000000

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
DECLARE INTEGER IsIconic IN user32 INTEGER hWnd
Create Cursor crsWindows ( ;
    hwnd I, WindTitle C(50),isIconic L)

lhWnd = GetDesktopWindow()
lhWnd = GetWindow(lhWnd, GW_CHILD)
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")
        m.isiconic = IIF(IsIconic(lhWnd)=0,.f.,.t.)
        If  Bitand(m.Style, WS_VISIBLE) > 0 ;
                AND Bitand(m.Style, WS_POPUP) = 0
            Insert Into crsWindows From Memvar
        Endif
    Endif
    lhWnd = GetWindow(lhWnd, GW_HWNDNEXT )
Enddo
SELECT crsWindows
LOCATE
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
P.S.: Part of this code is credited to Sergey Berezniker

Mike Gagnon

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close