/// <summary> /// Window procedure for the tooltip /// </summary> /// <param name="hwnd">handle of window</param> /// <param name="msg">WM_ constant</param> /// <param name="wParam">wParam of message</param> /// <param name="lParam">lParam of message</param> /// <returns>0 if message was handled, otherwise 1</returns> private int ToolTipWindowProcedure(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam) { int j = msg; if (j <= Interop.WM_PAINT) { switch (j) { case Interop.WM_SETFOCUS: { if (_maximumDuration > 0) { if (_timer > 0) { Interop.KillTimer(hwnd, current._timer); } } }; break; case Interop.WM_KILLFOCUS: { if (_maximumDuration > 0) { current._timer = Interop.SetTimer(hwnd, 1, current._maximumDuration, IntPtr.Zero); } else { current.Hide(null); } }; break; case Interop.WM_CREATE: break; case Interop.WM_DESTROY: _visible = false; Interop.PostQuitMessage(0); break; default: if (j == Interop.WM_PAINT) { Interop.PAINTSTRUCT interop_PAINTSTRUCT = new Interop.PAINTSTRUCT(); IntPtr i = Interop.BeginPaint(hwnd, out interop_PAINTSTRUCT); if (i != IntPtr.Zero) { Graphics graphics = Graphics.FromHdcInternal(i); Draw(graphics); graphics.Dispose(); } Interop.EndPaint(hwnd, ref interop_PAINTSTRUCT); return(0); } break; } } else { if (j == Interop.WM_ERASEBKGND) { return(1); } if (j == Interop.WM_TIMER) { Interop.KillTimer(hwnd, current._timer); current._timer = 0; if (current._waitingForTimer) { //Interop.PostMessage(hwnd, Interop.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); //_visible=false; current.Hide(null); } return(0); } } return(Interop.DefWindowProc(hwnd, msg, wParam, lParam)); }
private int SplashWindowProcedure(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam) { switch (msg) { case 20: return 1; case 0x113: Interop.KillTimer(hwnd, this._timer); this._timer = 0; this._minimumDurationComplete = true; if (this._waitingForTimer) { Interop.PostMessage(hwnd, 0x10, IntPtr.Zero, IntPtr.Zero); } return 0; case 1: if (!this._transparencyKey.IsEmpty && this.IsLayeringSupported()) { Interop.SetLayeredWindowAttributes(hwnd, ColorTranslator.ToWin32(this._transparencyKey), 0, 1); } if (this._minimumDuration > 0) { this._timer = Interop.SetTimer(hwnd, 1, this._minimumDuration, IntPtr.Zero); } break; case 2: Interop.PostQuitMessage(0); break; case 15: { Interop.PAINTSTRUCT lpPaint = new Interop.PAINTSTRUCT(); IntPtr hdc = Interop.BeginPaint(hwnd, ref lpPaint); if (hdc != IntPtr.Zero) { Graphics g = Graphics.FromHdcInternal(hdc); g.DrawImage(this._image, 0, 0, this._width, this._height); if (this._customizer != null) { this._customizer(new SplashScreenSurface(g, new Rectangle(0, 0, this._width, this._height))); } g.Dispose(); } Interop.EndPaint(hwnd, ref lpPaint); return 0; } } return Interop.DefWindowProc(hwnd, msg, wParam, lParam); }