Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / API

MobileDevelopment: Using shFullScreen API to Show Hide Start Icon

4.20/5 (2 votes)
26 Mar 2014CPOL 9K  
MobileDevelopment: Using shFullScreen API to show hide Start icon

Uuups, sometimes we are looking for a way to do simple things and not remember 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, remember 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 its work.

Here is a C# example for SHFullScreen usage.

Create a class file (i.e., SHFullScreen.cs) and insert the following:

C#
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!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)