0

Im slightly new at programming in Windows Forms applications - but my current goal is to provide a 'gadget-like' application, which will stick to the desktop. It must not be possible to minimize it (well, i remove titlebar, buttons and borders etc).

I can make one Form lower itself in zindex behind another Form window in the same application however, i dont seem to be able to do it relatively with other applications?

I also dont have it showing up in tab / processbar etc, it simply needs to be on the desktop - kind of like old content ActiveX Desktop or Sidebar gadgets...

Simplest code to perform on,

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.SendToBack();
        this.Text = string.Empty;
        this.ControlBox = false;
        this.FormBorderStyle = FormBorderStyle.None;
        //this.BackColor = Color.Transparent;
    }
}

SendToBack does nothing for me though..

Any ideas? Meddle with DWM? Please let me know any ideas

mschr
  • 8,531
  • 3
  • 21
  • 35
  • Perhaps you can have more control if you prevent the window from ever being activated: http://stackoverflow.com/questions/7750517/notification-window-preventing-the-window-from-ever-getting-focus – Dark Falcon Jun 24 '16 at 01:53
  • Setting the `WM_EX_NOACTIVATE` extended window style should do exactly what you want. This is what the On Screen Keyboard applet does. The user can still interact with your form, but the form will never be activated, so it won't be brought to the top of the Z order. If that doesn't do what you want, edit your question to provide more information about why not and what different behavior you were expecting, then ping me and I'll reopen the question. – Cody Gray - on strike Jun 24 '16 at 07:42
  • Hi, definately a step in the right direction. Ive succeeded in assemblies and WPF linkage. Im certain the lower layer `Window` object is what i need to meet my goal, thx!. But im unable to find referencing on how to 'merge' the `Form` and `Window` elements.. – mschr Jun 27 '16 at 19:46
  • PS: its not so much not gaining focus im headed for, it wouldnt be a problem for me if event bubbles were caught - i just need the window to constantly be behind every other window - but above desktop – mschr Jun 27 '16 at 19:48

0 Answers0