Exemplo n.º 1
0
        //--------

        static void TestStaticMethodHook()
        {
            object o = cHook.Hook(typeof(MessageBox), "Show", new Type[] { typeof(string), typeof(string), typeof(MessageBoxButtons) },
                                  typeof(Program), "Hooked_MessageBoxShow", new Type[] { typeof(string), typeof(string), typeof(MessageBoxButtons) });

            MessageBox.Show("Static Method Hook\r\rThis should be hooked", "HookTest", MessageBoxButtons.OK);
            cHook.Unhook(o);

            MessageBox.Show("Static Method Hook\r\rThis should NOT be hooked", "HookTest", MessageBoxButtons.OK);
        }