Scan Window titlesTag(s): WinAPI/Registry


This snippet displays all Internet Explorer window titles which are opened.
[local function declaration]
FUNCTION LONG GetDesktopWindow() LIBRARY "user32"
FUNCTION LONG GetWindow( long hWnd, long uCmd ) LIBRARY "user32"
FUNCTION LONG GetClassNameA &
   ( long hWnd, Ref String lpClassName, long nMaxCount ) &
      LIBRARY "user32"
FUNCTION LONG GetWindowTextA &
   ( long hWnd, Ref String lpString, long nMaxCount ) &
      LIBRARY "user32"
FUNCTION BOOLEAN IsWindowVisible( long hWnd ) LIBRARY "user32"

[powerscript]
long ll_Desktop,ll_Child
 
string ls_ClassName, ls_WindowName, ls_ieopened
 
Constant long GW_HWNDFIRST = 0
Constant long GW_HWNDLAST = 1
Constant long GW_HWNDNEXT = 2
Constant long GW_HWNDPREV = 3
Constant long GW_OWNER  = 4
Constant long GW_CHILD  = 5
Constant long GW_MAX   = 5
 
Constant long MAX_WIDTH = 255
 
ll_Desktop = GetDesktopWindow()
 
ll_Child = GetWindow( ll_Desktop, GW_CHILD )
 
ls_ieopened = ""
DO WHILE (ll_Child > 0)
   ls_ClassName  = Space(MAX_WIDTH)
   ls_WindowName = Space(MAX_WIDTH)
   // Get window classname
   GetClassNameA( ll_Child, ls_ClassName, MAX_WIDTH )
   // Get window text
   GetWindowTextA( ll_Child, ls_WindowName, MAX_WIDTH )
 
   IF ls_classname = "IEFrame" THEN
      ls_ieopened += ls_ClassName + "(" + ls_WindowName + ") "
   END IF
   ll_Child = GetWindow( ll_Child, GW_HWNDNEXT )
LOOP 
 
Messagebox("" , ls_ieopened)

blog comments powered by Disqus