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
4
votes
1 answer

Which messages are processed by DefWindowProc?

is there any documentation which messages are processed by DefWindowProc, and how? I recently stumbled over WM_SETFONT/WM_GETFONT not being handled, I'm not sure if there's a mistake in my code, or if that's expected behavior, so I tried the…
peterchen
  • 40,917
  • 20
  • 104
  • 186
4
votes
2 answers

Winforms keypress and barcode scanner

I managed using bar-code scanner successfully in my WPF project using a keyboard hook as follows (I skip some details, but basically, I can rely on the fact that I know which keyboard is my scanner). /// /// Add this KeyboardHook to a…
neggenbe
  • 1,697
  • 2
  • 24
  • 62
4
votes
1 answer

Does the Message to WndProc change value from 32Bit OS to 64Bit OS?

When the following Method is overrided in .NET it seems that I get different Messages in 32Bit and 64Bit OS:es. Can this be true? protected override void WndProc(ref Message m) I want to catch the following: private const int WM_LBUTTONDBLCLK =…
Filip Ekberg
  • 36,033
  • 20
  • 126
  • 183
4
votes
0 answers

.NET Modal Window On Top of VB6

We have a VB6 app that shows a .NET WPF modal Window (on the main VB6 thread). It correctly blocks interaction with the VB6 UI, because the thread blocks at window.ShowDialog(). We also have a timer in VB6. Since the timer ticks on the main thread…
Jeff
  • 35,755
  • 15
  • 108
  • 220
4
votes
1 answer

Windows Message for all resizing actions

Does someone know a message that gets send at the end of a resizing event (like double clicking app bar, maximize button click, drag to the top of the screen, ...), a good example is WM_EXITSIZEMOVE, but it's only at the end of the dragging of the…
Rakete1111
  • 47,013
  • 16
  • 123
  • 162
4
votes
2 answers

How to use this WndProc in Windows Forms application?

Please guide me how to use this WndProc in Windows Forms application: private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == NativeCalls.APIAttach && (uint)lParam ==…
Thomas
  • 33,544
  • 126
  • 357
  • 626
4
votes
1 answer

Multiple device inserted notifications

Can anyone tell me why when using the following code I receive multiple (three or four device arrival notifications)? Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Const WM_DEVICECHANGE As Integer = &H219 Const…
thehoten
  • 123
  • 1
  • 9
4
votes
2 answers

Finding WndProc Address

How can I find the address of a WndProc (of a window of another process). Even if I inject a DLL and try to find it with either GetClassInfoEx() or GetWindowLong() or GetWindowLongPtr() I always get values like 0xffff08ed, which is definitely not an…
Adam
  • 637
  • 1
  • 8
  • 21
4
votes
1 answer

How to handle WM_SETCURSOR in C#

In my media player application, I hid the cursor using SetCursor(NULL) and to make sure that Windows does not reset the cursor state, I handled WM_SETCURSOR in my WndProc method. protected override void WndProc(ref Message m) { switch (m.Msg) …
godly-devotion
  • 177
  • 3
  • 15
4
votes
3 answers

How do I send/receive windows messages between VB6 and c#?

I know I can receive messages with the code below in c#, how do I send to vb6, and receive in vb6, and send from vb6? [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] …
cabgef
  • 1,398
  • 3
  • 19
  • 35
4
votes
6 answers

Disable maximizing WPF window on double click on the caption

How to disable maximizing WPF window on double click on the caption and leave resizing available? I know that ResizeMode disables maximizing, but it also prevents resizing the form ResizeMode="CanMinimize" I know how to remove maximize and…
Alex Klaus
  • 8,168
  • 8
  • 71
  • 87
4
votes
1 answer

Capture mouse touch the title bar of win form

i got some trick to capture mouse touch title bar but the routine fire repeatedly when i place mouse on title bar. here is the routine protected override void WndProc(ref Message m) { if (m.Msg == 0xA0) // WM_NCMOUSEMOVE { …
Thomas
  • 33,544
  • 126
  • 357
  • 626
4
votes
2 answers

how to route a message to the control's standard WNDPROC

When a standard window control (e.g. an "EDIT" control) is created, its WNDPROC is defined as part of the window class (i.e. "EDIT" has a specific WNDPROC that is designed to make the window display & behave as an edit-control). MFC allows you to…
Mordachai
  • 9,412
  • 6
  • 60
  • 112
4
votes
2 answers

WebBrowser control: how to suppress message: do you want to close this window

I'm new to WebBrowser control. In the current project, we use WebBrowser control to integrate with existing project. All popup windows are displayed in a new windows form. When "javascript window:close" is called on the popup window, the IE instance…
Keping
  • 131
  • 1
  • 6
4
votes
1 answer

Winforms - WM_NCHITEST message for click on control

I have a simple windows form with no border and several label controls (nothing that needs to be clicked). I needed to be able to allow the user to move the form by clicking anywhere on it, so I found this question, and used the following code found…
Mansfield
  • 14,445
  • 18
  • 76
  • 112