Finding the class name of the On-Screen Keyboard?

﹥>﹥吖頭↗ 提交于 2019-12-02 04:45:50

Looks like the classname is: "OSKMainClass"

Here is the code I used to find this. It's just a simple C# Forms App

    [DllImport("User32.dll")]
    public static extern Int32 SetForegroundWindow(int hWnd);
    [DllImport("user32.dll")]
    public static extern int FindWindow(string lpClassName, string lpWindowName);
    [DllImport("user32.dll")]
    public static extern int GetClassName(int hWnd, StringBuilder lpClassName, int nMaxCount);
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        int hWnd =  FindWindow(null, "On-Screen Keyboard");
        StringBuilder buffer = new StringBuilder(128);
        GetClassName(hWnd, buffer, buffer.Capacity);
        MessageBox.Show(buffer.ToString());
    }

Got this from the following sources Activate Any Window With API and MSDN GetClassName function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!