473,903 Members | 6,000 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6545
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
"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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****@communi ty.nospam> wrote in message
news:Ou******** ******@TK2MSFTN GP12.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
"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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

"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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****@communi ty.nospam> wrote in message
news:Ou******** ******@TK2MSFTN GP12.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
"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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****@communi ty.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP10.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

"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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****@communi ty.nospam> wrote in message
news:Ou******** ******@TK2MSFTN GP12.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
"Altramagnu s" <al*********@ho tmail.com> wrote in message
news:41******** @news.starhub.n et.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
561
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 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?
12
2966
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 starting is that it has a welcome window first which gets displayed and then the real windows after a while,in other words it means that the process name is the same, but the handle I need to retrive is the one from the final window and not the...
4
1941
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 complete development on a C# application with the following basic requirements: - The app runs in the background is initially hidden from the user, including the Windows Taskbar. - The app needs to receive a registered Windows message - The app...
1
2694
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 attempting to use this class in the aspx page that calls the code, nor is the 'using System.Windows.Forms' referenced in any of the aspx pages. The first client using this software has been experiencing an error that we cannot reproduce in-house. The...
1
2675
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 created a simple for for testing called Preview that only had a label on it and the text "This is a Test" is hardcoded. By doing this I now that it is not other code I have written that is causing this. The problems I am having are: 1) The Preview...
0
1331
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: -2147467259 Message: Error creating window handle. TargetSite: Void CreateHandle(System.Windows.Forms.CreateParams) HelpLink: NULL Source: System.Windows.Forms
1
1985
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 statement. Help.ShowHelp(Parent:=Me, url:=Me.HELP_URL_PRE & Me.myWorker.HelpFile) How do I get it to go away when the program exits? Now when I quit the program that I called it form the help file is sill displayed. Is there a way to get a handle...
13
8628
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 certain key was pressed. I am getting error C2664: 'TextOutA' : cannot convert parameter 4 from 'std::string' to 'LPCSTR' As the error. My code is /* Trim fat from windows*/ #define WIN32_LEAN_AND_MEAN
7
2274
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 rebuild and all is well. The problem arises when I have the PasswordChar set, and then try to set Localizable to True for the UC. If I set Localizable to true and have PasswordChar set and rebuild, Visual Studio 2005 will then try to reload the...
2
596
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 textboxes containing bill's datas. (I already replaced the labels by painting the text instead.) When I click on my filter button, it clears the current usercontrol bills and load the new ones upon the current chosen filters. The bug happens when
0
9999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11282
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10500
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9684
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.