full screen form with SP2

D

D M

Hello.

I have used following code to get a full screen form in .NET CF.
Unfortunately after installing SP2 this method does not work
anymore.
What I do is:

VLibFullScreenHelper.ShowStartIcon(form,false);
VLibFullScreenHelper.ShowTaskBar(form,false);
VLibFullScreenHelper.MoveWindow(form,0,0,sizex, sizey);

Could anyone give some hint how to obatian full screen windows with
service pack 2 ?


public class VLibFullScreenHelper
{
public static bool ShowStartIcon(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSTARTICON : SHFS_HIDESTARTICON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool ShowSIPButton(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSIPBUTTON : SHFS_HIDESIPBUTTON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool ShowTaskBar(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool MoveWindow(Form f, int x, int y, int width, int
height)
{
return MoveWindow(GetWindowHandle(f), x, y, width, height , 1) != 0;
}

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

[DllImport("coredll.dll")]
private static extern IntPtr FindWindow(string className, string
windowName);

[DllImport("coredll.dll")]
private static extern Int32 MoveWindow(IntPtr hWnd, int X, int Y, int
nWidth, int nHeight, int bRepaint);

[DllImport("coredll.dll")]
private static extern Int32 GetClassName(IntPtr hWnd, StringBuilder
className, int maxCount);

private static IntPtr GetWindowHandle(Form f)
{
return FindWindow(formWindowClassName, f.Text);
}

private const int SHFS_SHOWTASKBAR = 1;
private const int SHFS_HIDETASKBAR = 2;
private const Int32 SHFS_SHOWSIPBUTTON = 0x0004;
private const Int32 SHFS_HIDESIPBUTTON = 0x0008;
private const Int32 SHFS_SHOWSTARTICON = 0x0010;
private const Int32 SHFS_HIDESTARTICON = 0x0020;
private const string formWindowClassName = "#NETCF_AGL_BASE_";

}
 
P

Peter Foot [MVP]

I've used the SHFullScreen method in projects with SP2 and it still works.
What I would suggest is a more reliable way to get the handle of a form is
to do

private static IntPtr GetWindowHandle(Form f)
{
f.Capture = true;
IntPtr hwnd = GetCapture();
f.Capture = false;

return hwnd;
}

[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups



D M said:
Hello.

I have used following code to get a full screen form in .NET CF.
Unfortunately after installing SP2 this method does not work
anymore.
What I do is:

VLibFullScreenHelper.ShowStartIcon(form,false);
VLibFullScreenHelper.ShowTaskBar(form,false);
VLibFullScreenHelper.MoveWindow(form,0,0,sizex, sizey);

Could anyone give some hint how to obatian full screen windows with
service pack 2 ?


public class VLibFullScreenHelper
{
public static bool ShowStartIcon(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSTARTICON : SHFS_HIDESTARTICON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool ShowSIPButton(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSIPBUTTON : SHFS_HIDESIPBUTTON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool ShowTaskBar(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}

public static bool MoveWindow(Form f, int x, int y, int width, int
height)
{
return MoveWindow(GetWindowHandle(f), x, y, width, height , 1) != 0;
}

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

[DllImport("coredll.dll")]
private static extern IntPtr FindWindow(string className, string
windowName);

[DllImport("coredll.dll")]
private static extern Int32 MoveWindow(IntPtr hWnd, int X, int Y, int
nWidth, int nHeight, int bRepaint);

[DllImport("coredll.dll")]
private static extern Int32 GetClassName(IntPtr hWnd, StringBuilder
className, int maxCount);

private static IntPtr GetWindowHandle(Form f)
{
return FindWindow(formWindowClassName, f.Text);
}

private const int SHFS_SHOWTASKBAR = 1;
private const int SHFS_HIDETASKBAR = 2;
private const Int32 SHFS_SHOWSIPBUTTON = 0x0004;
private const Int32 SHFS_HIDESIPBUTTON = 0x0008;
private const Int32 SHFS_SHOWSTARTICON = 0x0010;
private const Int32 SHFS_HIDESTARTICON = 0x0020;
private const string formWindowClassName = "#NETCF_AGL_BASE_";

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top