// - Create the tray icon (if possible)
trayIcon = new STrayIconThread(*this, IDI_ICON, IDI_CONNECTED, IDR_TRAY);
// - Register for notification of configuration changes
config.setCallback(this);
if (isServiceProcess())
config.setKey(HKEY_LOCAL_MACHINE, RegConfigPath);
else
config.setKey(HKEY_CURRENT_USER, RegConfigPath);
// - Set the address-changed handler for the RFB socket
rfbSock.setAddressChangeNotifier(this);
DWORD result = 0;
try {
vlog.debug("Entering message loop");
// - Run the server until we're told to quit
MSG msg;
int result = 0;
while (runServer) {
result = sockMgr.getMessage(&msg, NULL, 0, 0);
if (result < 0)
throw rdr::SystemException("getMessage", GetLastError());
if (!isServiceProcess() && (result == 0))
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}