Sign in to follow this  
Tybon

Respond to double clicking on the title bar

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this