void CLogin::OnBnClickedCheckPrelogins() { // TODO: Add your control notification handler code here // IDC_CHECK_PRELOGINS CButton *cbox = (CButton *)GetDlgItem(IDC_CHECK_PRELOGINS); int n = cbox->GetCheck(); CButton *add_button = (CButton *)GetDlgItem(IDC_LOGIN_NEW); CButton *remove_button = (CButton *)GetDlgItem(IDC_LOGIN_REMOVE); CWinApp* pApp = AfxGetApp(); if(n == 0) /* unchecked */ { m_ListBox.ShowWindow(SW_HIDE); add_button->ShowWindow(SW_HIDE); remove_button->ShowWindow(SW_HIDE); pApp->WriteProfileInt("ShowPreviousLogins", "YesNo", 0); } else { m_ListBox.ShowWindow(SW_SHOW); add_button->ShowWindow(SW_SHOW); remove_button->ShowWindow(SW_SHOW); pApp->WriteProfileInt("ShowPreviousLogins", "YesNo", 1); } }
void CChatViewerFont::saveSetting() const { CWinApp* app = AfxGetApp(); app->WriteProfileString( "Style\\Font", "name", name.c_str() ); app->WriteProfileInt( "Style\\Font", "size", size ); app->WriteProfileInt( "Style\\Font", "codepage", codepage ); app->WriteProfileInt( "Style\\Font", "characterSet", characterSet ); }
void AppSetting::saveSetting() { CWinApp* pApp = AfxGetApp(); pApp->WriteProfileInt(REGKEY_APP_NAME, REGKEY_SHOW_NAVIGATION, showNavigation? 1:0); pApp->WriteProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_TEXT, bShowHelpText? 1:0); pApp->WriteProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_AXIS, bShowAxis? 1:0); pApp->WriteProfileStringA(REGKEY_APP_NAME,REGKEY_OBJECT_PATH,objPath); pApp->WriteProfileStringA(REGKEY_APP_NAME,REGKEY_SIM_DATA_PATH,simulationDataPath); }
void CRunMap::SaveToIni(void) { CWinApp *App = AfxGetApp(); App->WriteProfileInt(pszSection, "CSG", m_iCSG); App->WriteProfileInt(pszSection, "QBSP", m_iQBSP); App->WriteProfileInt(pszSection, "Vis", m_iVis); App->WriteProfileInt(pszSection, "Light", m_iLight); App->WriteProfileInt(pszSection, "No Game", m_bNoQuake); App->WriteProfileString(pszSection, "Game Parms", m_strQuakeParms); }
void CPadView::Terminate() { CWinApp* pApp = AfxGetApp(); if (m_nDefTabStops != m_nDefTabStopsOld) pApp->WriteProfileInt(szSettings, szTabStops, m_nDefTabStops); if (m_bDefWordWrap != m_bDefWordWrapOld) pApp->WriteProfileInt(szSettings, szWordWrap, m_bDefWordWrap); WriteProfileFont(szFont, &m_lfDefFont, &m_lfDefFontOld); WriteProfileFont(szPrintFont, &m_lfDefPrintFont, &m_lfDefPrintFontOld); }
//this code from codeguru by Yonat Sharon void CStudioMainFrame::OnClose() { // Save main window position CWinApp* app = AfxGetApp(); WINDOWPLACEMENT wp; GetWindowPlacement(&wp); app->WriteProfileInt(_T("Frame"), _T("Status"), wp.showCmd); app->WriteProfileInt(_T("Frame"), _T("Top"), wp.rcNormalPosition.top); app->WriteProfileInt(_T("Frame"), _T("Left"), wp.rcNormalPosition.left); app->WriteProfileInt(_T("Frame"), _T("Bottom"), wp.rcNormalPosition.bottom); app->WriteProfileInt(_T("Frame"), _T("Right"), wp.rcNormalPosition.right); CMDIFrameWnd::OnClose(); }
bool CEsmScriptOptions::WriteToRegistry (void) { CWinApp* pApp = AfxGetApp(); bool Result; int iResult; /* Output the background color */ iResult &= pApp->WriteProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_BGCOLOR, m_BackgroundColor); iResult &= pApp->WriteProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOTOOLTIPS, (int) m_NoToolTips); /* Output the various char format and font options */ Result = WriteRegCharFormat(); Result &= WriteRegFont(); return (Result & (iResult != 0)); }
//--------------------------------------------------------------------------------------------------------------// BOOL CChildView::WriteProfileInt(LPCTSTR lpszEntry, int nValue) { BOOL bOk = FALSE; CWinApp* pApp = AfxGetApp(); if (pApp) bOk = pApp->WriteProfileInt(REG_SECTION_LOG, lpszEntry, nValue); return bOk; }
void CMainFrame::OnDestroy() { CFrameWnd::OnDestroy(); // TODO: 여기에 메시지 처리기 코드를 추가합니다. //deep01 : 레지스트리에 저장한 윈도우 크기, 위치보관 CWinApp* pApp = (CWinApp*)AfxGetApp(); CRect rect; GetWindowRect(rect); pApp->WriteProfileInt(m_Section, "left", rect.left); pApp->WriteProfileInt(m_Section, "top", rect.top); pApp->WriteProfileInt(m_Section, "right", rect.right); pApp->WriteProfileInt(m_Section, "bottom", rect.bottom); }
void CChatViewerStyle::saveSetting() const { theme.saveSetting(); font.saveSetting(); CWinApp* app = AfxGetApp(); app->WriteProfileInt( "Style", "horzBorder", horzBorder ); }
bool CEsmScriptOptions::WriteRegFont (void) { CWinApp* pApp = AfxGetApp(); LOGFONT LogFont; int iResult; /* Attempt to get the font information */ iResult = m_TextFont.GetLogFont(&LogFont); if (iResult == 0) return (false); /* Write the font options to the registry */ iResult = pApp->WriteProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTSIZE, LogFont.lfHeight); iResult &= pApp->WriteProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTBOLD, LogFont.lfWeight); iResult &= pApp->WriteProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTITALIC, LogFont.lfItalic); iResult &= pApp->WriteProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_FONTNAME, LogFont.lfFaceName); return (iResult != 0); }
void CTipDlg::OnOK() { CDialog::OnOK(); // Update the startup information stored in the INI file CWinApp* pApp = AfxGetApp(); pApp->WriteProfileInt(szSection, szIntStartup, !m_bStartup); }
static void WriteProfileFont(LPCTSTR szSec, const LOGFONT* plf, LOGFONT* plfOld) { CWinApp* pApp = AfxGetApp(); if (plf->lfHeight != plfOld->lfHeight) pApp->WriteProfileInt(szSec, szHeight, plf->lfHeight); if (plf->lfHeight != 0) { if (plf->lfHeight != plfOld->lfHeight) pApp->WriteProfileInt(szSec, szHeight, plf->lfHeight); if (plf->lfWeight != plfOld->lfWeight) pApp->WriteProfileInt(szSec, szWeight, plf->lfWeight); if (plf->lfItalic != plfOld->lfItalic) pApp->WriteProfileInt(szSec, szItalic, plf->lfItalic); if (plf->lfUnderline != plfOld->lfUnderline) pApp->WriteProfileInt(szSec, szUnderline, plf->lfUnderline); if (plf->lfPitchAndFamily != plfOld->lfPitchAndFamily) pApp->WriteProfileInt(szSec, szPitchAndFamily, plf->lfPitchAndFamily); if (plf->lfCharSet != plfOld->lfCharSet) pApp->WriteProfileInt(szSec, szCharSet, plf->lfCharSet); if (_tcscmp(plf->lfFaceName, plfOld->lfFaceName) != 0) pApp->WriteProfileString(szSec, szFaceName, (LPCTSTR)plf->lfFaceName); } *plfOld = *plf; }
//Creating a new login profile void CLogin::OnLoginNew() { CString name, host, zone, port; m_NameCombobox.GetWindowText(name); m_HostCombobox.GetWindowText(host); m_ZoneCombobox.GetWindowText(zone); m_PortCombobox.GetWindowText(port); CString new_profile_id = name + " in " + zone + " at " + host + " | " + port; CString tmp; for(int i = 0; i < m_ListBox.GetItemCount(); i++) { //tmp = m_ListBox.GetItemText(i, 0); tmp = m_prevLogins[i]; if(0 == new_profile_id.Compare(tmp)) return; //the profile already exists - do nothing } CWinApp* pApp = AfxGetApp(); char buf[256]; UINT latest = pApp->GetProfileInt("History", "Latest", 0); if(0 == latest) { //there is no history - begin a new one. //never store anything in "History\\0"! latest = 1; sprintf(buf, "History\\1"); } else { //create a new slot sprintf(buf, "History\\%d", ++latest); } //adding the new profile to the registry and incrementing latest pApp->WriteProfileInt("History", "Latest", latest); pApp->WriteProfileString(buf, "Name", name); pApp->WriteProfileString(buf, "Host", host); pApp->WriteProfileString(buf, "Zone", zone); pApp->WriteProfileString(buf, "Port", port); //add the new profile to the listbox - remember listbox is always one behind the registry! //m_ListBox.InsertItem(latest-1, new_profile_id, 0); int n = m_ListBox.InsertItem(latest-1, name); latest++; m_ListBox.SetItemText(n, 1, zone); m_ListBox.SetItemText(n, 2, host); m_ListBox.SetItemText(n, 3, port); m_prevLogins.Add(new_profile_id); }
void CXTPRecentFileList::WriteList() { ASSERT(m_arrNames != NULL); ASSERT(!m_strSectionName.IsEmpty()); ASSERT(!m_strEntryFormat.IsEmpty()); LPTSTR pszEntry = new TCHAR[max(20, m_strEntryFormat.GetLength() + 7)]; CWinApp* pApp = AfxGetApp(); pApp->WriteProfileString(m_strSectionName, NULL, NULL); for (int iMRU = 0; iMRU < m_nSize; iMRU++) { if (m_pItems[iMRU] && !m_arrNames[iMRU].IsEmpty()) { wsprintf(pszEntry, m_strEntryFormat, iMRU + 1); pApp->WriteProfileString(m_strSectionName, pszEntry, m_arrNames[iMRU]); if (m_pItems[iMRU]->IsPinned()) { wsprintf(pszEntry, _T("Pinned%d"), iMRU + 1); pApp->WriteProfileInt(m_strSectionName, pszEntry, 1); } if (!m_pItems[iMRU]->GetCaption().IsEmpty()) { wsprintf(pszEntry, _T("Caption%d"), iMRU + 1); pApp->WriteProfileString(m_strSectionName, pszEntry, m_pItems[iMRU]->GetCaption()); } if (!m_pItems[iMRU]->GetTag().IsEmpty()) { wsprintf(pszEntry, _T("Tag%d"), iMRU + 1); pApp->WriteProfileString(m_strSectionName, pszEntry, m_pItems[iMRU]->GetTag()); } if (m_pItems[iMRU]->GetIconId() != -1) { wsprintf(pszEntry, _T("IconId%d"), iMRU + 1); pApp->WriteProfileInt(m_strSectionName, pszEntry, m_pItems[iMRU]->GetIconId()); } } } delete[] pszEntry; }
int LANG_T(int l) { if (l>=0) { QLANG_T(l); CWinApp* pApp = AfxGetApp(); if (pApp) pApp->WriteProfileInt("Language","IntId",l); LANG_LOAD(NULL); } return QLANG_T(-1); // 0=default (english) }
void CPlayerBar::SaveState() { CWinApp* pApp = AfxGetApp(); CString section = _T("ToolBars\\") + m_strSettingName; __super::SaveState(section + _T("\\State")); UINT dockBarID = GetParent()->GetDlgCtrlID(); if (dockBarID == AFX_IDW_DOCKBAR_FLOAT) { CRect r; GetParent()->GetParent()->GetWindowRect(r); pApp->WriteProfileInt(section, _T("DockPosX"), r.left); pApp->WriteProfileInt(section, _T("DockPosY"), r.top); } pApp->WriteProfileInt(section, _T("DockState"), dockBarID); }
BOOL CGuiFrameWnd::PreCreateWindow(CREATESTRUCT& cs) { // Restore main window position CWinApp* pApp = AfxGetApp(); TCHAR szSection[256]; wsprintf(szSection, _T("%s-Main"), sProfile); // Restore main window position CWinApp* app = AfxGetApp(); int s, t, b, r, l; l = pApp->GetProfileInt(szSection, _T("left"),10); t = pApp->GetProfileInt(szSection, _T("top"),10); b = pApp->GetProfileInt(szSection, _T("bottom"),400); r = pApp->GetProfileInt(szSection, _T("right"),600); s = pApp->GetProfileInt(szSection, _T("status"), SW_NORMAL); GuiDrawLayer::m_Style=(int)pApp->WriteProfileInt(szSection, _T("Style"),GUISTYLE_XP); GuiDrawLayer::m_Theme=(int)pApp->WriteProfileInt(szSection, _T("Theme"),0); // only restore if there is a previously saved position // restore the window's status app->m_nCmdShow = s; // restore the window's width and height cs.cx = r - l; cs.cy = b - t; // the following correction is needed when the taskbar is // at the left or top and it is not "auto-hidden" RECT workArea; SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); l += workArea.left; t += workArea.top; // make sure the window is not completely out of sight int max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON); int max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON); cs.x = min(l, max_x); cs.y = min(t, max_y); return CFrameWnd::PreCreateWindow(cs); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTextureBrowser::WriteSettings() { // write position information CWinApp *pApp = AfxGetApp(); CString str; CRect r; GetWindowRect(r); str.Format("%d %d %d %d", r.left, r.top, r.right, r.bottom); pApp->WriteProfileString(pszIniSection, "Position", str); pApp->WriteProfileInt(pszIniSection, "ShowSize", m_cSizeList.GetCurSel()); }
BOOL CServerSettings::SaveServerToRegistry(const char* ctx) { // Save Class Members To Registry //int k; //char szKey[32]; char szValue[256]; CWinApp* pApp = AfxGetApp(); ::CM_MixString(m_szPassword, szValue, 132); TRACE("PASSWORD WRITE: from '%s' TO '%s'\n", m_szPassword, szValue); pApp->WriteProfileInt (ctx,"NNTP_Port", m_nServerPort); pApp->WriteProfileString(ctx,"Server", m_szServerName); pApp->WriteProfileInt (ctx,"Connections", m_nConnections); pApp->WriteProfileInt (ctx,"Login", m_bRequireLogin); pApp->WriteProfileString(ctx,"User", m_szUsername); pApp->WriteProfileString(ctx,"Pass", szValue); return TRUE; }
void CSizingControlBar::SaveState(LPCTSTR lpszProfileName) { // place your SaveState or GlobalSaveState call in // CMainFrame::DestroyWindow(), not in OnDestroy() ASSERT_VALID(this); ASSERT(GetSafeHwnd()); CWinApp* pApp = AfxGetApp(); TCHAR szSection[256]; wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName, GetDlgCtrlID()); pApp->WriteProfileInt(szSection, _T("sizeHorzCX"), m_szHorz.cx); pApp->WriteProfileInt(szSection, _T("sizeHorzCY"), m_szHorz.cy); pApp->WriteProfileInt(szSection, _T("sizeVertCX"), m_szVert.cx); pApp->WriteProfileInt(szSection, _T("sizeVertCY"), m_szVert.cy); pApp->WriteProfileInt(szSection, _T("sizeFloatCX"), m_szFloat.cx); pApp->WriteProfileInt(szSection, _T("sizeFloatCY"), m_szFloat.cy); }
void CFileClipboardDlg::OnDestroy() { CSizeDialog::OnDestroy(); int nIndex; CString szText; CString szEntry; CWinApp *pApp; pApp = AfxGetApp(); if (pApp) { pApp->WriteProfileInt(DCOM_FILECLIPBOARD_SECTION, DCOM_FILECLIPBOARD_ITEM_CNT, m_cFileClipboardList.GetItemCount() - 1); for (nIndex = 0; nIndex < m_cFileClipboardList.GetItemCount() - 1; nIndex++) { szText = m_cFileClipboardList.GetItemText(nIndex, 0); szEntry.Format(DCOM_FILECLIPBOARD_ITEM, nIndex); pApp->WriteProfileString(DCOM_FILECLIPBOARD_SECTION, szEntry, szText); } pApp->WriteProfileInt(DCOM_FILECLIPBOARD_SECTION, DCOM_FILECLIPBOARD_NEWLINE, m_btNewLine.GetCheck()); } }
////////////////// // Write window placement to app profile void CWindowPlacement::WriteProfileWP(LPCTSTR lpKeyName) { CWinApp *pApp = AfxGetApp(); ASSERT_VALID(pApp); pApp->WriteProfileInt(lpKeyName, _T("wp.showCmd"), showCmd); pApp->WriteProfileInt(lpKeyName, _T("wp.flags"), flags); pApp->WriteProfileInt(lpKeyName, _T("wp.ptMinPosition.x"), ptMinPosition.x); pApp->WriteProfileInt(lpKeyName, _T("wp.ptMinPosition.y"), ptMinPosition.y); pApp->WriteProfileInt(lpKeyName, _T("wp.ptMaxPosition.x"), ptMaxPosition.x); pApp->WriteProfileInt(lpKeyName, _T("wp.ptMaxPosition.y"), ptMaxPosition.y); pApp->WriteProfileInt(lpKeyName, _T("wp.left"), rcNormalPosition.left); pApp->WriteProfileInt(lpKeyName, _T("wp.right"), rcNormalPosition.right); pApp->WriteProfileInt(lpKeyName, _T("wp.top"), rcNormalPosition.top); pApp->WriteProfileInt(lpKeyName, _T("wp.bottom"),rcNormalPosition.bottom); }
void TestRunnerModel::saveSettings( const Settings & s ) { CWinApp *app = AfxGetApp(); ASSERT( app != NULL ); int autorun = s.autorunOnLaunch ? 1 : 0; app->WriteProfileInt( _T("CppUnit"), _T("AutorunAtStartup"), autorun ); app->WriteProfileInt( _T("CppUnit"), _T("Col_1"), s.col_1 ); app->WriteProfileInt( _T("CppUnit"), _T("Col_2"), s.col_2 ); app->WriteProfileInt( _T("CppUnit"), _T("Col_3"), s.col_3 ); app->WriteProfileInt( _T("CppUnit"), _T("Col_4"), s.col_4 ); int idx = 1; for ( History::const_iterator it = m_history.begin(); it != m_history.end(); ++it , ++idx ) { CPPUNIT_NS::Test *test = *it; saveHistoryEntry( idx, test->getName().c_str() ); } }
CTipDlg::~CTipDlg() { // This destructor is executed whether the user had pressed the escape key // or clicked on the close button. If the user had pressed the escape key, // it is still required to update the filepos in the ini file with the // latest position so that we don't repeat the tips! // But make sure the tips file existed in the first place.... if (m_pStream != NULL) { CWinApp* pApp = AfxGetApp(); pApp->WriteProfileInt(szSection, szIntFilePos, ftell(m_pStream)); fclose(m_pStream); } }
bool cdxCDynamicWndEx::StoreWindowPosition(LPCTSTR lpszProfile) { if(!IsWindow() || !lpszProfile || !*lpszProfile) { ASSERT(false); return false; } CWnd *pWnd = Window(); WINDOWPLACEMENT wpl; VERIFY( pWnd->GetWindowPlacement(&wpl) ); CRect windowRect; pWnd->GetWindowRect(&windowRect); BOOL bVisible = pWnd->IsWindowVisible(); int iState = REGVAL_NOSTATE; if(pWnd->IsIconic()) iState = REGVAL_ICONIC; else if(pWnd->IsZoomed()) iState = REGVAL_MAXIMIZED; CWinApp *app = AfxGetApp(); if(!app->m_pszRegistryKey || !*app->m_pszRegistryKey) { TRACE(_T("*** NOTE[cdxCDynamicWndEx::StoreWindowPosition()]: To properly store and restore a window's position, please call CWinApp::SetRegistryKey() in you app's InitInstance() !\n")); return false; } return app->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_INVALID) && // invalidate first app->WriteProfileInt(lpszProfile, lpszRegVal_Left, windowRect.left) && app->WriteProfileInt(lpszProfile, lpszRegVal_Right, windowRect.right) && app->WriteProfileInt(lpszProfile, lpszRegVal_Top, windowRect.top) && app->WriteProfileInt(lpszProfile, lpszRegVal_Bottom, windowRect.bottom) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Left, wpl.rcNormalPosition.left) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Right, wpl.rcNormalPosition.right) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Top, wpl.rcNormalPosition.top) && // app->WriteProfileInt(lpszProfile, lpszRegVal_Bottom, wpl.rcNormalPosition.bottom) && app->WriteProfileInt(lpszProfile, lpszRegVal_Visible, bVisible ? REGVAL_VISIBLE : REGVAL_HIDDEN) && app->WriteProfileInt(lpszProfile, lpszRegVal_State, iState) && app->WriteProfileInt(lpszProfile, lpszRegVal_Valid, REGVAL_VALID); // validate position }
void CLeashDebugWindow::OnCancel() { if (m_pView != NULL) { CWinApp* pApp; pApp = AfxGetApp(); pApp->WriteProfileInt("Settings", "DebugWindow", FALSE_FLAG); m_pView->PostMessage(WM_GOODBYE, IDCANCEL); // modeless case //// pset_krb_debug(OFF); //// pset_krb_ap_req_debug(OFF); } else { CDialog::OnCancel(); // modal case } }
void CLeashProperties::OnOK() { CString timeServer_; GetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer_); if (getenv(TIMEHOST)) { // Check system for TIMEHOST, just in case it gets set (somehow) MessageBox("Can't change the time host unless you remove it from the environment!", "Error", MB_OK); return; } if( getenv("USEKRB4") != NULL) { MessageBox("Kerberos 4 ticket requests are being controlled by the environment" "variable USEKRB4 instead of the registry. Leash cannot modify" "the environment. Use the System control panel instead.", "Leash", MB_OK); return; } if (SetRegistryVariable(TIMEHOST, timeServer_)) { MessageBox("There was an error putting your entry into the Registry!", "Error", MB_OK); } if ( m_initMissingFiles != m_newMissingFiles ) { CWinApp * pApp = AfxGetApp(); if (pApp) pApp->WriteProfileInt("Settings", "CreateMissingConfig", m_newMissingFiles ? TRUE_FLAG : FALSE_FLAG); if ( m_newMissingFiles ) CLeashApp::ValidateConfigFiles(); } if ( dw_initMslsaImport != dw_newMslsaImport ) { pLeash_set_default_mslsa_import(dw_newMslsaImport); } CDialog::OnOK(); }
//----------------------------- FUNCTION -------------------------------------* void CWindowPlacement::WriteProfileWP(LPCTSTR pszKeyName) /*>>>> Write window placement to app profile Result void <<<<*/ { CWinApp *pApp = AfxGetApp(); ASSERT_VALID(pApp); pApp->WriteProfileInt(pszKeyName, WP_SHOW_CMD, showCmd); pApp->WriteProfileInt(pszKeyName, WP_FLAGS, flags); pApp->WriteProfileInt(pszKeyName, WP_MIN_POS_X, ptMinPosition.x); pApp->WriteProfileInt(pszKeyName, WP_MIN_POS_Y, ptMinPosition.y); pApp->WriteProfileInt(pszKeyName, WP_MAX_POS_X, ptMaxPosition.x); pApp->WriteProfileInt(pszKeyName, WP_MAX_POS_Y, ptMaxPosition.y); pApp->WriteProfileInt(pszKeyName, WP_LEFT, rcNormalPosition.left); pApp->WriteProfileInt(pszKeyName, WP_RIGHT, rcNormalPosition.right); pApp->WriteProfileInt(pszKeyName, WP_TOP, rcNormalPosition.top); pApp->WriteProfileInt(pszKeyName, WP_BOTTOM, rcNormalPosition.bottom); }
void CSTWSelectTmplPage::OnButtonDelete() { if (AfxMessageBox (IDS_CONFIRM_DELETETEMPLATE, MB_ICONQUESTION | MB_YESNO) == IDYES) { CString strTemplate; m_Combo.GetWindowText (strTemplate); if (strTemplate.IsEmpty ()) return; // get the number of templates CWinApp* pApp = AfxGetApp (); int nCount = pApp->GetProfileInt ("Templates", "Count", 0); CString s, strName; bool bMove = false; // delete from the list for (int i = 1; i <= nCount; i++) { if (bMove) { s.Format ("%d", i); strName = pApp->GetProfileString ("Templates", s); s.Format ("%d", i - 1); pApp->WriteProfileString ("Templates", s, strName); } s.Format ("%d", i); if (pApp->GetProfileString ("Templates", s) == strTemplate) bMove = true; } pApp->WriteProfileInt ("Templates", "Count", nCount - 1); // delete the template's settings DWORD dwRet = SHDeleteKey (HKEY_CURRENT_USER, "Software\\CdCoverCreator\\Templates\\" + strTemplate); // remove from the combo box m_Combo.DeleteString (m_Combo.FindStringExact (-1, strTemplate)); } }