void LoggerWin::platformShut() { if(hWnd != NULL) { char szLog[] = "--- GOING AWAY... PRESS SPACE BAR TO CONTINUE ---"; HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); ListBox_AddString(hWndOutput, ""); ListBox_AddString(hWndOutput, szLog); int count = ListBox_GetCount(hWndOutput); ListBox_SetCaretIndex(hWndOutput, count - 1); UpdateWindow(hWndOutput); DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_PAUSE), hWnd, (DLGPROC)PauseDlgProc); ProfileWin profile; RECT rc; if(GetWindowRect(hWnd, &rc)) profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); DestroyWindow(hWnd); hWnd = NULL; } UnregisterClass(szClassName, hInst); }
static void onOptions(HWND hWnd, Logger * logger) { if(!logger) return; PROPSHEETPAGE psp[4]; psp[0].dwSize = sizeof(psp[0]); psp[0].dwFlags = PSP_DEFAULT; psp[0].hInstance = hInst; psp[0].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_GENERAL); psp[0].pszIcon = 0; psp[0].pfnDlgProc = GeneralPageProc; psp[0].pszTitle = 0; psp[0].lParam = (LPARAM)logger; psp[0].pfnCallback = NULL; psp[1].dwSize = sizeof(psp[1]); psp[1].dwFlags = PSP_DEFAULT; psp[1].hInstance = hInst; psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_LOG); psp[1].pszIcon = 0; psp[1].pfnDlgProc = LogPageProc; psp[1].pszTitle = 0; psp[1].lParam = (LPARAM)logger; psp[1].pfnCallback = NULL; psp[2].dwSize = sizeof(psp[2]); psp[2].dwFlags = PSP_DEFAULT; psp[2].hInstance = hInst; psp[2].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_FILTER); psp[2].pszIcon = 0; psp[2].pfnDlgProc = FilterPageProc; psp[2].pszTitle = 0; psp[2].lParam = (LPARAM)logger; psp[2].pfnCallback = NULL; psp[3].dwSize = sizeof(psp[3]); psp[3].dwFlags = PSP_DEFAULT; psp[3].hInstance = hInst; psp[3].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_ADVANCED); psp[3].pszIcon = 0; psp[3].pfnDlgProc = AdvancedPageProc; psp[3].pszTitle = 0; psp[3].lParam = (LPARAM)logger; psp[3].pfnCallback = NULL; PROPSHEETHEADER psh; psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; psh.hwndParent = hWnd; psh.hInstance = hInst; psh.pszIcon = 0; psh.pszCaption = "Settings"; psh.nPages = sizeof(psp) / sizeof(psp[0]); psh.nStartPage = 0; psh.ppsp = psp; psh.pfnCallback = NULL; logger->bSaveSettings = FALSE; int rv = PropertySheet(&psh); if(rv == -1) return; if(logger->bSaveSettings) { ProfileWin profile; if(hWnd != NULL) { RECT rc; if(GetWindowRect(hWnd, &rc)) profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); } profile.setBool(NPSPY_REG_KEY_ONTOP, logger->bOnTop); profile.setBool(NPSPY_REG_KEY_LOGTOWINDOW, logger->bToWindow); profile.setBool(NPSPY_REG_KEY_LOGTOCONSOLE, logger->bToConsole); profile.setBool(NPSPY_REG_KEY_LOGTOFILE, logger->bToFile); profile.setBool(NPSPY_REG_KEY_SPALID, logger->bSPALID); profile.setString(NPSPY_REG_KEY_LOGFILENAME, logger->szFile); for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) profile.setBool(ActionName[i], !logger->bMutedCalls[i]); SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); } logger->bSaveSettings = FALSE; }