|
It was good, but quality suffers code
|
|
|
|
|
Thank you so much!! Awesome code, I have been trying to do this for days!
Thank you!
|
|
|
|
|
With the thousand solutions I tried, your one was the only one which worked (for Windows CE 5.0, not PocketPC !!!!!).
So thanks a lot for stopping my pain in the A...
|
|
|
|
|
Thanks for the code, this is true fullscreen!
|
|
|
|
|
The most full screen applictions are designed as not using the system utilities (SIP or menu).
So, we do not need to move the Task/Input Windows. Just to set the size and location to full all workarea, and remove the menu if it exist.
|
|
|
|
|
You can do this with pure .net
Set the following properties of the form (in designer or in the code):
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
|
|
|
|
|
I have had the full screen problem also and that C# code worked when I wanted to hide the taskbar, but when I tried to recover the taskbar it didn't.
But I found this very easy way:
In desing mode I have WindowState: Normal.
Then I put this code below in Form's constructor after InitializeComponent();
<br />
WindowState = FormWindowState.Maximized;<br />
And now when you open the Form it opens in full screen.
Olli Männistö
|
|
|
|
|
Hi all,
I know with should NEVER happen but if my application crash (exception not catched for example), the FSEngine remains active.
It means that the upper part of my application is displayed instead of the menu bar on a PPC 2003. The only way to get it back is to warm boot the mobile.
Any idea on how to skip that problem ?
I know maybe I could start my application again and stop it correctly; the code to disable FSEngine would then be called BUT the problem is that I don't have access to the start menu due to that issue
Maybe someone found a good practice to avoid that one.
Thanks for sharing experience.
|
|
|
|
|
using System.Runtime.InteropServices;<br />
using System;<br />
<br />
public class FSEngine <br />
{<br />
<br />
<br />
<br />
private const int SPI_SETWORKAREA = 47;<br />
<br />
private const int SPI_GETWORKAREA = 48;<br />
<br />
private const int SPIF_UPDATEINIFILE = 0x01;<br />
<br />
private IntPtr hWndInputPanel;<br />
<br />
private IntPtr hWndSipButton;<br />
<br />
private IntPtr hWndTaskBar;<br />
<br />
private RECT rtDesktop;<br />
<br />
private RECT rtNewDesktop;<br />
<br />
private RECT rtInputPanel;<br />
<br />
private RECT rtSipButton;<br />
<br />
private RECT rtTaskBar;<br />
<br />
[DllImport("coredll.dll")]<br />
extern private static IntPtr FindWindowW(string lpClassName, string lpWindowName);<br />
<br />
[DllImport("coredll.dll")]<br />
extern private static int MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, int bRepaint) ;<br />
<br />
[DllImport("coredll.dll")]<br />
extern private static int SetRect(ref RECT lprc, int xLeft, int yTop, int xRight, int yBottom) ;<br />
<br />
[DllImport("coredll.dll")]<br />
extern public static int GetWindowRect(IntPtr hWnd, ref RECT lpRect) ;<br />
<br />
[DllImport("coredll.dll")]<br />
extern private static int SystemParametersInfo(int uiAction, int uiParam, ref RECT pvParam, int fWinIni) ;<br />
<br />
public int InitFullScreen() <br />
{<br />
int Result = 0;<br />
try <br />
{<br />
if ((SystemParametersInfo(SPI_GETWORKAREA, 0, ref rtDesktop, 0) == 1)) <br />
{<br />
SetRect(ref rtNewDesktop, 0, 0, 240, 320);<br />
}<br />
hWndInputPanel = FindWindowW("SipWndClass", null);<br />
if ((hWndInputPanel.ToInt64() != 0)) <br />
{<br />
GetWindowRect(hWndInputPanel, ref rtInputPanel);<br />
}<br />
hWndSipButton = FindWindowW("MS_SIPBUTTON", null);<br />
if ((hWndSipButton.ToInt64() != 0)) <br />
{<br />
GetWindowRect(hWndSipButton, ref rtSipButton);<br />
}<br />
hWndTaskBar = FindWindowW("HHTaskBar", null);<br />
if ((hWndTaskBar.ToInt64() != 0)) <br />
{<br />
GetWindowRect(hWndTaskBar, ref rtTaskBar);<br />
}<br />
}<br />
catch (Exception ex) <br />
{<br />
Result = 1;<br />
}<br />
return Result;<br />
}<br />
<br />
public int DoFullScreen(bool mode) <br />
{<br />
int Result = 0;<br />
try <br />
{<br />
if ((mode == true)) <br />
{<br />
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rtNewDesktop, SPIF_UPDATEINIFILE);<br />
if ((hWndTaskBar.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndTaskBar, 0, rtNewDesktop.bottom, (rtTaskBar.right - rtTaskBar.left), (rtTaskBar.bottom - rtTaskBar.top), 0);<br />
}<br />
if ((hWndInputPanel.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndInputPanel, 0, (rtNewDesktop.bottom <br />
- (rtInputPanel.bottom - rtInputPanel.top)), (rtInputPanel.right - rtInputPanel.left), (rtInputPanel.bottom - rtInputPanel.top), 0);<br />
}<br />
if ((hWndSipButton.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndSipButton, 0, rtNewDesktop.bottom, (rtSipButton.right - rtSipButton.left), (rtSipButton.bottom - rtSipButton.top), 0);<br />
}<br />
}<br />
else <br />
{<br />
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rtDesktop, SPIF_UPDATEINIFILE);<br />
if ((hWndTaskBar.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndTaskBar, rtTaskBar.left, rtTaskBar.top, (rtTaskBar.right - rtTaskBar.left), (rtTaskBar.bottom - rtTaskBar.top), 0);<br />
}<br />
if ((hWndInputPanel.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndInputPanel, rtInputPanel.left, (rtDesktop.bottom <br />
- ((rtInputPanel.bottom - rtInputPanel.top) <br />
- (rtTaskBar.bottom - rtTaskBar.top))), (rtInputPanel.right - rtInputPanel.left), (rtInputPanel.bottom - rtInputPanel.top), 0);<br />
}<br />
if ((hWndSipButton.ToInt64() != 0)) <br />
{<br />
MoveWindow(hWndSipButton, rtSipButton.left, rtSipButton.top, (rtSipButton.right - rtSipButton.left), (rtSipButton.bottom - rtSipButton.top), 0);<br />
}<br />
}<br />
}<br />
catch (Exception ex) <br />
{<br />
Result = 1;<br />
}<br />
return Result;<br />
}<br />
<br />
[StructLayout(LayoutKind.Sequential)]<br />
public struct RECT <br />
{<br />
<br />
public int left;<br />
<br />
public int top;<br />
<br />
public int right;<br />
<br />
public int bottom;<br />
}<br />
}
|
|
|
|
|
Thanks alex_boyer to convert the code from VB.NET to C#.
HACKZAI~ YOUR BUSINESS NEED, OUR CUSTOM MADE
|
|
|
|
|
Thanke you... have nice day.
|
|
|
|
|
Thanks alex_boyer for the nice code in C#
I follow your code and do some changes in my requirement i want hide the sip key icon and start button on form load in C# ,my application is working on button click but it not work in Form load ,please help me immediately.I send my code please refer it and give me some suggestion.
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace SIPkey
{
class FSEngine
{
private const int SPI_SETWORKAREA = 47;
private const int SPI_GETWORKAREA = 48;
private const int SPIF_UPDATEINIFILE = 0x01;
private IntPtr hWndInputPanel;
private IntPtr hWndSipButton;
private IntPtr hWndTaskBar;
private RECT rtDesktop;
private RECT rtNewDesktop;
private RECT rtInputPanel;
private RECT rtSipButton;
private RECT rtTaskBar;
[DllImport("coredll.dll")]
extern private static IntPtr FindWindowW(string lpClassName, string lpWindowName);
[DllImport("coredll.dll")]
extern private static int MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, int bRepaint);
[DllImport("coredll.dll")]
extern private static int SetRect(ref RECT lprc, int xLeft, int yTop, int xRight, int yBottom);
[DllImport("coredll.dll")]
extern public static int GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[DllImport("coredll.dll")]
extern private static int SystemParametersInfo(int uiAction, int uiParam, ref RECT pvParam, int fWinIni);
public int InitFullScreen()
{
// // Declare & Instatiate local variable
int Result = 0;
try
{
if ((SystemParametersInfo(SPI_GETWORKAREA, 0, ref rtDesktop, 0) == 1))
{
// // Successful obtain the system working area (Desktop)
SetRect(ref rtNewDesktop, 0, 0, 240, 320);
}
// // Find the Input panel window handle
hWndInputPanel = FindWindowW("SipWndClass", null);
// // Checking...
if ((hWndInputPanel.ToInt64() != 0))
{
// // Get the original Input panel window size
GetWindowRect(hWndInputPanel, ref rtInputPanel);
}
// // Find the SIP Button window handle
hWndSipButton = FindWindowW("MS_SIPBUTTON", null);
// // Checking...
if ((hWndSipButton.ToInt64() != 0))
{
// // Get the original Input panel window size
GetWindowRect(hWndSipButton, ref rtSipButton);
}
// // Find the Taskbar window handle
hWndTaskBar = FindWindowW("HHTaskBar", null);
// // Checking...
if ((hWndTaskBar.ToInt64() != 0))
{
// // Get the original Input panel window size
GetWindowRect(hWndTaskBar, ref rtTaskBar);
}
}
catch (Exception ex)
{
// // PUT YOUR ERROR LOG CODING HERE
// // Set return value
Result = 1;
}
// // Return result code
return Result;
}
public int DoFullScreen(bool mode)
{
// // Declare & Instatiate local variable
int Result = 0;
try
{
if ((mode == true))
{
// // Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rtNewDesktop, SPIF_UPDATEINIFILE);
if ((hWndInputPanel.ToInt64() != 0))
{
// // Reposition the input panel
//MoveWindow(hWndInputPanel, 0, (rtNewDesktop.bottom
//- (rtInputPanel.bottom - rtInputPanel.top)), (rtInputPanel.right - rtInputPanel.left), (rtInputPanel.bottom - rtInputPanel.top), 0);
}
if ((hWndSipButton.ToInt64() != 0))
{
// // Hide the SIP button
MoveWindow(hWndSipButton, 0, rtNewDesktop.bottom, (rtSipButton.right - rtSipButton.left), (rtSipButton.bottom - rtSipButton.top), 0);
}
}
else
{
// // Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, ref rtDesktop, SPIF_UPDATEINIFILE);
// // Restore the input panel
if ((hWndInputPanel.ToInt64() != 0))
{
//MoveWindow(hWndInputPanel, rtInputPanel.left, (rtDesktop.bottom - ((rtInputPanel.bottom - rtInputPanel.top)- (rtTaskBar.bottom - rtTaskBar.top))), (rtInputPanel.right - rtInputPanel.left), (rtInputPanel.bottom - rtInputPanel.top), 0);
//MoveWindow(hWndInputPanel, 0,26,220,254, 0);
}
if ((hWndSipButton.ToInt64() != 0))
{
// // Restore the SIP button
MoveWindow(hWndSipButton, rtSipButton.left, rtSipButton.top, (rtSipButton.right - rtSipButton.left), (rtSipButton.bottom - rtSipButton.top), 0);
// MoveWindow(hWndInputPanel, 0, 26, 220, 254, 0);
}
}
}
catch (Exception ex)
{
// // PUT YOUR ERROR LOG CODING HERE
// // Set return value
Result = 1;
}
// // Return result code
return Result;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
}
}
/////////////////////
I Call the key board hiding code in button click
private void button1_Click(object sender, EventArgs e)
{
if (fs.DoFullScreen(true) == 0)
{
if (inputPanel1.Enabled == true)
{
inputPanel1.Enabled = false;
}
fs.DoFullScreen(true);
}
}
For restoring the keyboard
private void button2_Click(object sender, EventArgs e)
{
// fs.InitFullScreen();
fs.DoFullScreen(false);
}
but i want the thing in form load but in form load when i call these it not working please help me.
Ram Krishna Pattnayak
Software Developer(SDS)
Sun-Dew Solutions Pvt.Ltd
www.sundewsolutions.com
kolkata
|
|
|
|
|
Thanks, i just translate, all the work has been done by hackzai.
For your problem:
- what means it does not work ?
- Moreover, why do you call fs.DoFullScreen(true) twice ?
- What changes have you made between the both code ?
I remember that i was using this code in OnLoad(); i will verify with my previous collegues. Have you try on another event like OnShow or OnVisible (if they exist, i can't remember).
Regards,
AB
|
|
|
|
|
Thanks for replay
-the means of doesn't work,it work in button click but not in form load.
-i use fs.DoFullScreen(true) twice,one for check the sip key visiblity another one for sip key hiding.
-i only omit some line of code regarding task bar hiding and sip keyboard view resize.
there is no function in name OnShow() or OnVisible() i use in onload() but it not work .
please help me .how it work in page load ,after page load in button click it work perfectly.
Ram Krishna Pattnayak
Software Developer(SDS)
Sun-Dew Solutions Pvt.Ltd
www.sundewsolutions.com
kolkata
|
|
|
|
|
I try to retrieve my old code where i use it in OnLoad().
I remember that i use it in OnActivate() or something like that. Let's try this.
Moreover, does it works if you leave the orginal code (without your modifications) ?
|
|
|
|
|
|
Hi,
someone has tried to use it with C#?
I get some error, could someone help me please?
Thanks in advance
|
|
|
|
|
An application creates a FullScreen form by setting its WindowState to Maximized as follows:
form.WindowState = FormWindowState.Maximized;
If there is a MenuBar (and / or a ToolBar on Pocket PC) attached to the Form, then it can't be made FullScreen.
On version 1.0 of the .NET Compact Framework on Pocket PC, to create a FullScreen application the WindowState property must be set inside the Form's OnLoad.
|
|
|
|
|
right.
.net CF can do it easy. why use other class or library?
|
|
|
|
|
I tried to create a full screen window on a Windows CE 5.0* based PocketPC. Maximizing the window still left the taskbar on the bottom of the desktop. I tried SHFullScreen but it didn't work like expected (maybe my fault). The only thing that worked is this class.
* Please note that Windows CE 5.0 and Windows Mobile 5 are somewhat different. Native Windows CE 5.0 looks like a real Windows Desktop.
Michael Berthold
Carstens & Co. GmbH Informationsmanagement
http://www.carstens-informationsmanagement.de
|
|
|
|
|
How do I run this code?
/mikey
|
|
|
|
|
when i import the coredll.dll file it gives me the error:
System.DllNotFoundException: Unable to load DLL (coredll.dll).
at WindowsApplication1.Form1.FindWindow(String lpClassName, String lpWindowName)
at WindowsApplication1.Form1.button1_Click(Object sender, EventArgs e) in d:\usman aftab butt\app7\windowsapplication1\windowsapplication1\form1.cs:line 124
Can you please tell me why isnt it working
|
|
|
|
|
Good job. I can't believe this.
Yesterday I solved my full screen problem on Windows CE (It took me 6 hours to get the
glue) I've done it in VB with Form.Size and Form.Location. It was an odyssey first I tried
Form.FromBorderstile, which don't work. Then I tried to get the Window handle of the Taskbar, and hide the window, which left a kind of shadow window of the Taskbar. At last I tried to relocate the Window and it worked, and now this. =
|
|
|
|
|
I have the very same problem on a Windows Mobile 5.0 Pocket PC Phone edition. You think you could explain this a little more in detail? I've tried the rest of the suggestions here and can't get it to work.
/mikey
|
|
|
|
|