0

Hello I am trying to use Hotkeys in my C# Forms programm. But when i try to get the window the variable thisWindow always is 0. I have tryed using it in another program where it worked just fine. Is there another way to get the get the form?

    using System.Runtime.InteropServices;   

    [DllImport("user32.dll")]
    private static extern IntPtr FindWindow(String sClassname, String sAppName);

    [DllImport("user32.dll")]
    public static extern bool RegisterHotKey (IntPtr hWnd, int id, uint fsModifiers, uint vk);

     private void Form1_Load(object sender, EventArgs e)
    {
        thisWindow = FindWindow(null, "Form1");
        RegisterHotKey(thisWindow, 1, (uint)fsModifiers.Control, (uint)Keys.T);
     }
Mr_Grennn7
  • 109
  • 1
  • 12

0 Answers0