Exemple #1
0
        public NativeWindow(bool isDesignMode)
        {
            if (isDesignMode)
            {
                return;
            }

            ClassName = $"{nameof(NotifyIcon)}-{DateTime.Now.Ticks}";

            _messageReceiver = OnMessageReceived;

            _creationMessage = Native.RegisterWindowMessageW("TaskbarCreated");

            var windowClass = new WindowClassEx()
            {
                cbSize = (uint)Marshal.SizeOf(typeof(WindowClassEx)), lpszClassName = ClassName, lpfnWndProc = _messageReceiver
            };

            Native.RegisterClassExW(ref windowClass);

            Handle = Native.CreateWindowExW(0, ClassName, string.Empty, 0, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
        }
Exemple #2
0
 public static extern ushort RegisterClassExW(
     [In] ref WindowClassEx lpwcx);