Esempio n. 1
0
        /// <summary>
        /// Method used to create the window. When overriding, the <c>hWnd</c> field must be set to the handle of the created window.
        /// </summary>
        protected virtual SafeHWND CreateWindow()
        {
            HINSTANCE hInst = GetModuleHandle();

            wCls = new WindowClass($"{GetType().Name}+{Guid.NewGuid()}", hInst, WndProc);
            return(Win32Error.ThrowLastErrorIfInvalid(CreateWindowEx(0, wCls.Atom, hWndParent: HWND.HWND_MESSAGE, hInstance: hInst)));
        }
Esempio n. 2
0
 /// <summary>
 /// Method used to create the window. When overriding, the <c>hWnd</c> field must be set to the handle of the created window.
 /// </summary>
 protected virtual SafeHWND CreateWindow()
 {
     lock (this)
     {
         if (!Handle.IsNull)
         {
             throw new InvalidOperationException("Window handle already exists.");
         }
         HINSTANCE hInst = GetModuleHandle();
         wCls = new WindowClass($"{GetType().Name}+{Guid.NewGuid()}", hInst, WndProc);
         return(Win32Error.ThrowLastErrorIfInvalid(CreateWindowEx(0, wCls.Atom, hWndParent: HWND.HWND_MESSAGE, hInstance: hInst)));
     }
 }