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

Handling System Shutdown in WPF

How can I override WndProc in WPF? When my window close, I try to check if the file i'm using was modified, if so, I have to promt the user for "Do you want to save changes?" message, then close the file being used and the window.However, I cannot…
chona
6
votes
3 answers

WM_QUERYENDSESSION is causing me problems

Making a simple application, so when the user logs out of Windows, it of course shuts the application down. We are making a simple USB Alert application which STOPS shutdown if a USB is detected when the user is logging off This is the code so…
x06265616e
  • 854
  • 11
  • 14
5
votes
2 answers

WPF: How do I make a custom modal dialog flash?

Normally when you open a Modal Dialog and try to click on it's parent window the Modal Dialog's titlebar flashes. When creating a custom, borderless, chromeless, window in WPF you lose all that functionality and must rebuild it yourself. I've looked…
Rabid Penguin
  • 1,084
  • 9
  • 22
5
votes
1 answer

What should I do to have WS_MAXIMIZE working?

There is how my program begins: int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd) { MapEditor mapEditor; mapEditor.Run(); return 0; } and there is…
Mickael Bergeron Néron
  • 1,472
  • 1
  • 18
  • 31
5
votes
1 answer

Unexplained OverflowException casting IntPtr representing screen-coordinate to Int32

We have a WinForms AnyCPU application in which a vendor library control occasionally throws the following exception on a 64-bit user's box running multiple monitors: System.OverflowException: Arithmetic operation resulted in an overflow. at…
Ani
  • 111,048
  • 26
  • 262
  • 307
5
votes
2 answers

Exception thrown when WndProc is overloaded

I'm trying to get at the Close event of the .NET WebBrowser type, which doesn't seem to work out of the box. (EDIT: This event is emitted when the window.close() call is issued in a script running in the browser.) One solution I've seen is to extend…
paul
  • 1,655
  • 11
  • 23
5
votes
2 answers

Why should i use WndProc when i have form events?

I have a basic question about using WndProc in my form application. I want to know what is the use of the WndProc method when i have form events available. In which cases do i need to create custom messages? MSDN tells that it is used only to…
badmaash
  • 4,775
  • 7
  • 46
  • 61
4
votes
1 answer

How to subclass a win32 control and maintain compatibility with older versions of comctl32.dll?

Version 6.0 of the common controls (comctl32.dll) implements a new approach for subclassing controls that is not available on older versions of Windows. What is the best way to implement subclassing so that it works on systems that support either…
Nathan Moinvaziri
  • 5,506
  • 4
  • 29
  • 30
4
votes
2 answers

How could a Delphi 6 TWinControl descendant's WndProc() execute sometimes off the main VCL thread?

I have a Delphi 6 application that is heavily multithreaded. I have a component I created that descends from TWinControl. When I first built it, I used a hidden window and it's WndProc to handle messages, allocated with AllocateHwnd(). Recently I…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
4
votes
1 answer

How does DispatchMessage decide which WndProc to use?

I'm going through some code for an open source project and this is my first time dealing with a Win32 app (mostly did console stuff). I see that several functions within the code are windows procedures because they return LRESULT CALLBACK. Is there…
Chaos Fighter
  • 41
  • 1
  • 4
4
votes
1 answer

Properly using AddClipboardFormatListener and subscribing to WM_CLIPBOARDUPDATE message

I am currently attempting to use the Windows clipboard and its notifications in my application. Specifically, I am attempting to subscribe to the WM_CLIPBOARDUPDATE window message by using the AddClipboardFormatListener() function. Previously, I had…
Thatchdawg
  • 73
  • 1
  • 6
4
votes
1 answer

How to catch a Lua exception in C#

I am using the an assembly named LuaInterface to run lua-code inside my C# application. During the lua execution I create some WinForms & map event handlers (lua-methods) to them. The problem is that the doString (aka runLuaCode) method only runs…
Tobias Boschek
  • 2,158
  • 3
  • 18
  • 22
4
votes
4 answers

What message causes a button to send a WM_COMMAND message

I know that a Button, when clicked, sends the WM_COMMAND message to it's parent, but what message does it receive that makes it send this message? I am overriding the default WndProc of a button and the button does not receive the WM_COMMAND…
John Zane
  • 878
  • 1
  • 9
  • 22
4
votes
1 answer

Create a native Windows window in JNA and some GetWindowLong with GWL_WNDPROC

Good day, I have been using JNA for a while to interact with the Windows API and now I am stuck when creating a window. As far as I have done the following: 1. Have created a child window of an existing window and obtained a valid handler to it. 2.…
Nikola Yovchev
  • 9,498
  • 4
  • 46
  • 72
4
votes
1 answer

How can I determine the amount of movement a mouse is allowed between two click for the WM_LBUTTONDBLCLK message to be fired?

How can I determine the amount of movement a mouse is allowed between two click for the WM_LBUTTONDBLCLK message to be fired? MSDN Receiving Double-Click Messages The OS generates a double-click message when the user clicks a mouse button twice…
ClassicThunder
  • 1,896
  • 16
  • 25
1 2
3
23 24