tags:

views:

838

answers:

5

Exact Duplicate: How to make 'always on bottom' window?
Related: Window on desktop?


I'm developing a small application in Delphi that need to behave like a shell (replacement) launching pad (for Windows Embedded). I have some icons/buttons on it that will launch other applications. The point is that applications need to stay all the time in front of the "shell". Additionally the applications are started using simple-click, but if double click (accidentally) is used the application will go behind (the "shell" will be focused)

Since this application will replace the actual shell (Explorer) will have to behave similarly to Explorer ... so it has to stay in "background" all the time and should not appear in ALT+TAB list.

I tested a lot of combinations of SetWindowPos with HWND_BOTTOM, SWP_NOACTIVATE etc. without success..

Additionally I found some info regarding this but it doesn't work as advertised:
How to keep a form always in the background (bottommost)

Any hints how to achieve all these ?

Update: For hiding the window from ALT-TAB list/switcher (and from Taskbar, but since I'm interested to create shell replacement that will be no Taskbar) I found the following articles:

Hide a Delphi Application Button from the TaskBar
Hide a Delphi 2007 Application Button from the TaskBar (with MainFormOnTaskBar)

A: 

I'm not sure what the exact effect is that you're trying to achieve, but I think you basically want to change the workarea on your screen.

You can obtain the current workarea as a TRect with Monitor.WorkareaRect. You can set it via SystemparametersInfo()

The example below turns your form into something that more or less resembles the way the Windows taskbar works:

  • no border
  • always on top
  • stuck at the bottom of the screen
  • other windows applications that maximize, will only maximize until the top of our form.

Let me know if this is what you mean.

procedure TfrmMain.FormCreate(Sender: TObject);
var
  Rect :TRect;
begin
  Height      := 25;
  BorderStyle := bsNone;
  FormStyle   := fsStayOnTop;
  Rect        := Monitor.WorkareaRect;
  Rect.Bottom := Rect.Bottom - Height;
  Left        := Rect.Left;
  Width       := Rect.Right;
  Top         := Rect.Bottom;
  SystemparametersInfo(SPI_SETWORKAREA,0, @Rect,SPIF_SENDCHANGE);
end;

Some things to keep in mind:

  • When your program finishes, the workarea on your desktop will still be the way you've set it, so remember to restore it before terminating the application. I'm sure you'll figure out how to do that.

  • When you resize the windows taskbar, running applications are notified of the change, and maximized applications adjust their size to the new workarea. The above code doesn't seem to trigger that, so you might need to find a way to do that.

Wouter van Nifterick
See my detailed comment bellow (partially here):I need to create a shell replacement (borderless full screen form) that need to stay on the "bottom" all the time similar to regular Explorer shell (that will replace). So it should stay on the bottom not on the top as you suggested.
+2  A: 

Hasn't that been asked before?

dummzeuch
See my detailed comment bellow (partially here):The solution you mentioned does not include any code just some suggestions ... additionally does not handle the ALT-TAB issue that I need to solve too (My window should not apear into the ALT-TAB list, similar to how Explorer - as a shell - behave).
A: 

@dummzeuch The solution you mentioned does not include any code just some suggestions ... additionally does not handle the ALT-TAB issue that I need to solve too (My window should not apear into the ALT-TAB list, similar to how Explorer - as a shell - behave).

@Wouter I need to create a shell replacement (borderless full screen form) that need to stay on the "bottom" all the time similar to regular Explorer shell (that will replace). So it should stay on the bottom not on the top as you suggested.

This "shell" replacement is used for a Windows Embeded solution where I can not use the regular Explorer shell. This shell form include some "soft buttons" (TImage to emulate icons) for some selected executable files that can be started from it. The problem is that is that I need to make sure that the shell stay behind all the time, otherwise it can hide some other applications (ex: multiple fast click on an icon that will start the application but will refocus on shell, or when using ALT TAB).

In this context, I have another question: there is any way to wait for any application to start ?

I will really appreciate some code hints to get started.

Please edit your question instead of adding an answer. Another question should be posted as such. For hiding from Alt+Tab see http://stackoverflow.com/questions/357076/best-way-to-hide-a-window-from-the-alt-tab-program-switcher
mghie
10x for the hint ...
A: 

It's unclear if you are trying to make your application behave as a 'launchpad' on top of the current shell, or if you are trying to make your application be the shell.

There is a major difference between those two.

It sound like the last option is what you really want, and then taskbars etc shouldn't be any trouble at all - they won't be there, since they are part of the old shell (explorer.exe) that you have replaced.

SharpEnvironment, an open source shell-replacement made with Delphi, may give you some hints on the way.

Vegar
10x for the hint, I already took a look into it ... still not found the key fetures that I need :(
A: 

It's a Win32 FAQ for decades. See on professional Win32 api group