Possible to move the InputPanel on Windows CE .NET 4.1 ?

J

jd_ie

Hi all,

I am programming a Windows CE .NET 4.1 device using Visual C# .NET. I
add an InputPanel (Keyboard) to a form with the code:

private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;

and in that forms constructor I initialise the inputPanel with:

inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();

I can then show and hide the Input Panel with:

inputPanel1.Enabled = true;

and

inputPanel1.Enabled = false;

My question is, is there any way to change the location of the input
panel? I have found the following functions, SHSipInfo (
http://msdn.microsoft.com/library/d...y/en-us/win_ce/html/pwc_ControllingtheSIP.asp
) and SHSipPreference (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/apippc/html/ppc_aygshell_cayp.asp
) of which the second seems more likely to move the input panel for me.


Does anyone have experience using either of these functions through a
P/Invoke? I am not very familiar with the P/Invoke process. The
problems I can see are 1) what dll would I need to include in the
[DllImport("x.dll")] line, and 2) the second function takes a reference
to a form windows (a hWnd), and would I need to pass it one with a
location that I want the input panel to take? Is this possible, and if
so, does anyone have any source code examples?

Even if this is not possible, could someone let me know why? At least I
could go back to my boss with that information.

Thanking you all for any help,

Best regards,

Jonathan
 
J

jd_ie

Hi Daniel,

Thanks for the link to that thread. I translated the code into C# and
ran it. Here's what I have:

[DllImport("coredll.dll")]
private static extern bool SipGetInfo(SIPINFO sipInfo);
[DllImport("coredll.dll")]
private static extern bool SipSetInfo(SIPINFO sipInfo);

public struct RECT
{
public Int32 left;
public Int32 top;
public Int32 right;
public Int32 bottom;
}

public class SIPINFO
{
private Int32 cbSize;
private Int32 fdwFlags;
private RECT rcVisibleDesktop;
public RECT rcSipRect;
private Int32 dwImDataSize;
private Int32 pvImData;

public void New()
{
//cbSize=Marshal.SizeOf(GetType(SIPINFO));
cbSize=Marshal.SizeOf(this.GetType());
}
}

Then I run:

// sets SIP to top of the screen
SIPINFO sipInfo = new SIPINFO();
SipGetInfo(sipInfo);
sipInfo.rcSipRect.top = 0;
sipInfo.rcSipRect.bottom = 80;
SipSetInfo(sipInfo);

The code runs, but the keyboard does not move from its position at the
bottom of the screen. When the line 'SipGetInfo(sipInfo);' is run, the
values for the rcSipRect (top, bottom, etc.) are all zero, even though
the keyboard is at the bottom of the screen.

Is is possible that this works on Pocket PC and not on Windows CE 4.1?

Any other ideas anyone?

Thanks again,

Regards,

Jonathan
 
J

jd_ie

Ah,

I see my mistake. The New() function in visual basic .NET is the same
as the constructor in C#! I have made the change and the code works.
Thanks Daniel!

Regards,

Jonathan
 
C

Chris Tacke, eMVP

What does SipGetInfo return? If false, what does Marsahl.GetLastWin32Error
return (you'll have to modify your P/Ivoke declaration to add
SetLastError="true")?

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 

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