- Nested windows problem
- Posted by Tom Heathcote on December 17th, 2003
I have a problem with nested windows...
On a system with Windows 2000 Service Pack 4, I can only have nest
windows to a depth of 49 (counting from the desktop to the innermost
window).
If I then try to create another window inside the innermost one, the
call to CreateWindow fails (it returns a NULL window handle) and
GetLastError gives ERROR_INVALID_PARAMETER.
But on Windows 2000 SP2 or SP3 the limit appears to be 99 levels rather
than 49. Unfortunately 49 is not enough for the way our software works.
I know it is unusual for an application to want to create so many nested
windows, but this software was ported from Unix/Motif and the basic way
it works is pretty difficult to change...
When this stuff was first ported to Windows (originally on NT4, later on
2000 SP2) we never ran into this limit. But suddenly, with SP4, the
nesting limit has been halved and the software breaks...
I have tried swapping in older system DLLs from an SP2 machine (putting
them into the application directory so that my application will pick
them up before the ones in WINNT\system32) but that doesn't help. Now I
am wondering if this might be a parameter that is configurable via some
obscure registry setting.
Does anyone know of any way to increase this nesting limit? Or have any
thoughts on this problem at all?
I would be very grateful for any information... a search on Google has
turned up absolutely nothing.
--
Tom Heathcote
TomHeathcote@spamcop.net
- Posted by Tim Robinson on December 17th, 2003
"Tom Heathcote" <TomHeathcote@spamcop.net> wrote in message
news:MPG.1a4a89613c67f30a9896a9@news.gradwell.com. ..
[...]
Use Motif instead of Windows? If you need more than 49 levels of nesting
then you're either providing a very bizzare interface to your users or
you're using windows differently from what they are intended.
One way would be to use the same approach Motif does, and implement your own
widgets. That is, rely on Windows to provide the top-level window (as Motif
relies on X) but take care of the user interface within that by yourself.
That's certainly more likely to succeed than getting Microsoft to increase
the maximum window nesting level, and may be less work than revising your
design to avoid such deep nesting.
--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/
- Posted by Tom Heathcote on December 19th, 2003
In article <brq9ar$6d0tp$1@ID-103400.news.uni-berlin.de>,
tim.at.gaat.freeserve.co.uk@invalid.com says...
The latter I suspect. The software was ported from Motif, which is
probably why it is designed in this way.
I'm not quite sure why the implementor of the Windows layer chose to use
a separate window for each widget. I know that some of them (simple
things like spacers) are done without windows though, so I guess it must
be possible.
We have found some information that states that Microsoft deliberately
decreased the nested windows limit from 100 to 50 in XP (and presumably
in later versions of Win2000 too) because of the increased resources
that each window was having to keep track of. So it looks like there is
absolutely no chance of them increasing it again.
I rather suspected that our software was extremely unusual in this
respect.
--
Tom Heathcote
TomHeathcote@spamcop.net
- Posted by Tim Robinson on December 19th, 2003
"Tom Heathcote" <TomHeathcote@spamcop.net> wrote in message
news:MPG.1a4d94b1a408b89d9896aa@news.gradwell.com. ..
[...]
You've read Raymond Chen's blog too, then? 
Again, I don't know what to suggest, other than redesigning the interface or
providing a substitute for actual Windows windows. But reading the reasoning
behind the restriction in Raymond's blog (too much kernel-mode stack
overhead for deeply nested windows), it does seem like deeply nested windows
are a bit silly.
--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/