private static void RegisterClassOnce() { if (!class_registered) { ExtendedWindowClass wc = new ExtendedWindowClass(); wc.Size = ExtendedWindowClass.SizeInBytes; wc.Style = DefaultClassStyle; wc.Instance = Instance; wc.WndProc = WindowProcedure; wc.ClassName = ClassName; wc.Icon = IntPtr.Zero; wc.IconSm = IntPtr.Zero; wc.Cursor = LoadCursor(IntPtr.Zero, (IntPtr)CursorName.Arrow); ushort atom = RegisterClassEx(ref wc); if (atom == 0) throw new Exception(String.Format("Failed to register window class. Error: {0}", Marshal.GetLastWin32Error())); class_registered = true; } }
internal static extern ushort RegisterClassEx(ref ExtendedWindowClass window_class);