473,418 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Error creating window handle

Hello All,

I'm haveing a problem instantiating a form. When I try to instantiate
my form and call it's ShowDialog() method, I get the following error
message:

An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll
Additional information: Error creating window handle.
Dim frm As New modMastController.frmSubClass
frm.ShowDialog()
Here's the Form Code:
__________________________________________________ ___________
Public Class frmSubClass
Inherits System.Windows.Forms.Form
Public Event UserMessage(ByVal uMsg As System.Int32, ByVal
wParam As System.Int32, ByVal lParam As System.Int32)
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

'frmMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(424, 253)
Me.Name = "frmSubClass"
Me.Text = ""
Me.ResumeLayout(False)

End Sub

#End Region

Public Const WM_APP As System.Int32 = &H8000&

#Region "Subclassing Current Form Only"
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg > WM_APP) Then
RaiseEvent UserMessage(m.Msg, m.WParam.ToInt32,
m.LParam.ToInt32)
End If
End Sub
#End Region
End Class
__________________________________________________ ________________
I have no idea what I'm doing wrong. Any ideas? Thanks!

-Joel
Nov 21 '05 #1
1 6968
Joel Whitehouse wrote:
Hello All,

I'm haveing a problem instantiating a form. When I try to instantiate
my form and call it's ShowDialog() method, I get the following error
message:

An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll
Additional information: Error creating window handle.
Dim frm As New modMastController.frmSubClass
frm.ShowDialog()
Here's the Form Code:
__________________________________________________ ___________
Public Class frmSubClass
Inherits System.Windows.Forms.Form
Public Event UserMessage(ByVal uMsg As System.Int32, ByVal
wParam As System.Int32, ByVal lParam As System.Int32)
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

'frmMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(424, 253)
Me.Name = "frmSubClass"
Me.Text = ""
Me.ResumeLayout(False)

End Sub

#End Region

Public Const WM_APP As System.Int32 = &H8000&

#Region "Subclassing Current Form Only"
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg > WM_APP) Then
RaiseEvent UserMessage(m.Msg, m.WParam.ToInt32,
m.LParam.ToInt32)
End If
End Sub
#End Region
End Class
__________________________________________________ ________________
I have no idea what I'm doing wrong. Any ideas? Thanks!

-Joel


Hey guys, I found it! The key is to add this line to the end of the
Protected Overrides Sub WndProc(ByRef m As Message) function link this:
Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg > WM_APP) Then
RaiseEvent UserMessage(m.Msg, m.WParam.ToInt32, m.LParam.ToInt32)
End If
MyBase.WndProc(m) '**************Essential line of code!
End Sub
So many people have had this problem and never posted the answer. I
hope google caches this a few times, for other people's sakes.

-Joel
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
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...
0
by: Matt Warner | last post by:
Hi guys, A couple of people have already posted questions about similar issues but haven't had any response. Occasionally, sometimes after running the app for a few hours, it bombs out saying...
4
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...
4
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...
0
by: Matt Warner | last post by:
Hi guys, A couple of people have already posted questions about similar issues but haven't had any response. Occasionally, sometimes after running the app for a few hours, it bombs out saying...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.