window state before resize

  • Thread starter Thread starter Cc
  • Start date Start date
is there a way to get form state before resize?

What do you mean exactly? You could trap the windows and intercept the
resizing message to actually find out what "state" the window is in before
it actually get resized.

Const WM_SIZE = &H5

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Call MyBase.WndProc(m)
Select Case m.Msg
Case WM_SIZE
Me.Text = Me.WindowState.ToString
End Select
End Sub

Is this what you wanted?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
yes , I would like to get window state befor it either minimize or maximize.
I try your code but not working, it always show state after window
resize(even I change by call mybase.winproc at bottom).

I writting a program that when window minimize it will minimize to tray by
using notify icon , when user left click on the notify Icon I suppose to
restore the window state. I had try by using
Me.WindowState = FormWindowState.Normal

this work fine until I found there a bug on it. if window state before
minimize is Normal this code work fine, but if window state maximize it
still work find until after that you click the window to normal. the window
isn't going to normal state but showing window bar only(like those in
linux).
 
Hi,

You have the wrong idea, what you are supposed to do is only process
the messages that you actually want. i.e.

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_SIZE
if (windowstate = whatever) then Call MyBase.WndProc(m)
case Else
Call MyBase.WndProc(m)
End Select
End Sub

This will cause the form ONLY to be resized when the form is in
"whatever" state :-) But it will also cause ALL other messages to be
processed normally.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
thks,
I use msg = 160 due to this is the number that been throw when mouse move
near to minmize or maximize button , tell me if Iam wrong.
 
Hi there,
I use msg = 160 due to this is the number that been throw when mouse move
near to minmize or maximize button , tell me if Iam wrong.

160 appears to be the following....

http://msdn.microsoft.com/library/d...ference/MouseInputMessages/WM_NCMOUSEMOVE.asp

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
Back
Top