Pin a window to the desktop

Windows specific forum
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Pin a window to the desktop

Post by Le Soldat Inconnu »

Hello

How can I pined a window to the desktop ? (Can't minimize the window, the window must be always visible on the desktop, minimize all window can't minimize my window)

I already test this way : Put the desktop as the parent of my window
but it don't work correctly

Code: Select all

If OpenLibrary(0, "User32.dll")
  Bureau = CallFunction(0, "GetShellWindow")
  CloseLibrary(0)
EndIf
OpenWindow(0, 0, 0, 100, 100, #PB_Window_BorderLess | #PB_Window_ScreenCentered, "Pin to desktop", Bureau)

CreateGadgetList(WindowID())

ButtonGadget(0, 0, 0, 100, 100, "Close")

Repeat
  Event = WaitWindowEvent()
  
  If Event = #PB_Event_Gadget
    Select EventGadgetID()
      Case 0
        Event = #PB_EventCloseWindow
    EndSelect
  EndIf
  
Until Event = #PB_EventCloseWindow
Thank for your help[/code]
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Code: Select all

If OpenLibrary(0, "User32.dll")
  Bureau = CallFunction(0, "GetShellWindow")
  NouveauBureau = CallFunction(0, "SetShellWindow", Bureau)
  CloseLibrary(0)
EndIf
OpenWindow(0, 0, 0, 100, 100, #PB_Window_BorderLess | #PB_Window_ScreenCentered, "Pin to desktop", Bureau)

CreateGadgetList(WindowID())
ButtonGadget(0, 0, 0, 100, 100, "Close")

Repeat
  Event = WaitWindowEvent()
 
  If Event = #PB_Event_Gadget
    Select EventGadgetID()
      Case 0
        Event = #PB_EventCloseWindow
    EndSelect
  EndIf
 
Until Event = #PB_EventCloseWindow
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

thank you very much

Where do you find the SetDesktopWindow description ? There are nothing in the msdn
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Inside the sourcecode of Wine (*nix window emulator/library) wich can be found here :)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

But when you click on the desktop and hide all window (Win+D) (where are no window visible), my window is hide :cry:
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Not mine, it stay on top :?: (I m using XP without theme support)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

Compile the code, press Win+D, click on the desktop, press Win+D, and the window is hide :(

I have win XP pro SP2

And it's the same on a Win XP SP1
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Erf ! You're right ! I ll dig a little bit to find out why this thing happen :)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Code: Select all

OpenWindow(0, 0, 0, 100, 100, #PB_Window_BorderLess | #PB_Window_ScreenCentered, "Pin to desktop", Bureau)

If OpenLibrary(0, "User32.dll")
  NouveauBureau = CallFunction(0, "SetShellWindow", WindowID())
  CloseLibrary(0)
EndIf
SetWindowPos_(WindowID(), #HWND_TOPMOST, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE)

CreateGadgetList(WindowID())
ButtonGadget(0, 0, 0, 100, 100, "Close")

Repeat
  Event = WaitWindowEvent()
 
  If Event = #PB_Event_Gadget
    Select EventGadgetID()
      Case 0
        Event = #PB_EventCloseWindow
    EndSelect
  EndIf
 
Until Event = #PB_EventCloseWindow 
It seems to be working correctly this time :)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

No, the window is always on top :)

Just test this, I have the same result

Code: Select all

OpenWindow(0, 0, 0, 100, 100, #PB_Window_BorderLess | #PB_Window_ScreenCentered, "Pin to desktop") 

SetWindowPos_(WindowID(), #HWND_TOPMOST, 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE) 

CreateGadgetList(WindowID()) 
ButtonGadget(0, 0, 0, 100, 100, "Close") 

Repeat 
  Event = WaitWindowEvent() 
  
  If Event = #PB_Event_Gadget 
    Select EventGadgetID() 
      Case 0 
        Event = #PB_EventCloseWindow 
    EndSelect 
  EndIf 
  
Until Event = #PB_EventCloseWindow
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Le Soldat Inconnu wrote:No, the window is always on top :)
This isn't what you expected to want ?
I didn't understand what you really want ??
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

I search to obtain a window pined to the desktop, like an icon on the desktop.
Always under windows but always visible when you hide all window with Win+D :wink:
LSI
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Always under windows but always visible when you hide all window with Win+D

It's in the FAQ under "Always on bottom" but here it is again:

Code: Select all

SetParent_(WindowID(),FindWindow_(0,"Program Manager"))
;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

Thank you :D
LSI
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Thanx you too :)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Post Reply