News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Demo using WM_NCHITTEST

Started by hutch--, November 03, 2018, 06:07:02 PM

Previous topic - Next topic

hutch--

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.

felipe

Nice one  :icon14: Thanks  :t

sinsi

Does your way work when a windows has a border (resizing etc)?

I use this

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

🍺🍺🍺

hutch--

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.

hutch--

#4
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