Added Ctrl-C handling for issue 479

This commit is contained in:
Nick Bolton 2010-06-01 22:22:58 +00:00
parent 60a428443e
commit 7842596748
8 changed files with 36 additions and 1 deletions

View file

@ -21,6 +21,7 @@
#include "LogOutputters.h"
#include "CMSWindowsScreen.h"
#include "XSynergy.h"
#include "IArchTaskBarReceiver.h"
#include <sstream>
#include <iostream>
@ -29,12 +30,27 @@
CArchAppUtilWindows::CArchAppUtilWindows() :
m_exitMode(kExitModeNormal)
{
if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)consoleHandler, TRUE) == FALSE)
{
throw XArchEvalWindows();
}
}
CArchAppUtilWindows::~CArchAppUtilWindows()
{
}
BOOL WINAPI CArchAppUtilWindows::consoleHandler(DWORD CEvent)
{
// HACK: it would be nice to delete the s_taskBarReceiver object, but
// this is best done by the CApp destructor; however i don't feel like
// opening up that can of worms today... i need sleep.
instance().app().s_taskBarReceiver->cleanup();
ExitProcess(kExitTerminated);
return TRUE;
}
bool
CArchAppUtilWindows::parseArg(const int& argc, const char* const* argv, int& i)
{