Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SWP_NOZORDER - Resizing controls with the API

757 views
Skip to first unread message

Graeme Foster

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Can anyone offer any help using SWP_NOZORDER and SetWindowPos to resize a
window.

The problem I'm getting is that I can't keep the zOrder of the control I'm
resizing. It always comes to
the front of the zOrder even with the SWP_NOZORDER flag set.

Here's my statement to resize...

lpNewStyle = GetWindowLong(cpControl.hwnd, GWL_STYLE)
lpNewStyle = lpNewStyle Or WS_THICKFRAME
lpNewStyle = SetWindowLong(cpControl.hwnd, GWL_STYLE, lpNewStyle)
SetWindowPos cpControl.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE
Or SWP_NOMOVE Or SWP_DRAWFRAME

I keep track of the original style so that I can get rid of the sizable
border ...
lpReturn = SetWindowLong(cpControl.hwnd, GWL_STYLE, lpOrigStyle)
SetWindowPos cpControl.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE
Or SWP_NOMOVE Or SWP_DRAWFRAME


.. am I being blind!!! Can anybody see what I'm doing wrong?

Thanks in advance,

Graeme.


Eduardo Morcillo

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Is SWP_NOZORDER defined correctly?

Const SWP_NOZORDER = 4

--
Eduardo A. Morcillo
Create your own shell extensions with VB
Free ActiveX Controls, TypeLibs & Code
http://www.geocities.com/SiliconValley/Foothills/9940

Graeme Foster

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
Yes, the constants are all correctly defined.

I tried playing around with them and noticed that when you execute the
SetWindowPos function the control does take note of the zOrder you place it
in.. i.e., I can send it to the back, bring it to the front or keep it in
the same place.
It's when you resize the control - as soon as you let go of the mouse button
i.e. you've dragged the control to a new size, it gets brought to the front.

I can't find an event which fires when you let go of the mouse button
though. I could manually do the zOrders otherwise. The mouseup doesn't
fire on the form or on the control after resizing it.

Graeme.


Eduardo Morcillo <eda...@geocities.com.removeme> wrote in message
news:eDq3aN0C$GA....@cppssbbsa02.microsoft.com...

Farshad Hemmati

unread,
Sep 30, 1999, 3:00:00 AM9/30/99
to
I found the same problem when you send the command do move a control with
the mouse. It moves the control to the top of the ZOrder after it was moved
twice. If anyone finds the solution please notify me. The way I kind of
solved it is that I record the Zorder of all the controls (through API) and
then when everything has finished resizing and moving I reapply the Zorder
to all of them. This is not very useful especially since all of them get
rearranged for a couple second before getting restored to their original.

--
Sincerely,
Farshad Hemmati
Microsoft Visual Basic MVP
CompuCated Technologies
http://www.compucated.com/
-------------------------------------------------------
MAKE YOUR MEMORIES ELECTRONIC
Get Your Photo Album Now!
http://www.compucated.com/album/
-------------------------------------------------------


Graeme Foster <graeme...@hotmail.com> wrote in message
news:7svnuo$81s$1...@ayers.ftech.net...

Graeme Foster

unread,
Oct 1, 1999, 3:00:00 AM10/1/99
to
Haven't tried this yet, but I saw this flag

SWP_NOACTIVATE
http://msdn.microsoft.com/library/sdkdoc/winui/windows_2blf.htm

on the microsoft web site which stops the window becoming active and moving
to the top after resizing it......

0 new messages