The MASM Forum

Microsoft 64 bit MASM => Examples => Topic started by: hutch-- on November 03, 2018, 06:07:02 PM

Title: Demo using WM_NCHITTEST
Post by: hutch-- on November 03, 2018, 06:07:02 PM
There are a number of interesting things you can do using the lower level non client message, this is just one of them. It is built into the core of every version of Windows I can remember and it is an old technique that does something useful, you can use it to click and drag from any position in the window area to move the window with that mouse. In this example I have restricted its range to where the title bar normally is and have used a line at the height of the title bar area to appear and function like a title bar.

Effectively any size title bar you want at any colour you want and it is small and efficient code produced by the lowest level guts of a window.
Title: Re: Demo using WM_NCHITTEST
Post by: felipe on November 04, 2018, 01:21:48 AM
Nice one  :icon14: Thanks  :t
Title: Re: Demo using WM_NCHITTEST
Post by: sinsi on November 04, 2018, 09:51:31 AM
Does your way work when a windows has a border (resizing etc)?

I use this

wm_lbuttondown: invoke SendMessage,hwnd,WM_NCLBUTTONDOWN,HTCAPTION,lparam

Title: Re: Demo using WM_NCHITTEST
Post by: hutch-- on November 04, 2018, 10:11:18 AM
It does but it does not look any good when you set it to a sizing border. Your method looks good, I will have to try it out.
Title: Re: Demo using WM_NCHITTEST
Post by: hutch-- on November 04, 2018, 02:03:33 PM
sinsi,

I put your mod in the same code and it works fine.  :t

      .case WM_LBUTTONDOWN
        rcall GetCursorPos,ptr$(pt)
        rcall ScreenToClient,hWin,ptr$(pt)
        cmp pt.y, tbht
        ja @F
        invoke SendMessage,hWin,WM_NCLBUTTONDOWN,HTCAPTION,lParam
        @@:
        ret