コード例 #1
0
ファイル: HwndSubclass.cs プロジェクト: dandanyouxiang/wpf-2
        static HwndSubclass()
        {
            DetachMessage = UnsafeNativeMethods.RegisterWindowMessage("HwndSubclass.DetachMessage");

            // Go find the address of DefWindowProc.
            IntPtr hModuleUser32 = UnsafeNativeMethods.GetModuleHandle(ExternDll.User32);
            IntPtr address       = UnsafeNativeMethods.GetProcAddress(new HandleRef(null, hModuleUser32), "DefWindowProcW");

            DefWndProc = address;
        }
コード例 #2
0
        private static IntPtr GetUser32ProcAddress(string export)
        {
            IntPtr hModule = UnsafeNativeMethods.GetModuleHandle(ExternDll.User32);


            if (hModule != IntPtr.Zero)
            {
                return(UnsafeNativeMethods.GetProcAddress(new HandleRef(null, hModule), export));
            }
            return(IntPtr.Zero);
        }