public MessageWindow(Standard.CS classStyle, Standard.WS style, Standard.WS_EX exStyle, Rect location, string name, Standard.WndProc callback) { this._wndProcCallback = callback; this._className = "MessageWindowClass+" + Guid.NewGuid().ToString(); Standard.WNDCLASSEX lpwcx = new Standard.WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(Standard.WNDCLASSEX)), style = classStyle, lpfnWndProc = s_WndProc, hInstance = Standard.NativeMethods.GetModuleHandle(null), hbrBackground = Standard.NativeMethods.GetStockObject(Standard.StockObject.NULL_BRUSH), lpszMenuName = "", lpszClassName = this._className }; Standard.NativeMethods.RegisterClassEx(ref lpwcx); GCHandle handle = new GCHandle(); try { handle = GCHandle.Alloc(this); IntPtr lpParam = (IntPtr)handle; 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, lpParam); } finally { handle.Free(); } }
public static short RegisterClassEx(ref Standard.WNDCLASSEX lpwcx) { short num = _RegisterClassEx(ref lpwcx); if (num == 0) { Standard.HRESULT.ThrowLastError(); } return(num); }
private static extern short _RegisterClassEx([In] ref Standard.WNDCLASSEX lpwcx);