Пример #1
0
        public void EnableOsk(TextBox textbox)
        {
            lock (syncRoot)
                {

                    var p = textbox.PointToScreen(new Point(0, 0));
                    lastPoint = CalculatePoint(p, textbox);
                    int x = (int)lastPoint.X;
                    int y = (int)lastPoint.Y;
                    if (process == null || process.HasExited)
                    {
                        var iPtr = new IntPtr();

                        var psi = new ProcessStartInfo
                        {
                            FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) +
                                       Path.DirectorySeparatorChar + "osk.exe",
                            WorkingDirectory =
                                Environment.GetFolderPath(Environment.SpecialFolder.System),
                            WindowStyle = ProcessWindowStyle.Hidden,

                        };

                        process =
                            Process.Start(psi);

                        timer = new Timer { Interval = 1000 };
                        timer.Tick += TimerTick;
                        timer.Start();
                    }
                    else
                    {

                        bool t = SetWindowPos(process.MainWindowHandle, (IntPtr)SpecialWindowHandles.HWND_TOP, x, y,
                                              OskWidth, OskHeight,
                                              SetWindowPosFlags.SWP_SHOWWINDOW | SetWindowPosFlags.SWP_NOACTIVATE);
                    }
                }
        }