Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Windows Mobile 6.5中隐藏小键盘弹出窗口?(c)_C#_Windows Mobile 6.5 - Fatal编程技术网

C# 如何在Windows Mobile 6.5中隐藏小键盘弹出窗口?(c)

C# 如何在Windows Mobile 6.5中隐藏小键盘弹出窗口?(c),c#,windows-mobile-6.5,C#,Windows Mobile 6.5,我有一个应用程序,本质上是一个通过一些对话框的向导。其中一个窗体上只有一个按钮,用于打开“常用拍照”对话框 在图片功能被取消后,小键盘图标就会出现,很不方便地覆盖在我的一个向导按钮上 我尝试通过调用以下命令将带盖的窗口设置为正面: nextButton.BringToFront(); 但这没有效果。我需要以某种方式禁用小键盘图标,但不知道如何做到这一点 注意-不是软键盘-而是用户点击的图像会显示出来 注意-此表单上没有文本控件-只有4个按钮-一个用于启动CameraCaptureDialog,

我有一个应用程序,本质上是一个通过一些对话框的向导。其中一个窗体上只有一个按钮,用于打开“常用拍照”对话框

在图片功能被取消后,小键盘图标就会出现,很不方便地覆盖在我的一个向导按钮上

我尝试通过调用以下命令将带盖的窗口设置为正面:

nextButton.BringToFront();
但这没有效果。我需要以某种方式禁用小键盘图标,但不知道如何做到这一点

注意-不是软键盘-而是用户点击的图像会显示出来

注意-此表单上没有文本控件-只有4个按钮-一个用于启动CameraCaptureDialog,其他几个按钮用于控制用户进入下一个和上一个屏幕

编辑

考虑到有两个人非常相信他们的代码可以正常工作,并且查看了网上的参考资料,我认为他们可能是对的,我想我会详细说明这个问题,因为这两个建议都不能解决这个问题

键盘项似乎是我在“拍照/摄像捕捉”对话框中选择菜单上的“取消”或“确定”按钮后留下的残留物

在退出对话框时,我似乎留下了中间/键盘菜单项,对此我似乎无能为力

下面是emulator在emulator上发生的情况

注意-通过隐藏按钮,调用以下所有选项对键盘图标没有影响:

// nextButton is the Button on the control hidden by the keyboard icon thingy
nextButton.Focus();
nextButton.BringToFront();
nextButton.Invalidate();
nextButton.Refresh();
nextButton.Show();

我还在寻找隐藏小键盘图标SIP图标的解决方案,我通过使用coredll.dll和user32.dll的FindWindowW和MoveWindow或SetWindowPos函数实现了这一点

声明我们感兴趣的函数:

    [DllImport("coredll.dll", EntryPoint = "FindWindowW", SetLastError = true)]
    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

    [DllImport("coredll.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
然后找到键盘手柄图标并调用SetWindowPos将其隐藏:

IntPtr hWnd = FindWindow(Nothing, "MS_SIPBUTTON");
SetWindowPos(hWnd, 1, 0, 0, 0, 0, &H80);
有用链接:

-跳到这篇文章的底部,寻找 用户名标记注释 编辑

为了编译,我不得不稍微修改一下

    const int SWP_HIDE = 0x0080;
    IntPtr hWnd = FindWindow(null, "MS_SIPBUTTON");
    SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 0, 0, SWP_HIDE);

这应该可以做到:-

这个答案取自下面的文章,我只添加了using语句。我使用的是Windows Mobile 6.1 Classic、.NET CF 3.5

using System;
using System.Runtime.InteropServices;

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string caption, string className);

[DllImport("coredll.dll", SetLastError = true)]
private static extern bool ShowWindow(IntPtr hwnd, int state);

[DllImport("coredll.dll")]
private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);

private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
private const int GW_CHILD = 5;

///         
/// Shows the SIP (Software Input Panel) button.        
///
static public void ShowHideSIP(int nShowOrHide)
{
    IntPtr hSipWindow = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
    if (hSipWindow != IntPtr.Zero)
    {
        IntPtr hSipButton = GetWindow(hSipWindow, GW_CHILD);
        if (hSipButton != IntPtr.Zero)
        {
            bool res = ShowWindow(hSipButton, nShowOrHide);
        }
    }
}

是的,我在这里发布的工作是关于隐藏图标而不是实际的键盘,MS_SIPBUTTON指的是按钮iconOK,我明白了,谢谢。尽管在调用引用的代码中有异常。我想这就是为什么它不起作用的原因。不知道为什么会这样。我需要做什么特殊的事情才能让它们工作吗?用户名必须更改为coredll,我认为它可以工作。很好,我试图制作一个示例项目,但由于某些原因,我的VS不允许为智能设备添加项目。。。但是很好,你的问题似乎已经解决了。谢谢你的帮助。我很感激。我接受了答案——当我可以在设备上部署和测试时,我将奖励奖金。它适用于模拟器。
using System;
using System.Runtime.InteropServices;

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string caption, string className);

[DllImport("coredll.dll", SetLastError = true)]
private static extern bool ShowWindow(IntPtr hwnd, int state);

[DllImport("coredll.dll")]
private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);

private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
private const int GW_CHILD = 5;

///         
/// Shows the SIP (Software Input Panel) button.        
///
static public void ShowHideSIP(int nShowOrHide)
{
    IntPtr hSipWindow = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
    if (hSipWindow != IntPtr.Zero)
    {
        IntPtr hSipButton = GetWindow(hSipWindow, GW_CHILD);
        if (hSipButton != IntPtr.Zero)
        {
            bool res = ShowWindow(hSipButton, nShowOrHide);
        }
    }
}