0

I want to develop a Windows Application using Delphi that always stays on Desktop, even if the user clicks Show Desktop button on taskbar.

I tried the code: SetWindowPos(Handle, HWND_BOTTOM, Left, Top, Width, Height, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);

However, when i click show desktop, the form becomes invisible. Any solution?

Xel Naga
  • 826
  • 11
  • 28
  • 5
    Won't your users hate this? Better hope they don't install two such programs. Perhaps what you really want is a kiosk. – David Heffernan Aug 05 '15 at 12:14
  • Are you looking for something similar to the taskbar? – Jerry Dodge Aug 05 '15 at 14:11
  • You can override the form's `CreateParams` ; inherited and set `Params.WndParent := FindWindow('Progman', nil)`. I don't know that side effects might be though... – kobik Aug 05 '15 at 15:36
  • 2
    @kobik Side effects are pretty brutal. Don't do that. – David Heffernan Aug 05 '15 at 15:55
  • @DavidHeffernan, That's why I only commented. "Won't your users hate this?" Maybe OP wants something like sticky notes...? – kobik Aug 05 '15 at 16:08
  • 1
    @kobik Stick Notes are a gadget (or was called "sidebar" in Vista). These are actually based on a type of HTML. I attempted to write a couple, required me to create an ActiveX library in Delphi. Still wasn't very friendly, and abandoned the idea. – Jerry Dodge Aug 05 '15 at 17:03
  • I'm not sure if this is still possible in latest Windows versions but on Windows XP your application could render its contents directly to Desktop background (using ActiveX if my memory serves me correctly). Unfortunately I don't have any code example of this but I had a few programs that were supporting this. – SilverWarior Aug 05 '15 at 19:19
  • related to the very first comment, you may find [this SO question](http://stackoverflow.com/questions/3236233/how-to-create-a-kiosk-like-ui-so-that-the-user-can-never-exit-from-it-or-switch) useful – fantaghirocco Aug 06 '15 at 10:59

1 Answers1

2

I agree with David Heffeman that you need to be careful about unleashing such an application on users without their consent.

That being said, I have done this in an application that I wrote for my own personal use.

Set the BorderStyle to bsNone.

Set up a timer, and on each timer tick execute:

 if visible then SetWindowPos(Self.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE);
David Dubois
  • 3,842
  • 3
  • 18
  • 36