News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Window sizing

Started by lamer, June 11, 2005, 11:16:00 AM

Previous topic - Next topic

lamer

Hi all!
Is there any way to force the window to be sized from one side only - either left or right or top or bottom?
And show the "size" cursor only for needed side and not for others (and not the diagonal "size" cursor)?

Regards

chemicalNova

You could intercept the WM_SIZING message of your window, and do something like this:

;size from right only..
.if uMsg == WM_SIZING
    .if wParam != WMSZ_RIGHT
        return 0
    .endif
.endif

chem

lamer

Unfortunately this does not prevent appearance of sizing cursors

chemicalNova

The only other way I would think would be to intercept WM_MOUSEMOVE and check if its at the window edge. If it is, use SetCursor to change the mouse back to the normal Cursor (instead of the resize cursor) and store the window height and width. When WMSZ_(whatever side you want to be able to re-size from) is fired, use LockWindowUpdate, reset the window height and width, then update the window (LockWindowUpdate,0).

chem

lamer

I have thought about it...
Wel, I'll try...
Thanks any way.

donkey

Well, I havene't ever tried this but I would assume that the edge of the Window is in the non-client area so you should be able to capture the mouse when it moves over it (WM_NCMOUSEMOVE) and set your own cursors. You would have to remove the thick frame so that Windows doesn't try it. You could then resize the window on your own. If I get some time this weeked from my current project I will give it a try.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Maelstrom

I remember doing this once for a custom splitter bar application.  As I remember it I had to return HTCLIENT int he WM_NCHITTEST message.  I know this fixes the mouse pointer issue but I cant remember if it also restricts resizing also...

donkey

Restricting diagonal window resizing can be handled easily enough if you replace the sizing modal loop with your own by doing the sizing yourself. Might be a bit choppy on the first few attempts but I can't see that much in the way of technical problems with doing it smoothly and quickly.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

lamer

Hi!
I did not see your answers, but did the sameĀ  :bg - first of all I catched the WM_NCMOUSEMOVE with changing cursor, but then decided to draw my own border - and now I just do it by catching WM_MOUSEMOVE over this border.
It has not been so difficult :green2
Thank you