Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
System.ComponentModel.Win32Exception...error creating window handl
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

noiture777 (VIP)
GOOD ANSWER
Dear C# experts,
i face a problem which let my project get stopped ..when trying to run
...i found the following exception

"An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll
Additional information: Error creating window handle."

at this lines of my code

private void frmMdiMain_Load(object sender, System.EventArgs e)
    { string st ;
        frm.MdiParent = this;
        try

        {
        frm.Show();
        }

        catch (Exception ex)
        {
         st =(ex.Message);
         Console.Write(st);
        }
    }

/// st = error creating window handle.

could you tell me kindly what shall i do?!

Thank you in Advance
urs
Mohannad
Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Sijin Joseph
GOOD ANSWER
Where are you initializing frm?

Also make sure that your parent form has MdiContainer = True

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

noiture777 wrote:
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Mohannad (VIP)
GOOD ANSWER
the sequence of my code is like this :
private void InitializeComponent()
{ ...
this.IsMdiContainer = true; // it is
already exists
....}

Form1 frm = new Form1(); //here frm is created
    frmAlarmBox AlarmBox = new frmAlarmBox();
    TcpIpConnection TCPListen;
    bool blnAlarmState = false;

private void frmMdiMain_Load(object sender, System.EventArgs e)
    {         
        frm.MdiParent = this;        
        frm.Show();        
    }

static void Main()
    {
        Application.Run(new frmMdiMain ());
    }

/********************************************************/
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Mohannad (VIP)
GOOD ANSWER
the sequence of my code is like this :
private void InitializeComponent()
{ ...
this.IsMdiContainer = true; // it is
already exists
....}

Form1 frm = new Form1(); //here frm is created
    frmAlarmBox AlarmBox = new frmAlarmBox();
    TcpIpConnection TCPListen;
    bool blnAlarmState = false;

private void frmMdiMain_Load(object sender, System.EventArgs e)
    {         
        frm.MdiParent = this;        
        frm.Show();        
    }

static void Main()
    {
        Application.Run(new frmMdiMain ());
    }

/********************************************************/
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 
System.ComponentModel.Win32Exception
System.Console
System.EventArgs
System.Windows.Forms.Application




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734