473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HELP: Error creating window handle

I have 30 - 40 type of different window.
For each type I need about 20 instances of the window.

When I try to create them, I get "Error creating window handle"
My guess is there is a maximum number of window handle, because if I reduce
to about 2 instances of each window,
it can run. But not 20 instances of each window.

Does anyone know what the problem is? is it really because it exceeds the
maximum number of window handle?
If it is, how do I increase this maximum number of window handles?
Is there any other way around this?

This is really critical.
Furthermore, the number of types of window and the number of instances for
each type might further increase.
Thanks.

Regards,
Altramagnus
Nov 22 '05 #1
4 6472
Windows itself has some limitations on the number of concurrent windows that
it runs well with. This was a well-known problem in earlier versions of
Windows such as Windows 95. I don't know what the situation is with newer
versions such as XP, but as a desktop system it's likely that it works best
with a reasonably small number of windows, such as the average user might
have open at any one time - you know, perhaps at most a half-dozen
applications, maybe only two or three unminimized at any one time.

The situation you're describing has something like 600 to 800 windows open
at once. I'm baffled to imagine an application that would have literally
hundreds of windows open at once. Because you're posting this in a .Net
newsgroup, I assume you're creating windows through the normal
System.Windows.Forms classes such as Form, and not coding directly to the
Windows API to create windows. Could you describe your application and the
problem that it's designed to solve, to give us an idea of what you're
trying to accomplish? Maybe once we have an idea of what you're doing, we
might have some suggestions that would help out.

Thanks,
Tom Dacon
Dacon Software Consulting
"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
I have 30 - 40 type of different window.
For each type I need about 20 instances of the window.

When I try to create them, I get "Error creating window handle"
My guess is there is a maximum number of window handle, because if I reduce to about 2 instances of each window,
it can run. But not 20 instances of each window.

Does anyone know what the problem is? is it really because it exceeds the
maximum number of window handle?
If it is, how do I increase this maximum number of window handles?
Is there any other way around this?

This is really critical.
Furthermore, the number of types of window and the number of instances for each type might further increase.
Thanks.

Regards,
Altramagnus

Nov 22 '05 #2
The OS is Windows XP Professional SP1.
Yes the software is coded in C#.

It is a real-time command and control system (client).
The PC is suppose to display thousands of moving entity, for example cars,
buses, etc.
The user can pinpoint on any entity and display all the information about
that particular entity.
Such information can be quite a lot, so each window may have up to hundreds
of controls ( text boxes, labels, buttons ).
And the user may choose to display multiple windows of such entity.
There are probably up to 30 - 40 different types of entity, so there are
30 - 40 different types of windows.
( This is a rough estimate, may be more )

I have 1 GB of RAM entirely for the software. ( The PC is only meant to run
this software ).
The idea is to create 20 instances of each type of window beforehand and
keep them hidden, and display them when necessary.
It is implementated this way rather than adhoc newing a window and then
disposing it, because time is critical.
Moreover I have 1 whole GB of RAM available for this program.
The main purpose is to use memory to overcome speed.

Regards,
Altramagnus


"Tom Dacon" <td****@community.nospam> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
Windows itself has some limitations on the number of concurrent windows that it runs well with. This was a well-known problem in earlier versions of
Windows such as Windows 95. I don't know what the situation is with newer
versions such as XP, but as a desktop system it's likely that it works best with a reasonably small number of windows, such as the average user might
have open at any one time - you know, perhaps at most a half-dozen
applications, maybe only two or three unminimized at any one time.

The situation you're describing has something like 600 to 800 windows open
at once. I'm baffled to imagine an application that would have literally
hundreds of windows open at once. Because you're posting this in a .Net
newsgroup, I assume you're creating windows through the normal
System.Windows.Forms classes such as Form, and not coding directly to the
Windows API to create windows. Could you describe your application and the
problem that it's designed to solve, to give us an idea of what you're
trying to accomplish? Maybe once we have an idea of what you're doing, we
might have some suggestions that would help out.

Thanks,
Tom Dacon
Dacon Software Consulting
"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
I have 30 - 40 type of different window.
For each type I need about 20 instances of the window.

When I try to create them, I get "Error creating window handle"
My guess is there is a maximum number of window handle, because if I

reduce
to about 2 instances of each window,
it can run. But not 20 instances of each window.

Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
If it is, how do I increase this maximum number of window handles?
Is there any other way around this?

This is really critical.
Furthermore, the number of types of window and the number of instances

for
each type might further increase.
Thanks.

Regards,
Altramagnus


Nov 22 '05 #3
A long time ago I had a similar problem to solve, although not as large as
yours. I ran into the same limitation when I tried to use controls for each
of the images I needed to display (it was a directed graph problem, and the
images were nodes in the graph). Instantiating a control for each of the
images required the Windows API to create a new window, and not only did I
run into limitations on how many controls I could create, the performance
was poor when the graphs were small enough that I could stay within the
Windows limits on the number of concurrent windows. So far this sounds
pretty much like your problem.

Instead of creating controls for each of the items, I created a set of
classes, one for each type of image, and wrote for each class the code that
enabled it to draw its own image. None of the objects required a window of
its own, and they were able to draw themselves quickly and easily on the
background of the control that displayed the graph.

Each of the classes got Location and Size properties, which the owning class
set to coordinates and dimensions in the coordinate system of the control
upon which they drew themselves. Each class had a Paint method, which took
as an input argument the Graphics object it needed to send its graphics
output to. The Paint method was called from the Paint event handler of the
control that held the graphic display of the whole network. Whenever some
interesting event happened to cause one of the nodes to need to be moved,
the owning form updated coordinates in one or more of the objects and just
invalidated the client area of the display control, causing its Paint event
to fire.

I did this in an earlier version of VB, probably VB 3.0 if I remember
correctly. It would be vastly easier to do it today in VB.Net or C# using
GDI+ calls. With today's speedy processors and high-performance graphics
processors, I'd bet that it would not be necessary to go through the
acrobatics of having each object try to erase its previous position and
redraw itself elsewhere on the canvas. With double-buffering, you could
redraw the whole works into an off-screen buffer for each update and then
switch it onto the screen in a single step. It would be simple and
light-weight and quick.

Regards,
Tom Dacon
Dacon Software Consulting

"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
The OS is Windows XP Professional SP1.
Yes the software is coded in C#.

It is a real-time command and control system (client).
The PC is suppose to display thousands of moving entity, for example cars,
buses, etc.
The user can pinpoint on any entity and display all the information about
that particular entity.
Such information can be quite a lot, so each window may have up to hundreds of controls ( text boxes, labels, buttons ).
And the user may choose to display multiple windows of such entity.
There are probably up to 30 - 40 different types of entity, so there are
30 - 40 different types of windows.
( This is a rough estimate, may be more )

I have 1 GB of RAM entirely for the software. ( The PC is only meant to run this software ).
The idea is to create 20 instances of each type of window beforehand and
keep them hidden, and display them when necessary.
It is implementated this way rather than adhoc newing a window and then
disposing it, because time is critical.
Moreover I have 1 whole GB of RAM available for this program.
The main purpose is to use memory to overcome speed.

Regards,
Altramagnus


"Tom Dacon" <td****@community.nospam> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
Windows itself has some limitations on the number of concurrent windows

that
it runs well with. This was a well-known problem in earlier versions of
Windows such as Windows 95. I don't know what the situation is with newer
versions such as XP, but as a desktop system it's likely that it works

best
with a reasonably small number of windows, such as the average user might have open at any one time - you know, perhaps at most a half-dozen
applications, maybe only two or three unminimized at any one time.

The situation you're describing has something like 600 to 800 windows open at once. I'm baffled to imagine an application that would have literally
hundreds of windows open at once. Because you're posting this in a .Net
newsgroup, I assume you're creating windows through the normal
System.Windows.Forms classes such as Form, and not coding directly to the Windows API to create windows. Could you describe your application and the problem that it's designed to solve, to give us an idea of what you're
trying to accomplish? Maybe once we have an idea of what you're doing, we might have some suggestions that would help out.

Thanks,
Tom Dacon
Dacon Software Consulting
"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
I have 30 - 40 type of different window.
For each type I need about 20 instances of the window.

When I try to create them, I get "Error creating window handle"
My guess is there is a maximum number of window handle, because if I

reduce
to about 2 instances of each window,
it can run. But not 20 instances of each window.

Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
If it is, how do I increase this maximum number of window handles?
Is there any other way around this?

This is really critical.
Furthermore, the number of types of window and the number of

instances for
each type might further increase.
Thanks.

Regards,
Altramagnus



Nov 22 '05 #4
I think you misunderstood.
For those moving entities, i did not use any controls to draw them at all.
Instead, as you said, i am using GDI+ to paint them and using double
buffering.
That whole canvas is only 1 picture box.

However, the user is able to click on any of the entity, and upon doing so,
a window has to be poped up to display information. It is this window
that has lots of controls, because it is a typical window with text boxes,
labels and buttons.

I do not think it is appropriate to draw my own window on the canvas.
Coz the windows are supposed to be normal windows, maximizable, minimizable,
closable
able to move out of the canvas.
It is this information window that I am trying to instantiate about 20 for
each entity type.
Thanks.

Regards,
Altramagnus

"Tom Dacon" <td****@community.nospam> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
A long time ago I had a similar problem to solve, although not as large as
yours. I ran into the same limitation when I tried to use controls for each of the images I needed to display (it was a directed graph problem, and the images were nodes in the graph). Instantiating a control for each of the
images required the Windows API to create a new window, and not only did I
run into limitations on how many controls I could create, the performance
was poor when the graphs were small enough that I could stay within the
Windows limits on the number of concurrent windows. So far this sounds
pretty much like your problem.

Instead of creating controls for each of the items, I created a set of
classes, one for each type of image, and wrote for each class the code that enabled it to draw its own image. None of the objects required a window of
its own, and they were able to draw themselves quickly and easily on the
background of the control that displayed the graph.

Each of the classes got Location and Size properties, which the owning class set to coordinates and dimensions in the coordinate system of the control
upon which they drew themselves. Each class had a Paint method, which took
as an input argument the Graphics object it needed to send its graphics
output to. The Paint method was called from the Paint event handler of the
control that held the graphic display of the whole network. Whenever some
interesting event happened to cause one of the nodes to need to be moved,
the owning form updated coordinates in one or more of the objects and just
invalidated the client area of the display control, causing its Paint event to fire.

I did this in an earlier version of VB, probably VB 3.0 if I remember
correctly. It would be vastly easier to do it today in VB.Net or C# using
GDI+ calls. With today's speedy processors and high-performance graphics
processors, I'd bet that it would not be necessary to go through the
acrobatics of having each object try to erase its previous position and
redraw itself elsewhere on the canvas. With double-buffering, you could
redraw the whole works into an off-screen buffer for each update and then
switch it onto the screen in a single step. It would be simple and
light-weight and quick.

Regards,
Tom Dacon
Dacon Software Consulting

"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
The OS is Windows XP Professional SP1.
Yes the software is coded in C#.

It is a real-time command and control system (client).
The PC is suppose to display thousands of moving entity, for example cars,
buses, etc.
The user can pinpoint on any entity and display all the information about that particular entity.
Such information can be quite a lot, so each window may have up to

hundreds
of controls ( text boxes, labels, buttons ).
And the user may choose to display multiple windows of such entity.
There are probably up to 30 - 40 different types of entity, so there are
30 - 40 different types of windows.
( This is a rough estimate, may be more )

I have 1 GB of RAM entirely for the software. ( The PC is only meant to

run
this software ).
The idea is to create 20 instances of each type of window beforehand and
keep them hidden, and display them when necessary.
It is implementated this way rather than adhoc newing a window and then
disposing it, because time is critical.
Moreover I have 1 whole GB of RAM available for this program.
The main purpose is to use memory to overcome speed.

Regards,
Altramagnus


"Tom Dacon" <td****@community.nospam> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
Windows itself has some limitations on the number of concurrent windows
that
it runs well with. This was a well-known problem in earlier versions
of Windows such as Windows 95. I don't know what the situation is with

newer versions such as XP, but as a desktop system it's likely that it works

best
with a reasonably small number of windows, such as the average user might have open at any one time - you know, perhaps at most a half-dozen
applications, maybe only two or three unminimized at any one time.

The situation you're describing has something like 600 to 800 windows open at once. I'm baffled to imagine an application that would have literally hundreds of windows open at once. Because you're posting this in a ..Net newsgroup, I assume you're creating windows through the normal
System.Windows.Forms classes such as Form, and not coding directly to the Windows API to create windows. Could you describe your application and the problem that it's designed to solve, to give us an idea of what you're
trying to accomplish? Maybe once we have an idea of what you're doing, we might have some suggestions that would help out.

Thanks,
Tom Dacon
Dacon Software Consulting
"Altramagnus" <al*********@hotmail.com> wrote in message
news:41********@news.starhub.net.sg...
> I have 30 - 40 type of different window.
> For each type I need about 20 instances of the window.
>
> When I try to create them, I get "Error creating window handle"
> My guess is there is a maximum number of window handle, because if I
reduce
> to about 2 instances of each window,
> it can run. But not 20 instances of each window.
>
> Does anyone know what the problem is? is it really because it
exceeds the
> maximum number of window handle?
> If it is, how do I increase this maximum number of window handles?
> Is there any other way around this?
>
> This is really critical.
> Furthermore, the number of types of window and the number of

instances for
> each type might further increase.
>
>
> Thanks.
>
> Regards,
> Altramagnus
>
>



Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
4
by: Brad Jones | last post by:
<Previously posted in microsoft.public.dotnet.framework.windowsforms> Hi all. Any suggestions here would be appreciated. Thanks for reading. I'm primarly a C++ developer but I've been trying to...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
1
by: Shawn Mehaffie | last post by:
I am creating a screen saver and am having a problem with showing the screensaver form in the preview pane. The code works correctly in the the form does display within the preview window. I...
0
by: Steve | last post by:
Some end users are getting the following message after being in the application for quite some time. Exception Type: System.ComponentModel.Win32Exception NativeErrorCode: 14 ErrorCode:...
1
by: Michael D. Reed | last post by:
I am using the help class to display a simple help file. I generated the help file using Word and saving it as a single page Web page (.mht extension). I show the help file with the following...
13
by: Challenger | last post by:
Hi I am creating a program in C++ using visual studios 2003, and for a project I am required to create a application. In this application for testing purposes I am outputing a number to show that a...
7
by: Ryan | last post by:
I'm creating a user control that has a handful of controls on it (19 in total). One of the controls on the UC is a textbox for a user's password, so I've set the PasswordChar property to "*". I...
2
by: Jonathan Boivin | last post by:
Hi people, Let me introduce to how I get this error. I have a form which load all my bills representation depending upon filters which each bill is a usercontrol of my own having some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.