Re: Bizarre error--cannot create window handle by John
John
Tue Dec 16 04:01:33 CST 2003
Hi Shane,
You get an error creating a window handle when the operating system doesn't
have enough resources (i.e. memory, although some systems have a hardwired
limit) to create new windows. Controls and Forms are all windows from this
perspective.
Either you simply have heaps of windows open (lots of web browser windows
open, i.e. 50+ with lots of complex content and forms, etc can do this on my
system) and the error isn't the fault of your application, just your system.
Or perhaps you have a recursive problem, which would normally result in a
stack overflow, but since you are creating vast amounts of UI widgets you
are running out of window handles before you run out of stack space..? It
might also be possible that you simply have a very complex app, with many
repeating user controls and forms, that the system simply can not cope with.
I've noticed VS.NET seems to do some strange things with windows handles, I
can't remember the details, but I seem to remember that my debugger would
die complaining about running out of window handles and VS.NET wouldn't be
able to create window handles, but other applications in my system still
worked ok, it was as if VS.NET had created some sort of sandbox for me to
play in..
John.
"Shane Story" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:efflon0wDHA.2676@tk2msftngp13.phx.gbl...
> I am getting a very bizarre error.
>
> Says something about system memory and then
> Cannot create window handle
>
> I have a form with constructors.
> 1 is passed nothing
> (new document)
>
> 2 is passed a class having a strong dataset
> (open document)
>
> the form has a datagrid and binds to the dataset(the form has a member
> variable that gets set to the class having the dataset) The grid binds to
> this class.
>
> if from my MDI form
>
> I open a document works great.
>
> if I click new, it does soemthing like
>
> dim f as new frmMyformName
> f.mdiparent=me
>
> f.show
>
> I set a breakpoint on new statement
>
> I trace into it and it gets by the constructors and the New() contructor
> makes a new empty class and binds that empty dataset to the grid.
>
> Then on f.show I trace into it
>
> it goes to form.load
>
> it goes so far in there and then bombs out to the f.show call in the MDI
> form.
>
> Says system out of memory error or something and then
>
> Cannot create window handle.
>
> I can't seem to discover the real problem
>
> Any ideas would be appreciated.. All else works fine. This did work right
> before but I discovered I needed another class and when i made thoses
> changes it no longer works correctly. I am not sure why.
>
> Thanks,
>
> shane
>
>