By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,281 Members | 2,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,281 IT Pros & Developers. It's quick & easy.

window state before resize

P: n/a
Cc
hi,
is there a way to get form state before resize?
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Nak
> 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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #2

P: n/a
Cc
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).

"Nak" <a@a.com> wrote in message
news:en*************@TK2MSFTNGP11.phx.gbl...
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Nov 20 '05 #3

P: n/a
Nak
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #4

P: n/a
Cc
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.

"Nak" <a@a.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Nov 20 '05 #5

P: n/a
Nak
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/de...CMOUSEMOVE.asp

Nick.

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

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"Cc" <ko*****@singnet.com.sg> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl... thks,
"Nak" <a@a.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.