I made a tool which helps me work with my notebook until I get a replacement for some faulty keys. But there's an issue to make a screenshot of the active window in certain situations (seems that my keyboard hook routine gets blocked from certain programs), so I added an icon to the taskbar to be able to do the same functions like the keyboard shortcuts do.
Short problem description:
How to get the handle of the taskbar overflow? Otherwise I'll loose the handle of the 'real' active window.
Code: Select all
Procedure.s GetWinTitle(handle)
Protected name.s
Protected len
name.s=Space(#MAX_PATH)
len=GetWindowText_(handle,@name,#MAX_PATH)
ProcedureReturn Left(name,len)
EndProcedure
MyWin=OpenWindow(0,0,0,100,100,"*")
MyBar=FindWindowEx_(#Null,#Null,"Shell_TrayWnd",#Null)
MyIco=AddSysTrayIcon(0,MyWin,LoadIcon_(#Null,#IDI_INFORMATION))
AddWindowTimer(0,0,100)
Repeat
Dummy=GetForegroundWindow_()
SetWindowTitle(0,Str(Dummy))
If Dummy<>MyBar And Dummy<>MyWin And Dummy<>Active
Active=Dummy
Debug "New Active: "+Active+" = '"+GetWinTitle(Active)+"'"
EndIf
Until WaitWindowEvent()=#PB_Event_CloseWindow