MobileDevelopment: Using shFullScreen API to show hide Start icon

Uuups, sometimes we are looking for a way to do simple things and do not remeber how easy it was.

Question: How can one hide/show the start icon in taskbar of Windows Mobile 6.1 (and before)?

Answer: Use the API provided by Microsoft for this: SHFullScreen! No need to use FindWindow and subclass, very simple use.

Ah, remeber that this will NOT work on Windows Enbedded Handheld 6.5.3 or Windows Mobile 6.5.3 or whatever you call it. The API will simply not do it’s work.

Here is a C# example for SHFullScreen usage.

create a class file (ie SHFullScreen.cs) and insert the following:

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;

namespace KioskTest
{
    public class SHAPI
    {
        public const int SHFS_SHOWTASKBAR = 1;
        public const int SHFS_HIDETASKBAR = 2;
        public const int SHFS_SHOWSIPBUTTON = 4;
        public const int SHFS_HIDESIPBUTTON = 8;
        public const int SHFS_SHOWSTARTICON = 16;
        public const int SHFS_HIDESTARTICON = 32;

        [DllImport("aygshell.dll")]
        private extern static bool SHFullScreen(IntPtr hWnd, int dwState);

        public static bool showStart(IntPtr wHandle, bool bShowHide)
        {
            bool bRet = false;
            IntPtr hwnd = wHandle;
            if (!bShowHide)
                bRet = SHFullScreen(hwnd, SHFS_HIDESTARTICON);
            else
                bRet = SHFullScreen(hwnd, SHFS_SHOWSTARTICON);
            return bRet;
        }

        public static bool FullScreen(IntPtr hWnd)
        {
            return SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR);
        }
    }
}

Now in your form code just use the following call to hide the Start Icon:

    KioskTest.SHAPI.showStart(this.Handle, false);

That is all, see here:

with_starticon   without_starticon

No full project source code for this easy one.

Have fun!

Leave a Reply