- Home /
How to disable: Could not register the window class, win32 error 0
I create a DLL with Windows.Forms and add it to Unity pugins directory.
In this dll i open a simple Window and create Windows.Forms components ... Yes, i required these dll, and require windows forms :)
The frist time when i call the Windows.Forms.Form f = new Windows.Forms.Form(); no error, all ok i close the window and open it again i get these error message twice: Could not register the window class, win32 error 0
But the form is open and all work correctly!
What is the problem or what is the workaround?
I'm trying to use Windows Forms in Unity too, same problem here. Take a look an do a test: http://forum.unity3d.com/threads/problems-when-used-in-the-system-windows-forms-unity3-5-4.151964/
I'm running into the same issue. Has there been a solution for this? Thanks,
Answer by TwILeK · Dec 05, 2015 at 06:09 PM
I make a simple app to solve this problem (i don't know why can't by Unity Dev team ....)
So, make a small app, when search and close the error window:
[DllImport( "user32.dll" )]
public static extern IntPtr FindWindow( string lpClassName, string lpWindowName );
[DllImport( "user32.dll" )]
public static extern int SendMessage( IntPtr hWnd, uint Msg, int wParam, int lParam );
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public static void FindAndCloseWindow()
{
IntPtr lHwnd = FindWindow( null, "Oops" );
if ( lHwnd != IntPtr.Zero )
{
SendMessage( lHwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
}
}
Can you be more specific please how did you solve the problem? What I have to do with this class? Where I have to create it? Thanks :)
Answer by NKCy · Dec 16, 2019 at 07:10 AM
It just happened to me too.
I think the error occurs when you rebuild the dll on Visual Studio, and go back to Unity, and try to call the dll function before newly built dll is fully reloaded.
You can rebuild the dll, then give a Unity a time to reload it will fix the problem. If that doesn't fix the error, restart Unity.
Your answer
Follow this Question
Related Questions
Block or Override Alt-Enter Fullscreen 4 Answers
External map creator? 0 Answers
How to Launch Windows application (build by Unity) from browser 0 Answers
How can i change the title of the standalone player window? 4 Answers
Bypassing special characters 0 Answers