How to hide an external program from the desktop AND taskbar
- Kwai chang caine
- Always Here

- Posts: 5502
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
This three code is fantastic
I don't want to be the bad boys :roll:
But, how to do for reappears the windows
For this code :
This code :
And the last code :
Or perhaps you have a magic code that works with the three functions 
I don't want to be the bad boys :roll:
But, how to do for reappears the windows
For this code :
Code: Select all
; RemoveFromTaskbar by PB.
Procedure RemoveFromTaskbar(hwnd)
If IsWindow_(hwnd)
a=hwnd : b=GetWindowLong_(a,#GWL_HWNDPARENT) : If b<>0 : a=b : EndIf ; Needed for "TaskAssign.exe".
ShowWindow_(a,#SW_HIDE) : GetWindowRect_(a,win.RECT) : w=win\right-win\left : h=win\bottom-win\top
SetWindowLong_(a,#GWL_EXSTYLE,#WS_EX_TOOLWINDOW) : SetWindowPos_(a,0,0,0,w-1,h-1,#SWP_NOMOVE)
SetWindowPos_(a,0,0,0,w,h,#SWP_NOMOVE|#SWP_SHOWWINDOW) : ProcedureReturn 1
EndIf
EndProcedure
Debug RemoveFromTaskbar(FindWindow_(0,"THG Task Assignment Manager V1.0"))
Debug RemoveFromTaskbar(FindWindow_(0,"Untitled - Notepad"))
Debug RemoveFromTaskbar(FindWindow_(0,"Calculator"))Code: Select all
task_hwnd = FindWindow_(0,"Caption of the external program")
OpenWindow(2, 0, 0, 0, 0,#PB_Window_Invisible, "")
SetParent_(task_hwnd, WindowID(2))
ShowWindow_(task_hwnd, #SW_HIDE) Code: Select all
ShowWindow_(WindowID(#window),#SW_HIDE)
SetWindowLong_(WindowID(#window),#GWL_EXSTYLE,GetWindowLong_(WindowID(#window),#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW)
ShowWindow_(WindowID(#window),#SW_SHOW)
The happiness is a road...Not a destination
Old Thread
Hide and UnHide 
Code: Select all
Procedure HideFromTaskBar(hWnd.l, Flag.l)
Protected TBL.ITaskbarList
CoInitialize_(0)
If CoCreateInstance_(?CLSID_TaskBarList, 0, 1, ?IID_ITaskBarList, @TBL) = #S_OK
TBL\HrInit()
If Flag
TBL\DeleteTab(hWnd)
Else
TBL\AddTab(hWnd)
EndIf
TBL\Release()
EndIf
CoUninitialize_()
DataSection
CLSID_TaskBarList:
Data.l $56FDF344
Data.w $FD6D, $11D0
Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
IID_ITaskBarList:
Data.l $56FDF342
Data.w $FD6D, $11D0
Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
EndDataSection
EndProcedure
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Kwai chang caine
- Always Here

- Posts: 5502
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
- Kwai chang caine
- Always Here

- Posts: 5502
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
I have again a little problem.
The function of TS-Soft works fine.
I open my extern application
I reduce her in the taskbar with ShowWindow
I Create a systray icon in the systray
I hide the windows in the taskbar with HideFromTaskBar
All that works fine
I click on the icon in the systray, my extern aplication reappears and his button on the taskbar too.
But when i reduce again my application, the button in taskbar not disappears, normal because i can't catch the event mouse to reduce the application
Somebody know how catch the event reduce of external windows click ?
The function of TS-Soft works fine.
I open my extern application
I reduce her in the taskbar with ShowWindow
I Create a systray icon in the systray
I hide the windows in the taskbar with HideFromTaskBar
All that works fine
I click on the icon in the systray, my extern aplication reappears and his button on the taskbar too.
But when i reduce again my application, the button in taskbar not disappears, normal because i can't catch the event mouse to reduce the application
Somebody know how catch the event reduce of external windows click ?
Last edited by Kwai chang caine on Mon Jun 30, 2008 3:38 pm, edited 1 time in total.
The happiness is a road...Not a destination
- Kwai chang caine
- Always Here

- Posts: 5502
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Well, i use again this function
But the reduce button disapears on my extern application 
Code: Select all
Procedure RemoveFromTaskbar(hwnd)
If IsWindow_(hwnd)
a = hwnd
b = GetWindowLong_(a,#GWL_HWNDPARENT)
If b <> 0
a = b
EndIf ; Needed for "TaskAssign.exe".
ShowWindow_(a, #SW_HIDE)
GetWindowRect_(a, win.RECT)
w = win \ right - win \ left
h = win \ bottom - win \ top
SetWindowLong_(a, #GWL_EXSTYLE, #WS_EX_TOOLWINDOW)
SetWindowPos_(a, 0, 0, 0, w - 1, h - 1, #SWP_NOMOVE)
SetWindowPos_(a, 0, 0, 0, w, h, #SWP_NOMOVE|#SWP_SHOWWINDOW)
ProcedureReturn 1
EndIf
EndProcedure
The happiness is a road...Not a destination
- Kwai chang caine
- Always Here

- Posts: 5502
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
I am not come to do reappear the taskbar button.
I have circle the problem like that :
When i clik a first time, the application appears.
And the second time, she desappears
I have circle the problem like that :
When i clik a first time, the application appears.
And the second time, she desappears
Code: Select all
Procedure RemoveFromTaskbar(hwnd)
If IsWindow_(hwnd)
a = hwnd
b = GetWindowLong_(a,#GWL_HWNDPARENT)
If b <> 0
a = b
EndIf ; Needed for "TaskAssign.exe".
ShowWindow_(a, #SW_HIDE)
GetWindowRect_(a, win.RECT)
w = win \ right - win \ left
h = win \ bottom - win \ top
SetWindowLong_(a, #GWL_EXSTYLE, #WS_EX_TOOLWINDOW)
SetWindowPos_(a, 0, 0, 0, w - 1, h - 1, #SWP_NOMOVE)
SetWindowPos_(a, 0, 0, 0, w, h, #SWP_NOMOVE|#SWP_SHOWWINDOW)
ProcedureReturn 1
EndIf
EndProcedure
#Clic = 1
#SysIcon = 10
#Sytray = 11
#PopUp = 12
Chemin.s = "c:\Program Files\Prg\"
RunProgram(Chemin + "Prg.exe", "=E:\DON\prg.ini", "")
Delay(1000)
Hwnd = FindWindow_(0, "Barre des titres prg")
ShowWindow_(Hwnd, 6) ; Descendre la fenetre dans la barre des taches
RemoveFromTaskbar(Hwnd) ; Cacher de la barre des taches
If OpenWindow(#Clic, 0, 0, 0, 0, "", #PB_Window_Invisible )
HwndClic = WindowID(#Clic)
hIconSysTray = LoadImage(#SysIcon,"c:\ico.ico")
AddSysTrayIcon(#Sytray, HwndClic, hIconSysTray)
CreatePopupMenu(#PopUp)
MenuItem(1,"Quitter"l)
Repeat
Select WaitWindowEvent()
Case #PB_Event_SysTray
Select EventType()
Case #PB_EventType_RightClick
DisplayPopupMenu(#PopUp, HwndClic)
Case #PB_EventType_LeftClick
HwndLotus = FindWindow_(0, "Barre des titres prg")
If IsIconic_(Hwnd)
ShowWindow_(Hwnd, 1)
Else
ShowWindow_(Hwnd, 6)
EndIf
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 1
Quit = 1
EndSelect
EndSelect
Until quit = 1
End
EndIf
The happiness is a road...Not a destination

