[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

How can I hide resizing arrow when subclassing WM_GETMINMAXINFO

(Mike Mitchell)

11/1/2011 4:08:00 PM

VB6: I've subclassed WM_GETMINMAXINFO to restrict form to allow only
vertical resizing, but I still get a double-headed resize arrow when I
pass the mouse across the right-hand edge of the form.

How can I hide or suppress the resize arrow when user attempts to
resize horizontally?

MM
4 Answers

DaveO

11/1/2011 4:30:00 PM

0


"MM" <kylix_is@yahoo.co.uk> wrote in message
news:n560b7lm29c58h2jq6862o2t4j33bqh5nb@4ax.com...
> VB6: I've subclassed WM_GETMINMAXINFO to restrict form to allow only
> vertical resizing, but I still get a double-headed resize arrow when I
> pass the mouse across the right-hand edge of the form.
>
> How can I hide or suppress the resize arrow when user attempts to
> resize horizontally?
>
> MM

You'll want thses declarations

Private Const WM_NCHITTEST As Long = &H84
Private Const HTBOTTOM As Long = 15
Private Const HTBOTTOMRIGHT As Long = 17
Private Const HTBORDER As Long = 18
Private Const HTBOTTOMLEFT As Long = 16
Private Const HTLEFT As Long = 10
Private Const HTRIGHT As Long = 11
Private Const HTTOP As Long = 12
Private Const HTTOPLEFT As Long = 13
Private Const HTTOPRIGHT As Long = 14

Add this to your routine, you'll need to replace the XXXX and xxxxxx with
whatever you use
This will prevent side to side cursor from showing and replace the corner
ones with the up/down one.
This only allows vertical resizing I'll let you work out how to allow only
horizontal sizing

Case WM_NCHITTEST
WinMsg_XXXX = CallWindowProc(xxxxxxx), hWnd, Msg, wp, lp)
Select Case WinMsg_XXXX
Case HTLEFT, HTRIGHT
WinMsg_XXXX = HTBORDER
Case HTTOPLEFT, HTTOPRIGHT
WinMsg_XXXX = HTTOP
Case HTBOTTOMLEFT, HTBOTTOMRIGHT
WinMsg_XXXX = HTBOTTOM
End Select

Have fun
DaveO


(Mike Mitchell)

11/1/2011 6:25:00 PM

0

On Tue, 1 Nov 2011 16:29:53 -0000, "DaveO" <djo@dial.pipex.com> wrote:

>
>"MM" <kylix_is@yahoo.co.uk> wrote in message
>news:n560b7lm29c58h2jq6862o2t4j33bqh5nb@4ax.com...
>> VB6: I've subclassed WM_GETMINMAXINFO to restrict form to allow only
>> vertical resizing, but I still get a double-headed resize arrow when I
>> pass the mouse across the right-hand edge of the form.
>>
>> How can I hide or suppress the resize arrow when user attempts to
>> resize horizontally?
>>
>> MM
>
>You'll want thses declarations
>
>Private Const WM_NCHITTEST As Long = &H84
>Private Const HTBOTTOM As Long = 15
>Private Const HTBOTTOMRIGHT As Long = 17
>Private Const HTBORDER As Long = 18
>Private Const HTBOTTOMLEFT As Long = 16
>Private Const HTLEFT As Long = 10
>Private Const HTRIGHT As Long = 11
>Private Const HTTOP As Long = 12
>Private Const HTTOPLEFT As Long = 13
>Private Const HTTOPRIGHT As Long = 14
>
>Add this to your routine, you'll need to replace the XXXX and xxxxxx with
>whatever you use
>This will prevent side to side cursor from showing and replace the corner
>ones with the up/down one.
>This only allows vertical resizing I'll let you work out how to allow only
>horizontal sizing
>
> Case WM_NCHITTEST
> WinMsg_XXXX = CallWindowProc(xxxxxxx), hWnd, Msg, wp, lp)
> Select Case WinMsg_XXXX
> Case HTLEFT, HTRIGHT
> WinMsg_XXXX = HTBORDER
> Case HTTOPLEFT, HTTOPRIGHT
> WinMsg_XXXX = HTTOP
> Case HTBOTTOMLEFT, HTBOTTOMRIGHT
> WinMsg_XXXX = HTBOTTOM
> End Select
>
>Have fun
>DaveO

O Mi God! (Wish I never asked... ;)

Okay, this is something for the ToDo list...

Thanks!

MM

DaveO

11/2/2011 10:06:00 AM

0

"MM" <kylix_is@yahoo.co.uk> wrote in message
news:8ae0b79pp8l1h1djrv41eqc4lqa52u5igv@4ax.com...

>> Case WM_NCHITTEST
>> WinMsg_XXXX = CallWindowProc(xxxxxxx), hWnd, Msg, wp, lp)
>> Select Case WinMsg_XXXX
>> Case HTLEFT, HTRIGHT
>> WinMsg_XXXX = HTBORDER
>> Case HTTOPLEFT, HTTOPRIGHT
>> WinMsg_XXXX = HTTOP
>> Case HTBOTTOMLEFT, HTBOTTOMRIGHT
>> WinMsg_XXXX = HTBOTTOM
>> End Select

> O Mi God! (Wish I never asked... ;)

Sure it looks a bit of a mess but it's really very simple. If the message to
the subclassed routine is HitTest (WM_NCHITTEST) then the returned value
must be one of the "HTzzzz" messages where zzzz is TOP, LEFT ect.

All this code does is block the messages for the left or right sides by
changing the value to "Border" which inhibits any change to the cursor, and
alter the messages for the corners to show the vertical size cursor instead
of the diagonal one.



I might not have made it clear that "WinMsg_XXXX" is a placeholder for
whatever name you have given your function that this code should be added
to. The other parameters in the CallWindowProc Line can be deduced form the
function declaration:

Private Function WinMsg_XXXX(ByVal hWnd As Long, ByVal Msg As Long, ByVal wp
As Long, ByVal lp As Long) As Long

Regards
DaveO


Wolfgang Enzinger

11/6/2011 10:23:00 PM

0

"DaveO" <djo@dial.pipex.com> wrote:

>Add this to your routine, you'll need to replace the XXXX and xxxxxx with
>whatever you use
>This will prevent side to side cursor from showing and replace the corner
>ones with the up/down one.
>This only allows vertical resizing I'll let you work out how to allow only
>horizontal sizing

Thanks for that code, very useful, I just integrated this into a project that
had a need for it. :-)

Wolfgang