Wednesday, September 10, 2008

Full Screen featues in Windows mobile.

Hi Guys,

I look msdn forums last few days,in the forum many guys asked about the full screen features in windows mobile. Since i will post here my code for that.

The full screen features we can do by two ways.
1. We can do simplify in Windows mobile 5.0 or later like hide the menu,give empty text and set widows state is maximized.
2.we can do by the calling P/Invoke.
it's little interesting, because of OS API have a interesting method "SHFullScreen"

So when we pass our current form handle and window states to this method it's done.

before that we must get window handle to for current window.

so sample code below

public class WinAPI

internal const int SHFS_SHOWTASKBAR = 0x0001;
internal const int SHFS_HIDETASKBAR = 0x0002;
internal const int SHFS_SHOWSIPBUTTON = 0x0004;
internal const int SHFS_HIDESIPBUTTON = 0x0008;
internal const int SHFS_SHOWSTARTICON = 0x0010;
internal const int SHFS_HIDESTARTICON = 0x0020;
// Code used to hide the Windows bar

[DllImport("aygshell.dll", EntryPoint = "SHFullScreen", SetLastError = true)]
internal static extern bool SHFullScreen(IntPtr hwndRequester, int dwState);
[DllImport("coredll.dll", EntryPoint = "GetForegroundWindow", SetLastError = true)]
internal static extern IntPtr GetForegroundWindow();
public static extern IntPtr GetCapture();
// Code used to hide the Windows bar
public static void FullScreen()
IntPtr hwnd = GetForegroundWindow();

that's all

thank you

1 comment:

gary said...

did you try this code? It`s not enough to get FS on mobile device!