void CSmartServer::CreateIniSettings() { ASSERTE(GetIniSettings() == NULL); CIniSettings *pisIniSettings = new (nothrow) CIniSettings(); ASSERTE(pisIniSettings); SetIniSettings(pisIniSettings); }
void CSmartServer::DestroyIniSettings() { CIniSettings *pisIniSettings = GetIniSettings(); if (pisIniSettings) { SetIniSettings(NULL); delete pisIniSettings; } }
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND hOK, hScrl; INT iScrlPos; hScrl = GetDlgItem(hDlg, IDC_ROTORSPEED); switch (message) { case WM_INITDIALOG: hOK = GetDlgItem(hDlg, IDOK); vLoadStrings(); GetIniSettings(); bInitDlgItems(hDlg, hScrl); return TRUE; case WM_HSCROLL: iScrlPos = MIN_SPEED-wElapse; switch ((int)LOWORD(wParam)) // message from scrollbar { case SB_LINERIGHT: // determine specific movement type iScrlPos += 5; break; case SB_LINELEFT: iScrlPos -= 5; break; case SB_PAGERIGHT: iScrlPos += 20; break; case SB_PAGELEFT: iScrlPos -= 20; break; case SB_THUMBPOSITION: // grabbed thumb and moved it iScrlPos = (short int)HIWORD(wParam); break; } iScrlPos = min(MIN_SPEED,max(1,iScrlPos)); // check to see within desired range if (iScrlPos != MIN_SPEED-(int)wElapse) { wElapse = MIN_SPEED-iScrlPos; // save new position SetScrollPos((HWND)lParam, SB_CTL, iScrlPos, TRUE); // display position } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_DEFAULT: iSegLen = DEF_SEGLEN; iSegCnt = DEF_SEGCNT; iRotorCnt = DEF_ROTORCNT; iClrStart = DEF_CLRSTART; iClrInc = DEF_CLRINC; wElapse = DEF_SPEED; bInitDlgItems(hDlg, hScrl); return TRUE; case IDOK: bGetDlgItems(hDlg); SetIniSettings(); case IDCANCEL: EndDialog(hDlg, LOWORD(wParam) == IDOK); return TRUE; } } return FALSE; }
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND hScrl; int iScrlPos; hScrl = GetDlgItem(hDlg, IDC_SPEED); switch(message) { case WM_INITDIALOG: { vLoadStrings(); GetIniSettings(); bInitDlgItems(hDlg, hScrl); return TRUE; } case WM_HSCROLL: { iScrlPos = 1000-wElapse; switch ((int)LOWORD(wParam)) { case SB_LINERIGHT: // determine specific movement type iScrlPos += 10; break; case SB_LINELEFT: iScrlPos -= 10; break; case SB_PAGERIGHT: iScrlPos += 50; break; case SB_PAGELEFT: iScrlPos -= 50; break; case SB_THUMBPOSITION: // grabbed thumb and moved it iScrlPos = (short int)HIWORD(wParam); break; } iScrlPos = min(1000,max(1,iScrlPos)); // check to see within desired range if (iScrlPos != 1000-(int)wElapse) { wElapse = 1000-iScrlPos; // save new position SetScrollPos((HWND)lParam, SB_CTL, iScrlPos, TRUE); // display position } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_DEFAULTS: { wElapse = DEF_SPEEDSET; iPlanets = DEF_PLANETS; iTrails = DEF_TRAILS; iDamping = DEF_DAMPING; iColorCycle = DEF_CYCLE; bInitDlgItems(hDlg, hScrl); return TRUE; } case IDOK: { bGetDlgItems(hDlg); SetIniSettings(); } case IDCANCEL: EndDialog(hDlg,LOWORD(wParam) == IDOK); return TRUE; default: break; } } default: break; } return FALSE; }