示例#1
0
    static void Main(string[] args)
    {
        Application.EnableVisualStyles();

        Application.SetCompatibleTextRenderingDefault(false);


        _hookID = SetHook(_proc);
        //Application.Run();
        static_form1 = new WindowsFormsApplication3.Form1();
        Application.Run(static_form1);

        UnhookWindowsHookEx(_hookID);
    }
示例#2
0
    private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
    {
        // name = frm.Textbox1Text;
        //name = name.Replace("Form1", "");



        Keys key = (Keys)Marshal.ReadInt32(lParam);

        if (key == Keys.F2)
        {
            String a;
            a = DateTime.Now.ToString();
            a = "[" + a + "]";
            Clipboard.SetText(a);
            // SendKeys.Send("^{v}");
        }


        if (key == Keys.F3)
        {
            WindowsFormsApplication3.Form1 frm = new WindowsFormsApplication3.Form1();
            String name;

            //name = frm.Textbox1Text + "lol";
            name = static_form1.Textbox1Text;
            String a;
            // String b = textBox1_TextChanged.Text;
            a = DateTime.Now.ToString();
            a = "[" + a + "]" + name;
            Clipboard.SetText(a);
            // SendKeys.Send("^{v}");
        }

        return(CallNextHookEx(_hookID, nCode, wParam, lParam));
    }