Confirm exit if exiting while streaming/recording

If OBS is live/recording when the user presses the Exit, File/Exit, or
the [X] Button a message box will open asking if the user wants to exit
OBS while live/recording.

This is useful to protect against accidentally closing OBS while
streaming/recording.

CLoses jp9000/OBS#448
master
Glought 2015-07-02 20:39:21 -07:00 committed by jp9000
parent afae723a9b
commit a7f89d339e
2 changed files with 40 additions and 2 deletions

View File

@ -3593,7 +3593,25 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case ID_FILE_EXIT:
case ID_EXIT:
PostQuitMessage(0);
if (App->bRunning)
{
if (App->bRecording)
{
if (OBSMessageBox(hwnd, Str("CloseWhileActiveWarning.Message"), Str("CloseWhileActiveWarning.Title"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
PostQuitMessage(0);
}
}
else if (App->bStreaming)
{
if (OBSMessageBox(hwnd, Str("CloseWhileActiveWarning.Message"), Str("CloseWhileActiveWarning.Title"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
PostQuitMessage(0);
}
}
}
else
PostQuitMessage(0);
break;
case ID_RECORDINGSFOLDER:
@ -4503,7 +4521,25 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
break;
case WM_CLOSE:
PostQuitMessage(0);
if (App->bRunning)
{
if (App->bRecording)
{
if (OBSMessageBox(hwnd, Str("CloseWhileActiveWarning.Message"), Str("CloseWhileActiveWarning.Title"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
PostQuitMessage(0);
}
}
else if (App->bStreaming)
{
if (OBSMessageBox(hwnd, Str("CloseWhileActiveWarning.Message"), Str("CloseWhileActiveWarning.Title"), MB_ICONQUESTION | MB_YESNO) == IDYES)
{
PostQuitMessage(0);
}
}
}
else
PostQuitMessage(0);
break;
case WM_ENDSESSION:

View File

@ -552,3 +552,5 @@ Plugins.NoiseGate.AttackTime="Attack time (milliseconds):"
Plugins.NoiseGate.HoldTime="Hold time (milliseconds):"
Plugins.NoiseGate.ReleaseTime="Release time (milliseconds):"
CloseWhileActiveWarning.Title="OBS is currently active."
CloseWhileActiveWarning.Message="OBS is currently active. Do you want to stop and exit OBS?"