Author Topic: Demo using WM_NCHITTEST  (Read 1344 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6768
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Demo using WM_NCHITTEST
« 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

felipe

  • Member
  • *****
  • Posts: 1249
  • Eagles are just great!
Re: Demo using WM_NCHITTEST
« Reply #1 on: November 04, 2018, 01:21:48 AM »
Nice one  :icon14: Thanks  :t
Felipe.

sinsi

  • Member
  • *****
  • Posts: 1188
Re: Demo using WM_NCHITTEST
« Reply #2 on: November 04, 2018, 09:51:31 AM »
Does your way work when a windows has a border (resizing etc)?

I use this
Code: [Select]
wm_lbuttondown: invoke SendMessage,hwnd,WM_NCLBUTTONDOWN,HTCAPTION,lparam
I can walk on water but stagger on beer bourbon.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6768
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Demo using WM_NCHITTEST
« Reply #3 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6768
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Demo using WM_NCHITTEST
« Reply #4 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

« Last Edit: November 04, 2018, 06:15:45 PM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: