Page 1 of 1

Get running apps and system tray info/icons/actions

Posted: Tue Feb 14, 2006 4:44 am
by Kaiser
Yeah... well :D this one thing I've been working on is easy... made a thread about it later - which I solved and I'm gonna post the way soon, once I dig the codes and search what snipped I used to solve it, as the last guy who helped me gave me a great idea ^^.

Anyways, been making a small, lightweight shell replacement for XP in PB... I must say, It's 50% faster than the normal Explorer :D. For now it's just a small button at the corner, which acts as a simple Start Menu... well, playing some Diablo II and alt+tab-ing between multiple D2's or MSN windows has been really fast using my own shell instead of Explorer (even when I've tweaked it to hell xD).

Now, aside from being able to switch shells by itself (Omg :-O) and make a start menu and stuff.... is there a way to get the system tray icons (and their actions when right-click/left-click)? and also the taskbar apps? (seen lots of examples about running apps and how to get them, but most of them get the hidden windows and that's not what I want :( though some of 'em are really good).

That's my question... and shell replacements are possible in PB ^^.

Posted: Fri Feb 17, 2006 9:27 pm
by Kaiser
No one? :(

Posted: Fri Feb 17, 2006 10:28 pm
by Trond
Use EnumWindows_() API function to get a list of all windows. (I haven't tried it myself but it should work.)

Posted: Sat Feb 18, 2006 12:53 am
by NoahPhense

Code: Select all

Define tmp.s

Procedure.s WindowsEnum() ; grabs open window titles
  Static Flag, hWnd 
  Repeat 
    If Flag = 0 
      hWnd = FindWindow_(0, 0) 
      Flag=1 
    Else 
      hWnd = GetWindow_(hWnd, #GW_HWNDNEXT) 
    EndIf 
    If hWnd <> 0 
      If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_VISIBLE = #WS_VISIBLE
        If GetWindowLong_(hWnd, #GWL_EXSTYLE) & #WS_EX_TOOLWINDOW <> #WS_EX_TOOLWINDOW
          ret.s = Space(256) 
          GetWindowText_(hWnd, ret, 256) 
          If ret <> "" : Break : EndIf 
        EndIf 
      EndIf 
    Else 
      Flag = 0 
    EndIf 
  Until hWnd = 0 
  ProcedureReturn ret  
EndProcedure 


Repeat
  tmp = WindowsEnum()
  Debug tmp
Until Len(tmp) <= 0
- np

Posted: Sat Feb 18, 2006 10:13 am
by Trond
This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.

Posted: Sat Feb 18, 2006 2:59 pm
by NoahPhense
Yeah, I'm not sure who wrote that code. But it works. I have it installed
on a production level server.

There are other ways of course to obtain the requested information.

- np

Posted: Sun Feb 19, 2006 12:11 pm
by lexvictory
if this is meant to be a xp shell replacement, shouldnt u use a WH_SHELL hook? (see setwindowshookex_() ).
this way, u will get told which windows u have to display, and when windows are destroyed/hidden (or just generally have to disappear from the taskbar)
and i think that there is a special class name that a window has to have which will make it receive tray notifications - take a look at geoshell's source, i think that's where i found it when i looked....