public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) { this._wndProcCallback = callback; this._className = "MessageWindowClass+" + Guid.NewGuid().ToString(); WNDCLASSEX wndclassex = new WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), style = classStyle, lpfnWndProc = MessageWindow.s_WndProc, hInstance = NativeMethods.GetModuleHandle(null), hbrBackground = NativeMethods.GetStockObject(StockObject.NULL_BRUSH), lpszMenuName = "", lpszClassName = this._className }; NativeMethods.RegisterClassEx(ref wndclassex); GCHandle value = default(GCHandle); try { value = GCHandle.Alloc(this); IntPtr lpParam = (IntPtr)value; this.Handle = NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, lpParam); } finally { value.Free(); } this._dispatcher = Dispatcher.CurrentDispatcher; }
public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) { Class6.yDnXvgqzyB5jw(); base(); this._wndProcCallback = callback; Guid guid = Guid.NewGuid(); this._className = string.Concat("MessageWindowClass+", guid.ToString()); WNDCLASSEX wNDCLASSEX = new WNDCLASSEX() { cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), style = classStyle, lpfnWndProc = MessageWindow.s_WndProc, hInstance = Standard.NativeMethods.GetModuleHandle(null), hbrBackground = Standard.NativeMethods.GetStockObject(StockObject.NULL_BRUSH), lpszMenuName = "", lpszClassName = this._className }; WNDCLASSEX wNDCLASSEX1 = wNDCLASSEX; Standard.NativeMethods.RegisterClassEx(ref wNDCLASSEX1); GCHandle gCHandle = new GCHandle(); try { gCHandle = GCHandle.Alloc(this); IntPtr intPtr = (IntPtr)gCHandle; this.Handle = Standard.NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, intPtr); } finally { gCHandle.Free(); } }
public static short RegisterClassEx(ref WNDCLASSEX lpwcx) { short num = NativeMethods._RegisterClassEx(ref lpwcx); if (num == 0) { HRESULT.ThrowLastError(); } return(num); }
public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) { // A null callback means just use DefWindowProc. _wndProcCallback = callback; _className = "MessageWindowClass+" + Guid.NewGuid().ToString(); var wc = new WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), style = classStyle, lpfnWndProc = s_WndProc, hInstance = NativeMethods.GetModuleHandle(null), hbrBackground = NativeMethods.GetStockObject(StockObject.NULL_BRUSH), lpszMenuName = "", lpszClassName = _className, }; NativeMethods.RegisterClassEx(ref wc); GCHandle gcHandle = default(GCHandle); try { gcHandle = GCHandle.Alloc(this); IntPtr pinnedThisPtr = (IntPtr)gcHandle; Handle = NativeMethods.CreateWindowEx( exStyle, _className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pinnedThisPtr); } finally { gcHandle.Free(); } _dispatcher = Dispatcher.CurrentDispatcher; }
public static short RegisterClassEx(ref WNDCLASSEX lpwcx) { short ret = _RegisterClassEx(ref lpwcx); if (ret == 0) { HRESULT.ThrowLastError(); } return ret; }
private static extern short _RegisterClassEx([In] ref WNDCLASSEX lpwcx);