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

Delphi - WndProc() in thread never called

I had code that worked fine when running in the context of the main VCL thread. This code allocated it's own WndProc() in order to handle SendMessage() calls. I am now trying to move it to a background thread because I am concerned that the…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
3
votes
1 answer

FormBorderStyle.None removes the native open effect of windows 8

I like to have my form borderless in C#. So I used this code: FormBorderStyle = FormBorderStyle.None; But it removes the aero effect of windows 8. The form opens suddenly like a blink. How can i bring the aero effect back?
Matin Lotfaliee
  • 1,745
  • 2
  • 21
  • 43
3
votes
1 answer

Class method for WndProc

This article explains brilliantly the options to call a class member WndProc. I've seen this response in stackoverflow but the main problem associating class member WndProc after CreateWindow is that some messages will be lost (including the…
Miquel
  • 8,339
  • 11
  • 59
  • 82
3
votes
1 answer

Form WM_KEYDOWN and WM_KEYUP messages aren't captured in WndProc

Form keydown and keyup messages aren't captured: public partial class Form1 : Form { const int WM_KEYDOWN = 0x100; const int WM_KEYUP = 0x101; protected override void WndProc(ref Message m) { if (m.Msg == WM_KEYDOWN) …
Paul
  • 25,812
  • 38
  • 124
  • 247
3
votes
1 answer

C# Suppressing mouse click for multiple mice

I have written an application that currently handles clicks from multiple mouse devices. I used this project and modified to handle mouse clicks as apposed to keyboards. This is working fine, however now I need to know if there is a way to suppress…
user1830285
  • 578
  • 8
  • 24
3
votes
1 answer

winapi C++ Handling Focus

I am working on a C++ winapi app and I am struggling to get SetFocus() to work for me. I create the Main window with WS_OVERLAPPEDWINDOW | WS_VISIBLE and then within that I create its children (a couple of buttons and the beginnings of my own…
Shane Haw
  • 723
  • 9
  • 22
3
votes
2 answers

WndProc in my WPF app not 'handling' WM_INPUT event

[Edit] Here's what I've gleaned about mouse input handling thus far. Note that I've learned this via a bunch of different sources and via experimentation, so don't take this as gospel: 1) Mouse event originates with mouse move 2)…
Matt
  • 61
  • 1
  • 7
2
votes
5 answers

C# Tell If Form Is Maximising

Ok heres my problem. I have a form that when it is not maximised, its maximum size has to be the total height of the components inside the form. To achieve this, i use this: private void resize_form(object sender, EventArgs e) { …
Ozzy
  • 10,285
  • 26
  • 94
  • 138
2
votes
0 answers

How do I set the class cursor to null?

Sorry about the long post! I have some explaining to do, I'm afraid... I have an application (in Unity3d, but for windows) that doesn't use WinForms, so I cannot use the Cursor class which is part of System.Windows.Forms namespace. But all the same,…
2
votes
2 answers

How to wrap a win32 WndProc into a C++ class?

Is this even possible? For example, let's say I have the following: class Window { private: WNDCLASSEX wc; public: inline WNDCLASSEX getWindowClass() { return wc; } Window(); LRESULT CALLBACK WndProc(HWND hwnd, UINT…
zeboidlund
  • 9,731
  • 31
  • 118
  • 180
2
votes
2 answers

Is it OK to call "Application.DoEvents" while a modal progress dialog is up?

I have a lengthy process that I can't run asynchronously, so just like Explorer when you're copying files, I have a progress dialog. I show the dialog modally, then perform the operations (we'll call it copying files to keep it abstract), update…
Dave
  • 1,521
  • 17
  • 31
2
votes
0 answers

What's the status of message crackers from windowsx.h?

The windowsx.h header has a feature called "message crackers", which lets you use HANDLE_MSG and other macros to automatically decode WPARAM and LPARAM, as received by your window procedure, into a specific message's parameters. As of the Windows 10…
2
votes
1 answer

Support Windows 11 Snap Layout in WPF app

I want to enable SnapLayout for WPF, because I use Customized Window, according to the documentation, I have to do it myself. For Win32 apps, make sure you are responding appropriately to WM_NCHITTEST (with a return value of HTMAXBUTTON…
karma
  • 147
  • 7
2
votes
0 answers

On Windows, how can I tell when a USB device goes to sleep from "USB Selective Suspend"

I have a C# application interfacing to a USB barcode scanner. Everything works fine until Windows suspends the USB bus. Turning off "USB Selective Suspend" in the power settings is not an option. I need to detect when the device (or the usb bus)…
2
votes
0 answers

WPF how to redirect all events from one window to another

In my WPF Project I have two windows. I need to redirect all the events from Window1 to Window2. Checkout this screenshot : What i am trying to do ? Take the screenshot as example, When I move mouse over the window1 button, it should highlight…
trickymind
  • 557
  • 5
  • 21