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

WPF: Close a secondary window when application shutdown without "programmer" intervention

It's quite hard to explain this in the title, if someone would like to change it it's ok. I have a situation where, in WPF, I create an "hidden" window which is transparent to the programmer. What I mean is that this window is created in static…
Francesco Belladonna
  • 11,361
  • 12
  • 77
  • 147
2
votes
1 answer

Return an IOleCommandTarget from processing WM_GETOBJECT in a NativeWindow

I am trying to retrieve an IOleCommandTarget reference from a panel control handle, so that I can call IOleCommandTarget.Exec() on it. NativeMethods.IOleCommandTarget target = null; if…
Hadster
  • 445
  • 1
  • 5
  • 11
2
votes
2 answers

Concept of WNDCLASSEX, good programming habits and WndProc for system classes

I understand that the Windows API uses "classes", relying to the WNDCLASS/WNDCLASSEX structures. I have successfully gone through windows API Hello World applications and understand that this class is used by our own windows, but also by Windows…
luiscubal
  • 24,773
  • 9
  • 57
  • 83
2
votes
1 answer

Custom WndProc doesn't stop resizing

I made a form that handles WM_CREATE, WM_ACTIVATE, WM_NCCALCSIZE and WM_NCHITTEST. It also overrides the paint method. The problem is when I resize the form it doesn't stop resizing. I tried to compare the messages with a working window but spy++…
Matic Babnik
  • 43
  • 2
  • 8
2
votes
5 answers

Listening to OS messages in C#

Is there any methods in C# similar to WndProc method to listen to the OS messages.I cant use WndProc because,my class is neither Form nor Inherited from Control(Its DLL) protected override void WndProc(ref System.Windows.Forms.Message m) { …
Dark Knight
  • 3,507
  • 8
  • 35
  • 44
2
votes
1 answer

Overriding .NET WebBrowsers WndProc

For one of my projects, i'm overriding a AXShockwaveFlash control to disable right click and i can manage it using the following code; public class FlashPlayer : AxShockwaveFlashObjects.AxShockwaveFlash { private const int WM_MOUSEMOVE =…
HuseyinUslu
  • 4,094
  • 5
  • 33
  • 50
2
votes
1 answer

Detecting USB drive insertion and removal using windows service and Vb.Net

I want in my application to detect if a USB Drive is plugged in or plugged out. I have googled a lot about it and actually found a lot answers but none worked exactly how I wanted it to be. I found one that works perfectly and give message when a…
2
votes
2 answers

Get text from a button in an application using win32 C++ and hooks

I am trying to retrieve the text of a button on Calculator (calc.exe) using Winapi. I have hooked WH_CALLWNDPROC and the hook works fine. But I am unable to retrieve the text of any button (say numeric 7). I am using GetDlgItemText: TCHAR…
stamhaney
  • 1,246
  • 9
  • 18
2
votes
1 answer

C++ Winapi HWND Get WndProc configuration

I need to get the current WndProc with its messages and configuration and add my own code to it. Why do I need this? Because I'm working under an IDE that defines a window (and its children controls) with a WndProc, and I need to modify it because…
ProtectedVoid
  • 1,293
  • 3
  • 17
  • 42
2
votes
0 answers

Why overriding PreProcessMessage and WndProc of WebBrowser in hope to capture mouse clicks gives no effect?

I coded this junk: using System.Windows.Forms; namespace WindowsFormsApplication1 { class SmartWebBrowser : WebBrowser { private const int WM_LBUTTONDOWN = 0x0201; private const int WM_LBUTTONUP = 0x0202; private…
Kosmo零
  • 4,001
  • 9
  • 45
  • 88
2
votes
0 answers

Monitoring Clipboard action that happens only in my application in a wpf application

I want to add to my WPF application the ability to monitor Clipboard changes. But also I want to filter only Clipboard changes that happens in my app. So I wrote the following code in one of the main view models, this VM inherits from…
2
votes
1 answer

Why is this code running?

I wrote the following WndProc. It is used by a Notify Icon. I removed the unimportant parts (like default labels) for an better overview. When I click the Nofify Icon with the right mouse button, the context menu appears. When I click an item, I get…
CalibeR.50
  • 370
  • 2
  • 13
2
votes
1 answer

How to handle Win+Shift+LEft/Right on Win7 with custom WM_GETMINMAXINFO logic?

I have a custom windows implementation in a WPF app that hooks WM_GETMINMAXINFO as follows: private void MaximiseWithTaskbar(System.IntPtr hwnd, System.IntPtr lParam) { MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam,…
Steven Robbins
  • 26,441
  • 7
  • 76
  • 90
2
votes
1 answer

WM_SYSCOMMAND with wParam 0xF063?

I am trapping WM_SYSCOMMAND messages in WinForm in a C# application for reasons that are not relevant. Sometimes, my handler receives a WM_SYSCOMMAND message with the wParam 0xF063. There is no 0xF063 in the documentation:…
KatDevsGames
  • 1,109
  • 10
  • 21
2
votes
0 answers

How do I hook into the WndProc of another application in Vb.Net

I am trying to simulate some clicking on a flash control on a window belonging to another executable using the AutoIT COM Object. Since it is a long-running script I'd like to keep the system usable by normal (read: physical) means meanwhile. I…
beppe9000
  • 1,056
  • 1
  • 13
  • 28