Hi Ryan,
Yes, I understand your concern.
It seems that this exception is generated in NativeWindow.Cr eateHandle
method, while NativeWindow class is trying to create the TextBox control.
Below is the source code of NativeWindow.Cr eateHandle method:
public virtual void CreateHandle(Cr eateParams cp)
{
IntSecurity.Cre ateAnyWindow.De mand();
if (((cp.Style & 0x40000000) != 0x40000000) || (cp.Parent ==
IntPtr.Zero))
{
IntSecurity.Top LevelWindow.Dem and();
}
lock (this)
{
this.CheckRelea sed();
NativeWindow.Wi ndowClass class1 =
NativeWindow.Wi ndowClass.Creat e(cp.ClassName, cp.ClassStyle);
lock (NativeWindow.c reateWindowSync Object)
{
if (this.handle == IntPtr.Zero)
{
class1.targetWi ndow = this;
IntPtr ptr1 =
UnsafeNativeMet hods.GetModuleH andle(null);
IntPtr ptr2 = IntPtr.Zero;
int num1 = 0;
try
{
if ((cp.Caption != null) &&
(cp.Caption.Len gth 0x7fff))
{
cp.Caption = cp.Caption.Subs tring(0,
0x7fff);
}
ptr2 =
UnsafeNativeMet hods.CreateWind owEx(cp.ExStyle , class1.windowCl assName,
cp.Caption, cp.Style, cp.X, cp.Y, cp.Width, cp.Height, new HandleRef(cp,
cp.Parent), NativeMethods.N ullHandleRef, new HandleRef(null, ptr1),
cp.Param);
num1 = Marshal.GetLast Win32Error();
}
catch (NullReferenceE xception exception1)
{
throw new
OutOfMemoryExce ption(SR.GetStr ing("ErrorCreat ingHandle"), exception1);
}
class1.targetWi ndow = null;
if (ptr2 == IntPtr.Zero)
{
throw new Win32Exception( num1,
SR.GetString("E rrorCreatingHan dle"));
}
this.ownHandle = true;
HandleCollector .Add(ptr2,
NativeMethods.C ommonHandles.Wi ndow);
}
}
}
}
As you can see that there are 2 points where "Error creating window handle"
exception will throw. One is OutOfMemoryExce ption and another is
Win32Exception. Can you confirm if your exception is OutOfMemoryExce ption
or Win32Exception.
Normally the OutOfMemoryExce ption is caused by too many user objects are
created in the process which may hit the process limitation. You may try to
remove some controls from the designer to see if this will eliminate the
exception.
While for Win32Exception, it is caused by CreateWindowEx win32 API calling
failed. You may check Win32Exception. NativeErrorCode property to see what
exact error CreateWindowEx win32 API is meeting.
Additionally, I have tried to perform some research in our internal
database, but all the "Error creating window handle" errors I found do not
have the code path from TextBoxDesigner .get_PasswordCh ar. They are all
runtime exceptions. It seems that Microsoft did not recieve your exact
problem before.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.