Page 1 of 2

Pin a window to the desktop

Posted: Fri Jul 22, 2005 11:14 am
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]

Posted: Fri Jul 22, 2005 7:05 pm
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

Posted: Tue Jul 26, 2005 7:48 am
by Le Soldat Inconnu
thank you very much

Where do you find the SetDesktopWindow description ? There are nothing in the msdn

Posted: Tue Jul 26, 2005 5:26 pm
by KarLKoX
Inside the sourcecode of Wine (*nix window emulator/library) wich can be found here :)

Posted: Tue Jul 26, 2005 10:12 pm
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:

Posted: Tue Jul 26, 2005 10:54 pm
by KarLKoX
Not mine, it stay on top :?: (I m using XP without theme support)

Posted: Wed Jul 27, 2005 10:02 pm
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

Posted: Wed Jul 27, 2005 10:18 pm
by KarLKoX
Erf ! You're right ! I ll dig a little bit to find out why this thing happen :)

Posted: Wed Jul 27, 2005 10:58 pm
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 :)

Posted: Fri Jul 29, 2005 9:46 pm
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

Posted: Sat Jul 30, 2005 2:12 am
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 ??

Posted: Sat Jul 30, 2005 10:32 pm
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:

Posted: Sun Jul 31, 2005 1:02 am
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"))
;)

Posted: Sun Jul 31, 2005 10:01 pm
by Le Soldat Inconnu
Thank you :D

Posted: Mon Aug 01, 2005 2:29 am
by KarLKoX
Thanx you too :)