Skip to content

Commit

Permalink
Merge pull request #17 from Marocco2/master
Browse files Browse the repository at this point in the history
Resume previous process even if hotkey is not on the same previous processid window
  • Loading branch information
ryanries authored Mar 27, 2021
2 parents 063d5bb + f2c1828 commit d2c064a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,17 @@ int CALLBACK WinMain(_In_ HINSTANCE Instance, _In_opt_ HINSTANCE PreviousInstanc

if (PreviouslySuspendedProcessIsStillRunning)
{
NtResumeProcess(OpenProcess(PROCESS_ALL_ACCESS, FALSE, PreviouslySuspendedProcessID));

wchar_t MessageBoxBuffer[1024] = { 0 };

_snwprintf_s(MessageBoxBuffer, sizeof(MessageBoxBuffer), _TRUNCATE, L"You must first unpause %s (PID %d) before pausing another program.", PreviouslySuspendedProcessText, PreviouslySuspendedProcessID);
_snwprintf_s(MessageBoxBuffer, sizeof(MessageBoxBuffer), _TRUNCATE, L"Resumed %s (PID %d)", PreviouslySuspendedProcessText, PreviouslySuspendedProcessID);

PreviouslySuspendedProcessID = 0;

PreviouslySuspendedWnd = 0;

memset(PreviouslySuspendedProcessText, 0, sizeof(PreviouslySuspendedProcessText));

MessageBox(ForegroundWindow, MessageBoxBuffer, L"Universal Pause Button", MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL);
}
Expand Down

0 comments on commit d2c064a

Please sign in to comment.