/// <summary> /// Processes a WndProc message sent from other instances of SteelQuiz. This method may only be called ONCE per message! /// </summary> /// <param name="m">The message sent.</param> /// <param name="form">The form that received the message.</param> public static void ProcessWndProcMessage(ref Message m, Form form) { if (m.Msg == NativeMethods.WM_SHOW_ME) { ShowMe(form); } else if (m.Msg == NativeMethods.WM_LOAD_QUIZ) { if (frmQuizPractise != null) { frmQuizPractise.Close(); frmDashboard.Show(); } else if (QuizEditorsOpen > 0) { ShowMe(openQuizEditors.Last()); MessageBox.Show("Please close all quiz editors first to load the quiz.", "SteelQuiz", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } object quizPath = null; using (var key = Registry.CurrentUser.OpenSubKey(@"Software\SteelQuiz\Communication", true)) { if (key == null) { throw new Exception("WM_LOAD_QUIZ message received but HKCU\\Software\\SteelQuiz\\Communication does not exist"); } quizPath = key.GetValue("QuizToLoadPath", null); if (quizPath == null) { throw new Exception("WM_LOAD_QUIZ message received but QuizToLoadPath value does not exist"); } key.DeleteValue("QuizToLoadPath"); } frmDashboard.LoadedQuiz = QuizCore.LoadQuiz((string)quizPath); frmDashboard.UpdateQuizOverview(); ShowMe(frmDashboard); } }