Questions tagged [wndproc]

WndProc is a .NET method that process Windows messages. It is the .NET equivalent of the C++ WindowProc method.

Official documentation including example.

For more information on how Windows messages are processed, can consult WindowProc.

348 questions
0
votes
1 answer

C# MDI - Hide MDI Scrollbars after MDI resize when MDIChild is out of bounds

I have a MDI Parent (Form1) and a MDI Child (Form2). I have currently disabled scroll bars for Form1 when Form2 goes past the bounds of Form1 by placing the following code within Form2: protected override void WndProc(ref Message m) { const int…
user1108076
  • 81
  • 1
  • 9
-1
votes
1 answer

How to handle key_down and key_up of char in WndProc?

I'm trying to handle key up and key down messages for arrow keys and A, W, S, D characters. I can handle arrow keys' up and down behavior using WM_KEYUPand WM_KEYDOWN. But when I try to handle above characters' up and down behavior, it doesn't work…
user13051721
-1
votes
1 answer

C# disable resize custom control on WncProc

With form1, when i hold bottom-left to resize, it's is limit at MinumumSize(300, 300). But although set MinimumSize = new Size(50, 50), Width and Height of MyControl still can less than 50. Do you know how to make MyControl like Form? Thank in…
-1
votes
1 answer

How to stop Wndproc() loop?

I have overridden wndproc() to use Hotkeys. but the form won't close anymore. and onclosing form the program stuck in an infinite loop in wndproc(). protected override void WndProc(ref Message m) { base.WndProc(ref m); if…
Mamo Ghandi
  • 77
  • 2
  • 10
-1
votes
1 answer

C# IntPtr values

I would like to know what the different value of IntPtr mean. For example, I know that 202 means left button up. Where can I find a list of the values? I am particularly interested in the meaning of 562, 274, and 161. Thanks!
-1
votes
1 answer

Window message loop ( WndProc | While (GetMEssage)) thread in .NET Core

I am trying to subscribe to window messages using .Net Core I am able to receive initial messages to create a window ( through pinvoke) and destroy messages. But after that my created windows gets blocked and does not receive any other messages. …
-1
votes
1 answer

Handling Window Movement after setting GWL_STYLE to 0

i want to have a border and title less window so i do SetWindowLongPtrW( window_handle, GWL_STYLE, 0 ); After that i can't move my Window so in my WndProc i do if( message == WM_NCHITTEST ) { RECT rc; GetClientRect( hwnd, &rc…
-1
votes
1 answer

Can this expression throw exception

This is one of the lines I am having in C# app override of WndProc: int hiWord = unchecked((short)((long)m.LParam >> 16)); if (hiWord != 0) { // do something } Is it possible that it may throw Arithmetic exception?
Leon Havin
  • 177
  • 2
  • 14
-1
votes
1 answer

How to use WM_NCHITTEST and WS_EX_LAYOUTRTL together?

I have SizableUserControl Class using WM_NCHITTEST message and CustomUserControl Class that use WS_EX_LAYOUTRTL and WS_EX_NOINHERITLAYOUT for mirror on RightToLeft. When I'm using both the resize on runtime is reversed. How can I fix it? Thanks for…
user6466445
  • 11
  • 1
  • 5
-1
votes
1 answer

IntPtr WndProc no suitable method found to override c#

i was trying to override this WndProc in my win form application but got error IntPtr WndProc no suitable method found to override. my code as follows protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool…
Thomas
  • 33,544
  • 126
  • 357
  • 626
-1
votes
1 answer

Trying to write a better WndProc Handling

I'm trying to write a better (I think is better) and reusable WndProc procedure, but the code below does not work because when I add more arguments to the sub firm it says that the sub does not accept that amount of arguments, of course that is…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
-1
votes
1 answer

How to get wndproc to handle messages to multiple windows

I've been trying to get a wndproc to successfully receive messages from the message queue and process them according to my code but it isn't working the way I want it to, what I'd like it to do is determine which window received WM_DESTROY or…
-1
votes
1 answer

How to do "something" when a window that is on background sends a specific message

im trying to do something on an app, that I know its name etc...(so I'm alredy casting findwindow and stuff) For ex. I want to notify user when that window tries to gain focus. I have mess around with wndproc yet I seem to not get it at all. for…
sake
  • 1
  • 3
-2
votes
1 answer

WM_SETTINGSCHANGE is received twice when changing preference to dark mode

I am catching the WM_SETTINGSCHANGE in WndProc so that I can update my app for dark/light mode changes. I run the app and catch the messages when I change my user preference in Personalization / Colors / Choose Your Mode (light, dark, custom) on…
Kevin
  • 1,548
  • 2
  • 19
  • 34
-2
votes
1 answer

Dispatching managed Win32 WndProc on a sepparate thread

I'm creating a window through unmanaged CreateWindowEx using PInvoke to work as a server in order to dispatch SendMessage calls from a different process. This should be wrapped in a synchronous function (class registration + window creation),…
Yves Calaci
  • 1,019
  • 1
  • 11
  • 37
1 2 3
23
24