Someone asked me today “How do I get my CF window to not show up in the taskbar?”  Since Form.ShowInTaskbar isn’t supported in the CF, I decided to play around and see how it’s done.

It led me to play around with the SDF’s Win32Window and EnumEx classes.  Basically, populate a couple ListViews with all the available style and extended style bits, then let the user check whatever s/he wants and reapply them.

187 lines of code later and I’ve got a very busy window (check out the caption bar) but it’s still in the Taskbar.  Turns out to be not-so-easy after all – so I’ll keep trying, but here’s a quick sample on using the Win32Window.

Here’s the meat of it:

    private void ParentWindow_Load(object sender, System.EventArgs e)
        m_childWindow = Win32Window.FindWindow(null, "ChildWindow");
        WS childStyle = m_childWindow.Style;
        foreach(WS style in EnumEx.GetValues(typeof(WS)))
            ListViewItem lvi = new ListViewItem(style.ToString());
            lvi.Checked = ((childStyle & style) != 0);
        WS_EX childExStyle = m_childWindow.ExtendedStyle;
        foreach(WS_EX exstyle in EnumEx.GetValues(typeof(WS_EX)))
            ListViewItem lvi = new ListViewItem(exstyle.ToString());
            lvi.Checked = ((childExStyle & exstyle) != 0);
    private void btnSetStyle_Click(object sender, System.EventArgs e)
        WS style = 0;
        foreach(ListViewItem lvi in lvwWS.Items)
                    style |= (WS)EnumEx.Parse(typeof(WS), lvi.Text);
        m_childWindow.Style = style;
        WS_EX exstyle = 0;
        foreach(ListViewItem lvi in lvwWSEX.Items)
                exstyle |= (WS_EX)EnumEx.Parse(typeof(WS_EX), lvi.Text);
        m_childWindow.ExtendedStyle = exstyle;


It turns out this is right.  If you modify the style of the Form during it’s constructor, then it will not show up in the Taskbar (thanks Sergey).

public ChildWindow()
      Capture = true;
      Win32Window hwnd = Win32Window.GetCapture();
      Capture = false;
      hwnd.ExtendedStyle |= WS_EX.NOANIMATION;


This uses SDF 1.4, so if you’re trying it, make sure you get the latest code (or wait a day until 1.4 is released)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s