Error Creating Window Handle In Vb.net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error Creating Window Handle (VB.NET) up vote 1 down vote favorite I have a fairly large application written in VB.NET which seems to be suffering from a memory leak of one kind or another. Several times per day, I have instances of this application that crash (seemingly at random, but always after being used for almost a day). I've searched and read many forums and even questions asked here on Stack Overflow about this particular problem. What I've determined is that this is related to a memory leak and usually points to either the handles exceeding 10,000 or the objects exceeding the limit. I've downloaded the memory pro filer and have used it to locate and fix several memory leaks in the program but that hasn't seemed to slow down the daily crash count. My program uses a global error catcher to log these events and store information about them in the database. I've now got about 2 months worth of data but the error message doesn't really help point me in any kind of direction. I've recently added the ability for this global error catcher to log the handles that the application has and so far it has been far below the 10,000 handle threshold. Usually it is under 1,000. Long story short, my question is this. Is there some way to log the GDI object count so I can determine if that is causing my program to crash? Are there other 'objects' that might be causing the memory leak and crash besides these two and can I log those some how? I've tried reading as much as I can and I just can't get a good grasp on this so I appreciate any direction you can give me. It seems like these types of problems plague a lot of programs. Hopefully someone can help me and this can help others in the future. A little more information about my program and environment. It mostly runs on Windows 7 64 bit machines (although some vista and XP machines are present), it is running on .NET 4.0 framework. The project consists of a few hundred forms, classes, and custom controls (built specifically for this project). I'm using .NET memory profiler 4.6 to check for memory leaks. I've run what I consider the most resource intensive op
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 23 of 23 Thread: [RESOLVED] Error creating window handle. Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Sep 19th, 2005,11:03 PM #1 bevz View Profile View Forum Posts Thread Starter Member Join Date Oct 2004 Location Cebu City Posts 37 http://stackoverflow.com/questions/27133895/error-creating-window-handle-vb-net [RESOLVED] Error creating window handle. Before my project design and output works fine. Now, when I open one of the form of my project, it displays at the Task List which states "Error creating window handle." I did to step through the code and it returns no error and functional output. My problem is I can't see one of the form at the design time. Last edited by bevz; Sep 21st, http://www.vbforums.com/showthread.php?361359-RESOLVED-Error-creating-window-handle 2005 at 07:55 PM. Thank You Reply With Quote Sep 19th, 2005,11:41 PM #2 jmcilhinney View Profile View Forum Posts Visit Homepage .NUT Join Date May 2005 Location Sydney, Australia Posts 93,519 Re: Error creating window handle. I'd say the form's resource file has become corrupted. You could try right-clicking the form in the Solution Explorer and selecting Exclude From Project, then right-clicking the project and selecting Add Existing Item to re-add the form to the project and (hopefully) regenerate the resource file. If this doesn't work, you could do the same thing again but this time delete the RESX file for the form before re-adding it. You might want to make a backup copy of the solution folder before trying this, just in case. 2007-2016 Why is my data not saved to my database? | MSDN Data Walkthroughs MSDN "How Do I?" Videos: VB | C# VBForums Database Development FAQ My CodeBank Submissions: VB | C# My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control Beginner Tutorials: VB | C# | SQL Reply With Quote Sep 20th, 2005,01:00 AM #3 bevz View Profile View Forum Posts Thread Starter Member Join Date Oct 2004 Location Cebu City Posts 37 Re: Error creating window
on for a client is used actively, users often get "Error creating window handle" exceptions. Aside from the fact that the application consumes too much resources, which is a separate issue altogether that we are already addressing, we had difficulties http://weblogs.asp.net/fmarguerie/cannot-create-window-handle-desktop-heap with determining what resources were getting exhausted as well as what the limits are for these resources.We first thought about keeping an eye on the Handles counter in the Windows Task Manager. That was because we noticed that https://www.daniweb.com/programming/software-development/threads/385400/error-creating-windows-handle some processes tended to consume more of these resources than they normally should. However, this counter is not the good one because it keeps track of resources such as files, sockets, processes and threads. These resources are named error creating Kernel Objects. The other kinds of resources that we should keep an eye on are the GDI Objects and the User Objects. You can get an overview of the three categories of resources on MSDN. User Objects Window creation issues are directly related to User Objects. We tried to determine what the limit is in terms of User Objects an application can use.There is a quota of 10,000 user handles per process. This value can be changed error creating window in the registry, however this limit was not the real show-stopper in our case. The other limit is 66,536 user handles per Windows session. This limit is theoretical. In practice, you'll notice that it can't be reached. In our case, we were getting the dreaded "Error creating window handle" exception before the total number of User Objects in the current session reached 11,000. Desktop Heap We then discovered which limit was the real culprit: it was the "Desktop Heap".By default, all the graphical applications of an interactive user session execute in what is named a "desktop". The resources allocated to such a desktop are limited (but configurable). Note: User Objects are what consumes most of the Desktop Heap's memory space. This includes windows. For more information about the Desktop Heap, you can refer to the very good articles published on the NTDebugging MSDN blog: Desktop Heap Overview Desktop Heap, part 2 Desktop Heap Monitor (dheapmon.exe) It's possible to monitor the Desktop Heap usage thanks to a command line tool: Desktop Heap Monitor (dheapmon.exe). It would be interesting to monitor this usage directly from within applications to prevent crashes. We could let users know that all the resources are about to be exhausted, and ask them to close windows and prevent them from opening new screens. This would help to avoid the "Error creating window handle" errors. When these except
for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.ComponentModel.Win32Exception: Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at System.Windows.Forms.Control.get_Handle() at Elegant.Ui.TextBoxBasedControl.TextEditorContainerWndProc(Message& m) at Elegant.Ui.TextBoxBasedControl.TextBoxContainer.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) I have attached a screen shot of the message i have got. please have a look on it. why i am getting this error? any one please help. thanks in advance Attachments jineesh 25 posts since Jun 2009 Community Member 2Contributors 4Replies 8Views 5 YearsDiscussion Span 5 Years Ago Last Post by jineesh 0 nick.crane 342 5 Years Ago Have you seen this. Are you using the latest version of Elegant.UI? Is it fully licensed? Maybe better to go to the tool providers support forum. 0 nick.crane 342 5 Years Ago If you are still having trouble with this then you need to find out where the error is coming from. If the debugger is not breaking in your code then you might benefit from trapping the first time exceptions. To do this use menu Debug/Exceptions... then check Common Language Runtime Exception to break when first thrown. Now when you debug your program it should break immediately the error occurs at the point in your code where it happens. You should now try to fix the problem by understanding what causes it, then prevent it from happening. For those occations when it is not possible to fix the problem then it is possible to trap the error using the try {} catch {} statement. Note that the first time exception trapping will still break even if you use try-catch. To test your own exception handling code you need to turn this off again. 0 Discussion Starter jineesh 5 Years Ago thank you nick. now the problem is solved. 0 Discussion Starter jineesh 5 Years Ago If you are still having trouble with this