Пример #1
0
 public void NativeWindow_WndProc_InvokeWithoutHandle_Nop(int msg)
 {
     using (new NoAssertContext())
     {
         var window = new SubNativeWindow();
         var m      = new Message
         {
             Msg    = msg,
             Result = (IntPtr)1
         };
         window.WndProc(ref m);
         Assert.Equal(IntPtr.Zero, m.Result);
     }
 }
Пример #2
0
        public void NativeWindow_WndProc_InvokeWithCreatedHandle_Success(int msg)
        {
            var window = new SubNativeWindow();

            window.CreateHandle(new CreateParams());

            try
            {
                var m = new Message
                {
                    Msg    = msg,
                    Result = (IntPtr)1
                };
                window.WndProc(ref m);
                Assert.Equal(IntPtr.Zero, m.Result);
            }
            finally
            {
                window.DestroyHandle();
            }
        }
Пример #3
0
        public void NativeWindow_WndProc_InvokeWithValidAssignedHandle_Success(int msg)
        {
            using var control = new Control();
            var window = new SubNativeWindow();

            window.AssignHandle(control.Handle);

            try
            {
                var m = new Message
                {
                    Msg    = msg,
                    Result = (IntPtr)1
                };
                window.WndProc(ref m);
                Assert.Equal(IntPtr.Zero, m.Result);
                Assert.Equal(control.Handle, window.Handle);
            }
            finally
            {
                window.ReleaseHandle();
            }
        }