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
3 answers

Detecting paste from clipboard in ToolStripTextBox (C#)

I need to detect if a user pastes text from the clipboard into a ToolStripTextBox. Therefore I've created a custom control which inherits from ToolStripTextBox. Then I wanted to override WndProc to catch WM_PASTE message, but I noticed that there is…
user1225775
  • 253
  • 5
  • 14
4
votes
1 answer

How to use WndProc in WPF when I am using the MVVM-Model?

Can anyone please help me? I want to use WndProc in WPF but I don´t want to use it in the MainWindow.xaml.cs like this: public MainWindow() { InitializeComponent(); } protected override void OnSourceInitialized(EventArgs e) …
Basde
  • 43
  • 3
3
votes
3 answers

C# Form Control Move

Is there anyway to control where you can move a form? So if i move a form, it can only be moved on the vertical axis and when i try to move it horizontally, nothing happens. I dont want a buggy implementation like locationchanged or move event and…
Ozzy
  • 10,285
  • 26
  • 94
  • 138
3
votes
5 answers

WndProc with no visible form?

I want to create a form on a second thread that will receive messages in it's WndProc method. What is the recommended way to create an invisible form like this? Is setting "ShowInTaskbar=false" and "Visible=false" enough, or is there a "cleaner"…
Jon Tackabury
  • 47,710
  • 52
  • 130
  • 168
3
votes
2 answers

Close callback or WM_CLOSE from a HWND reference

I'm calling the HtmlHelpA winapi method to display the .chm of my app. This method returns a HWND immediatelly, and the help window is shown as a separate window. Along with the window, I set a timer for this hwnd. My problem is that I need to know…
Rodrigo Rivera
  • 157
  • 1
  • 9
3
votes
2 answers

WM_NOTIFY and superclass chaining issue in Win32

For reference I'm using the window superclass method outlined in this article. The specific issue occurs if I want to handle WM_NOTIFY messages (i.e. for custom drawing) from the base control in the superclass I either need to reflect them back from…
DasMonkeyman
3
votes
2 answers

New to C#-would like to add WndProc

Everyone, I am just so new to C#, please help me... I would like to add WndProc to process messages, I have look into properties but I don't see the thunderbolt to display function name so I can add one I like. I search the internet and see WndProc…
Pevus
  • 163
  • 4
  • 10
3
votes
2 answers

Properly overriding WndProc

One day ago I had started to rewrite one of my old components and I decided to improve its readability. My component is a typical TWinControl that has overridden WndProc to handle a lot of messages of my own. There are so many code for each message…
Josef Švejk
  • 1,047
  • 2
  • 12
  • 23
3
votes
1 answer

How can I intercept wndproc of parent form in usercontrol

Is there method for receive wndproc of parent form in user control? I'm making titlebar user control and I want to receive windows message about form resize. (this form is formborderstyle=none.)
CodeReaper
  • 63
  • 10
3
votes
0 answers

Lambda as WNDPROC C++

I want to use c++ lambda expression as a window procedure in WinApi. I've seen it on many pages, this one for example. The code won't compile tho: WNDPROC x = [](HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -> LRESULT { return…
Cansisti
  • 153
  • 7
3
votes
1 answer

WndProc WM_NCMOUSEUP no fire

I've been trying to get a Form Border (title bar) mouse up for a bit now, and it seems like it's broken (I have found numerous other articles that state the same). I have tested: Const WM_LBUTTONUP = &H202 Const WM_MBUTTONUP = &H208 Const…
Aaron
  • 1,313
  • 16
  • 26
3
votes
0 answers

Changing the highlight color of a TextBox's selected text

I've been searching for a way to do this in WinForms for quite a while, anybody know of a way to change its default from SystemColors.Highlight to something else? Thanks in advance.
Spark
  • 1,007
  • 1
  • 8
  • 26
3
votes
1 answer

Set SizeAll cursor while moving control by handling NC_HITTEST

I wrote the WndProc method for a moveable control such this: protected override void WndProc(ref Message m) { const int WM_NCHITTEST = 0x0084; if (m.Msg == WM_NCHITTEST) { base.WndProc(ref m); …
3
votes
1 answer

Registered Window Message TaskbarButtonCreated not received

I am wanting to start looking at the Windows 7 TaskBar API. I have created a basic MFC Dialog Project but after registering the TaskbarButtonCreated message, it never gets sent to my WindowProc. Here is what I have: LRESULT…
Shane Haw
  • 723
  • 9
  • 22
3
votes
1 answer

Execution difference between "App.exe" and "App.vshost.exe" with WndProc

I am attempting to adapt an application developed in VS 2008/C# that listens to another application's WM_ messages through the use of the Control.WndProc method. When the "app.exe" version is run, WM_USER messages are visible and processed; however…
Bill
  • 335
  • 1
  • 4
  • 21