Error Creating Window Handle
来源:互联网 发布:阿里巴巴串货到淘宝卖 编辑:程序博客网 时间:2024/06/06 01:57
"Error Creating Window Handle" This is one of the more aggravating errors in Windows programming. I think even worse than a VB6 favorite “Object ~ does not exist.“ I got it today when loading a form that is part of a VS2003 app I converted to VS2005. It took me a while to get to the bottom of why this error was being thrown (during debugging and also on a client machine) since it's coming from Win32, not .NET.
In my case, it turned out that the culprit had something to do with setting icons, though this wasn't obvious because I could step through even that section of code with no problems. The error was thrown after the form had run through it's load method and on it's way back to the line of code that instantiated the form. Oddly, it was method call that did not even need to be there, possibly an accidental copy/paste at some point. But it's been in the VS2003 version for a long time and has caused no problems. When I deleted the particular code (happy to have such an easy out!), everything worked again.
So, in hindsight, it all makes perfect sense. VS2005 and .NET 2.0, as I have noted in previous posts (having learned the hard way), is much more sensitive about UI threading issues. This is a GOOD thing and has helped me clean up some code that VS2003 let me get away with (more lack of understanding than anything). Icons are image files - a.k.a. unmanaged objects. So even though I wasn't getting anything helpful regarding where the problem was coming from and what the problem was exactly, the clues were all there.
”Error Creating Window Handle” is a Win32 error, therefore the first thing I should have been looking at was any code that did anything with unmanaged items. I did actually think of that early on, but overlooked that particular method call and went on a wild goose chase for a while.
So to recap, kids....
Problem: Error Creating Window Handle
First thing to look for: Anything that might be related to unmanaged code - streams, bitmaps, ink, etc.
Additional things to look for (I will keep adding to this list if you want to send me items, like JFo did!)
- “You can get this if you override the WndProc and forget to call base - my personal pet error.” (Jessica Fosler, Microsoft formerly on the WinForms team)
转自:http://thedatafarm.com/devlifeblog/archive/2006/02/22/40253.aspx
- Error Creating Window Handle
- Error Handle
- Window Handle介绍
- GNUStep:creating a window
- Handle Error in VBA
- %%%% Error Creating SessionFactory %%%%
- Error Creating SessionFactory 异常
- Error creating XML parser
- %%%% Error Creating SessionFactory %%%%
- %%%% Error Creating SessionFactory %%%%
- Error creating XML parser
- %%%% Error Creating SessionFactory %%%%
- %%%% Error Creating SessionFactory %%%%
- Creating a New Window Group
- token failed creating starting window
- error:The handle is invalid.
- ProcessID, Process Handle, Window Handle 之间的互相转换
- Program Name、Process ID、Window Handle、Process Handle 的轉換函式
- Lesson one hundred and three The French test.
- 佛学中的108条做人道理
- cognos8.2问题积累
- java JComboBox显示值与绑定至分开
- 软件测试读书笔记(二)测试的目的和任务
- Error Creating Window Handle
- oracle 常用日期计算
- PHP中$_SERVER的详细解释
- 通过HttpListener实现简单的Http服务
- 系统优化
- sqlserver2000下USER表名与系统表重名
- Java文件操作详解
- 对COM/DCOM、CORBA和Java Beans的全面比较
- sql—datediff 函数