Respond to double clicking on the title bar

Started by
3 comments, last by Dean Harding 19 years, 4 months ago
Hi all, I need to know when the user double clicks on the title bar. I tried WM_SYSCOMMAND but it only deals with the system menu and the buttons. Thanks if you can help me.
Advertisement
Try processing the WM_NCLBUTTONDBLCLK message. You'll need to do some trickery to make sure the click was actually on the title bar (and not for example, on the resize border), and also to stop the system processing the message normally.

May I ask what you need to process that message for? It's generally not a good idea to mess with standard windows behaviour without very good reason...
Quote:Original post by Dean Harding
Try processing the WM_NCLBUTTONDBLCLK message. You'll need to do some trickery to make sure the click was actually on the title bar
For this, you can check if wparam == HTCAPTION.
Thanks for the quick responses. I found another way solve my problem. I agree with Dean that it's not good to mess around with this. I am trying to make a Direct3D App that will properly handle series of alt-tab, fullscreen toggle, window resize and move, in any order. The problem I had was if I do it in the following order:

Step 1: maximize window
Step 2: switch to fullscreen
Step 3: alt-tab out
Step 4: alt-tab back in
Step 5: toggle fullscreen (back to the maximized window)
Step 6: restore window (back to non-maximized window)

If I started with a window say at position (100,100), and maximize the window by double clicking on the title bar, and go through the rest of the steps, at the last step when I restore the window, it won't go back to it's original position, but rather it moves to the top left coner of the screen (0,0). Anyways I solved the problem by saving the previous window position before getting the new position in WM_MOVE.

You see, I could not find any code on the net that is extremely well-behaved for various windows commands as outline above. Not even Microsoft's DirectX Samples were good enough for my anal-retentiveness =P
Good stuff, definately a valid case for what you wanted :)

This topic is closed to new replies.

Advertisement