OptionsGeneral.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. // OptionsGeneral.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "OptionsGeneral.h"
  6. #include "InternetUpdate.h"
  7. #include <io.h>
  8. #include <Mmsystem.h> //play sound
  9. #include "Path.h"
  10. #include "AdvGeneral.h"
  11. #include "DimWnd.h"
  12. #include "HyperLink.h"
  13. using namespace nsPath;
  14. #define DEFAULT_THEME _T("(Default)")
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // COptionsGeneral property page
  22. IMPLEMENT_DYNCREATE(COptionsGeneral, CPropertyPage)
  23. COptionsGeneral::COptionsGeneral() : CPropertyPage(COptionsGeneral::IDD)
  24. {
  25. m_csTitle = theApp.m_Language.GetString("GeneralTitle", "General");
  26. m_psp.pszTitle = m_csTitle;
  27. m_psp.dwFlags |= PSP_USETITLE;
  28. memset(&m_LogFont, 0, sizeof(LOGFONT));
  29. //{{AFX_DATA_INIT(COptionsGeneral)
  30. //}}AFX_DATA_INIT
  31. }
  32. COptionsGeneral::~COptionsGeneral()
  33. {
  34. }
  35. void COptionsGeneral::DoDataExchange(CDataExchange* pDX)
  36. {
  37. CPropertyPage::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(COptionsGeneral)
  39. //DDX_Control(pDX, IDC_ENSURE, m_EnsureConnected);
  40. // DDX_Control(pDX, IDC_EDIT_SAVE_DELAY, m_SaveDelay);
  41. DDX_Control(pDX, IDC_COMBO_LANGUAGE, m_cbLanguage);
  42. DDX_Control(pDX, IDC_PATH, m_ePath);
  43. DDX_Control(pDX, IDC_EXPIRE_AFTER, m_eExpireAfter);
  44. DDX_Control(pDX, IDC_MAX_SAVED_COPIES, m_eMaxSavedCopies);
  45. DDX_Control(pDX, IDC_EXPIRE, m_btExpire);
  46. DDX_Control(pDX, IDC_START_ON_STARTUP, m_btRunOnStartup);
  47. DDX_Control(pDX, IDC_EDIT_APP_COPY_INCLUDE, m_copyAppInclude);
  48. DDX_Control(pDX, IDC_EDIT_APP_COPY_EXCLUDE, m_copyAppExclude);
  49. DDX_Control(pDX, IDC_MAXIMUM, m_btMaximumCheck);
  50. //}}AFX_DATA_MAP
  51. DDX_Control(pDX, IDC_COMBO_THEME, m_cbTheme);
  52. DDX_Control(pDX, IDC_BUTTON_FONT, m_btFont);
  53. DDX_Control(pDX, IDC_BUTTON_DEFAULT_FAULT, m_btDefaultButton);
  54. DDX_Control(pDX, IDC_COMBO_POPUP_POSITION, m_popupPositionCombo);
  55. DDX_Control(pDX, IDC_MFCLINK_ENV_VAR, m_envVarLink);
  56. }
  57. BEGIN_MESSAGE_MAP(COptionsGeneral, CPropertyPage)
  58. //{{AFX_MSG_MAP(COptionsGeneral)
  59. ON_BN_CLICKED(IDC_GET_PATH, OnGetPath)
  60. ON_BN_CLICKED(IDC_BUTTON_ABOUT, OnButtonAbout)
  61. //}}AFX_MSG_MAP
  62. ON_BN_CLICKED(IDC_BUTTON_ADVANCED, &COptionsGeneral::OnBnClickedButtonAdvanced)
  63. ON_WM_CTLCOLOR()
  64. ON_BN_CLICKED(IDC_BUTTON_THEME, &COptionsGeneral::OnBnClickedButtonTheme)
  65. ON_BN_CLICKED(IDC_BUTTON_DEFAULT_FAULT, &COptionsGeneral::OnBnClickedButtonDefaultFault)
  66. ON_BN_CLICKED(IDC_BUTTON_FONT, &COptionsGeneral::OnBnClickedButtonFont)
  67. ON_EN_CHANGE(IDC_PATH, &COptionsGeneral::OnEnChangePath)
  68. END_MESSAGE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // COptionsGeneral message handlers
  71. BOOL COptionsGeneral::OnInitDialog()
  72. {
  73. CPropertyPage::OnInitDialog();
  74. CString url = _T("https://sourceforge.net/p/ditto-cp/wiki/EnvironmentVariables/");
  75. /*m_envVarLink.SetURL(_T("\"") + url);
  76. m_envVarLink.SetFontSize(-9);*/
  77. m_brush.CreateSolidBrush(RGB(251, 251, 251));
  78. m_pParent = (COptionsSheet *)GetParent();
  79. #ifndef _DEBUG
  80. if (CGetSetOptions::GetIsWindowsApp())
  81. {
  82. m_btRunOnStartup.SetCheck(BST_CHECKED);
  83. GetDlgItem(IDC_START_ON_STARTUP)->EnableWindow(FALSE);
  84. }
  85. else
  86. {
  87. m_btRunOnStartup.SetCheck(CGetSetOptions::GetRunOnStartUp());
  88. }
  89. #endif
  90. m_btMaximumCheck.SetCheck(CGetSetOptions::GetCheckForMaxEntries());
  91. m_btExpire.SetCheck(CGetSetOptions::GetCheckForExpiredEntries());
  92. m_eExpireAfter.SetNumber(CGetSetOptions::GetExpiredEntries());
  93. m_eMaxSavedCopies.SetNumber(CGetSetOptions::GetMaxEntries());
  94. m_copyAppInclude.SetWindowText(g_Opt.GetCopyAppInclude());
  95. m_copyAppExclude.SetWindowText(g_Opt.GetCopyAppExclude());
  96. CString csPath = CGetSetOptions::GetDBPath(false);
  97. m_ePath.SetWindowText(csPath);
  98. if (CGetSetOptions::GetFont(m_LogFont))
  99. {
  100. m_Font.CreateFontIndirect(&m_LogFont);
  101. m_btFont.SetFont(&m_Font);
  102. }
  103. else
  104. {
  105. CFont *ft = m_btFont.GetFont();
  106. ft->GetLogFont(&m_LogFont);
  107. }
  108. CString cs;
  109. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  110. m_btFont.SetWindowText(cs);
  111. FillThemes();
  112. FillLanguages();
  113. int caretPos = m_popupPositionCombo.AddString(_T("At Caret"));
  114. m_popupPositionCombo.SetItemData(caretPos, POS_AT_CARET);
  115. int cursorPos = m_popupPositionCombo.AddString(_T("At Cursor"));
  116. m_popupPositionCombo.SetItemData(cursorPos, POS_AT_CURSOR);
  117. int prevPos = m_popupPositionCombo.AddString(_T("At Previous Position"));
  118. m_popupPositionCombo.SetItemData(prevPos, POS_AT_PREVIOUS);
  119. switch (CGetSetOptions::GetQuickPastePosition())
  120. {
  121. case POS_AT_CARET:
  122. m_popupPositionCombo.SetCurSel(caretPos);
  123. break;
  124. case POS_AT_CURSOR:
  125. m_popupPositionCombo.SetCurSel(cursorPos);
  126. break;
  127. case POS_AT_PREVIOUS:
  128. m_popupPositionCombo.SetCurSel(prevPos);
  129. break;
  130. default:
  131. m_popupPositionCombo.SetCurSel(cursorPos);
  132. }
  133. UpdateData(FALSE);
  134. theApp.m_Language.UpdateOptionGeneral(this);
  135. OnEnChangePath();
  136. return TRUE;
  137. }
  138. #define NO_MATCH -2
  139. #define FOUND_MATCH -1
  140. void COptionsGeneral::FillLanguages()
  141. {
  142. CString csFile = CGetSetOptions::GetPath(PATH_LANGUAGE);
  143. csFile += "*.xml";
  144. CString csLanguage = CGetSetOptions::GetLanguageFile();
  145. CFileFind find;
  146. BOOL bCont = find.FindFile(csFile);
  147. int nEnglishIndex = NO_MATCH;
  148. while(bCont)
  149. {
  150. bCont = find.FindNextFile();
  151. int nIndex = m_cbLanguage.AddString(find.GetFileTitle());
  152. if(find.GetFileTitle() == csLanguage)
  153. {
  154. nEnglishIndex = -1;
  155. m_cbLanguage.SetCurSel(nIndex);
  156. }
  157. else if(find.GetFileTitle() == _T("English"))
  158. {
  159. if(nEnglishIndex == NO_MATCH)
  160. nEnglishIndex = nIndex;
  161. }
  162. }
  163. if(nEnglishIndex >= 0)
  164. {
  165. m_cbLanguage.SetCurSel(nEnglishIndex);
  166. }
  167. }
  168. BOOL COptionsGeneral::OnApply()
  169. {
  170. UpdateData();
  171. #ifndef _DEBUG
  172. if (CGetSetOptions::GetIsWindowsApp() == FALSE)
  173. {
  174. CGetSetOptions::SetRunOnStartUp(m_btRunOnStartup.GetCheck());
  175. }
  176. #endif
  177. CGetSetOptions::SetCheckForMaxEntries(m_btMaximumCheck.GetCheck());
  178. CGetSetOptions::SetCheckForExpiredEntries(m_btExpire.GetCheck());
  179. CGetSetOptions::SetMaxEntries(m_eMaxSavedCopies.GetNumber());
  180. CGetSetOptions::SetExpiredEntries(m_eExpireAfter.GetNumber());
  181. CString stringVal;
  182. m_copyAppInclude.GetWindowText(stringVal);
  183. g_Opt.SetCopyAppInclude(stringVal);
  184. m_copyAppExclude.GetWindowText(stringVal);
  185. g_Opt.SetCopyAppExclude(stringVal);
  186. CString csLanguage;
  187. if(m_cbLanguage.GetCurSel() >= 0)
  188. {
  189. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  190. g_Opt.SetLanguageFile(csLanguage);
  191. }
  192. if(csLanguage.IsEmpty() == FALSE)
  193. {
  194. if(!theApp.m_Language.LoadLanguageFile(csLanguage))
  195. {
  196. CString cs;
  197. cs.Format(_T("Error loading language file - %s - \n\n%s"), csLanguage, theApp.m_Language.m_csLastError);
  198. MessageBox(cs, _T("Ditto"), MB_OK);
  199. }
  200. }
  201. CString toSavePath;
  202. m_ePath.GetWindowText(toSavePath);
  203. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  204. bool bOpenNewDatabase = false;
  205. if(resolvedPath.IsEmpty() == FALSE)
  206. {
  207. if(FileExists(resolvedPath) == FALSE)
  208. {
  209. CString cs;
  210. cs.Format(_T("The database %s does not exist.\n\nCreate a new database?"), resolvedPath);
  211. if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDYES)
  212. {
  213. // -- create a new one
  214. if(CreateDB(resolvedPath))
  215. {
  216. bOpenNewDatabase = true;
  217. }
  218. else
  219. MessageBox(_T("Error Creating Database"));
  220. }
  221. else
  222. return FALSE;
  223. }
  224. else
  225. {
  226. if(ValidDB(resolvedPath) == FALSE)
  227. {
  228. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  229. m_ePath.SetFocus();
  230. return FALSE;
  231. }
  232. else
  233. {
  234. bOpenNewDatabase = true;
  235. }
  236. }
  237. if(bOpenNewDatabase)
  238. {
  239. CGetSetOptions::SetDBPath(toSavePath);
  240. if(OpenDatabase(resolvedPath) == FALSE)
  241. {
  242. MessageBox(_T("Error Opening new database"), _T("Ditto"), MB_OK);
  243. m_ePath.SetFocus();
  244. return FALSE;
  245. }
  246. else
  247. {
  248. theApp.RefreshView();
  249. }
  250. }
  251. }
  252. CGetSetOptions::SetQuickPastePosition(m_popupPositionCombo.GetItemData(m_popupPositionCombo.GetCurSel()));
  253. if (m_LogFont.lfWeight != 0)
  254. {
  255. CGetSetOptions::SetFont(m_LogFont);
  256. }
  257. CString currentTheme = g_Opt.GetTheme();
  258. CString csTheme;
  259. if (m_cbTheme.GetCurSel() >= 0)
  260. {
  261. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  262. if (csTheme == DEFAULT_THEME)
  263. {
  264. g_Opt.SetTheme("");
  265. csTheme = _T("");
  266. }
  267. else
  268. g_Opt.SetTheme(csTheme);
  269. }
  270. else
  271. {
  272. g_Opt.SetTheme("");
  273. }
  274. if (currentTheme != csTheme)
  275. {
  276. m_pParent->m_themeChanged = TRUE;
  277. }
  278. return CPropertyPage::OnApply();
  279. }
  280. BOOL COptionsGeneral::OnSetActive()
  281. {
  282. return CPropertyPage::OnSetActive();
  283. }
  284. //void COptionsGeneral::OnSetDbPath()
  285. //{
  286. // if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
  287. // {
  288. // m_ePath.EnableWindow(TRUE);
  289. // m_btGetPath.EnableWindow(TRUE);
  290. // }
  291. // else
  292. // {
  293. // m_ePath.EnableWindow(FALSE);
  294. // m_btGetPath.EnableWindow(FALSE);
  295. // }
  296. //}
  297. void COptionsGeneral::OnGetPath()
  298. {
  299. OPENFILENAME FileName;
  300. TCHAR szFileName[400];
  301. TCHAR szDir[400];
  302. memset(&FileName, 0, sizeof(FileName));
  303. memset(szFileName, 0, sizeof(szFileName));
  304. memset(&szDir, 0, sizeof(szDir));
  305. FileName.lStructSize = sizeof(FileName);
  306. FileName.lpstrTitle = _T("Open Database");
  307. FileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
  308. FileName.nMaxFile = 400;
  309. FileName.lpstrFile = szFileName;
  310. FileName.lpstrInitialDir = szDir;
  311. FileName.lpstrFilter = _T("Ditto Databases (*.db; *.mdb)\0*.db;*.mdb\0\0");
  312. FileName.lpstrDefExt = _T("db");
  313. FileName.hwndOwner = m_hWnd;
  314. if(GetOpenFileName(&FileName) == 0)
  315. return;
  316. CString csPath(FileName.lpstrFile);
  317. if(FileExists(csPath))
  318. {
  319. if(ValidDB(csPath) == FALSE)
  320. {
  321. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  322. m_ePath.SetFocus();
  323. }
  324. else
  325. {
  326. m_ePath.SetWindowText(csPath);
  327. }
  328. }
  329. else
  330. {
  331. m_ePath.SetWindowText(csPath);
  332. }
  333. }
  334. void COptionsGeneral::OnButtonAbout()
  335. {
  336. CDimWnd dim(this->GetParent());
  337. CMultiLanguage Lang;
  338. CString csLanguage;
  339. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  340. Lang.SetOnlyGetHeader(true);
  341. if(Lang.LoadLanguageFile(csLanguage))
  342. {
  343. CString csMessage;
  344. csMessage.Format(_T("Language - %s\n")
  345. _T("Version - %d\n")
  346. _T("Author - %s\n")
  347. _T("Notes - %s"), csLanguage,
  348. Lang.GetVersion(),
  349. Lang.GetAuthor(),
  350. Lang.GetNotes());
  351. MessageBox(csMessage, _T("Ditto"), MB_OK);
  352. }
  353. else
  354. {
  355. CString csError;
  356. csError.Format(_T("Error loading language file - %s - reason = "), csLanguage, Lang.m_csLastError);
  357. MessageBox(csError, _T("Ditto"), MB_OK);
  358. }
  359. }
  360. void COptionsGeneral::OnBnClickedButtonAdvanced()
  361. {
  362. CDimWnd dim(this->GetParent());
  363. CAdvGeneral adv(this);
  364. adv.DoModal();
  365. }
  366. HBRUSH COptionsGeneral::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  367. {
  368. HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
  369. switch(nCtlColor)
  370. {
  371. case CTLCOLOR_DLG: // dialog
  372. case CTLCOLOR_STATIC: // static, checkbox, read-only edit, etc.
  373. //pDC->SetBkColor(RGB(251, 251, 251));
  374. //hbr = m_brush;
  375. break;
  376. }
  377. return hbr;
  378. }
  379. void COptionsGeneral::FillThemes()
  380. {
  381. CString csFile = CGetSetOptions::GetPath(PATH_THEMES);
  382. csFile += "*.xml";
  383. CString csTheme = CGetSetOptions::GetTheme();
  384. CFileFind find;
  385. BOOL bCont = find.FindFile(csFile);
  386. bool bSetCurSel = false;
  387. while (bCont)
  388. {
  389. bCont = find.FindNextFile();
  390. CTheme theme;
  391. if (theme.Load(find.GetFileTitle(), true, false))
  392. {
  393. if (theme.FileVersion() >= 2 && theme.FileVersion() < 100)
  394. {
  395. int nIndex = m_cbTheme.AddString(find.GetFileTitle());
  396. if (find.GetFileTitle() == csTheme)
  397. {
  398. m_cbTheme.SetCurSel(nIndex);
  399. bSetCurSel = true;
  400. }
  401. }
  402. }
  403. }
  404. int nIndex = m_cbTheme.AddString(DEFAULT_THEME);
  405. if (bSetCurSel == false)
  406. {
  407. m_cbTheme.SetCurSel(nIndex);
  408. }
  409. }
  410. void COptionsGeneral::OnBnClickedButtonTheme()
  411. {
  412. CDimWnd dim(this->GetParent());
  413. CTheme theme;
  414. CString csTheme;
  415. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  416. if (csTheme == DEFAULT_THEME)
  417. return;
  418. if (theme.Load(csTheme, true, false))
  419. {
  420. CString csMessage;
  421. csMessage.Format(_T("Theme - %s\n")
  422. _T("Version - %d\n")
  423. _T("Author - %s\n")
  424. _T("Notes - %s"), csTheme,
  425. theme.FileVersion(),
  426. theme.Author(),
  427. theme.Notes());
  428. MessageBox(csMessage, _T("Ditto"), MB_OK);
  429. }
  430. else
  431. {
  432. CString csError;
  433. csError.Format(_T("Error loading theme file - %s - reason = "), csTheme, theme.LastError());
  434. MessageBox(csError, _T("Ditto"), MB_OK);
  435. }
  436. }
  437. void COptionsGeneral::OnBnClickedButtonDefaultFault()
  438. {
  439. CFont *ft = m_btDefaultButton.GetFont();
  440. ft->GetLogFont(&m_LogFont);
  441. memset(&m_LogFont, 0, sizeof(m_LogFont));
  442. m_LogFont.lfHeight = -10;
  443. m_LogFont.lfWeight = 400;
  444. m_LogFont.lfCharSet = 1;
  445. STRCPY(m_LogFont.lfFaceName, _T("Segoe UI"));
  446. m_Font.DeleteObject();
  447. m_Font.CreateFontIndirect(&m_LogFont);
  448. m_btFont.SetFont(&m_Font);
  449. CString cs;
  450. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  451. m_btFont.SetWindowText(cs);
  452. this->SetFont(&m_Font);
  453. }
  454. int COptionsGeneral::GetFontSize(HWND hWnd, const LOGFONT& lf)
  455. {
  456. int nFontSize = 0;
  457. HDC hDC = ::GetWindowDC(hWnd);
  458. if (lf.lfHeight < 0)
  459. {
  460. nFontSize = -::MulDiv(lf.lfHeight, 72, ::GetDeviceCaps(hDC, LOGPIXELSY));
  461. }
  462. else
  463. {
  464. TEXTMETRIC tm;
  465. ::ZeroMemory(&tm, sizeof(TEXTMETRIC));
  466. ::GetTextMetrics(hDC, &tm);
  467. nFontSize = ::MulDiv(lf.lfHeight - tm.tmInternalLeading, 72, ::GetDeviceCaps(hDC, LOGPIXELSY));
  468. }
  469. ::ReleaseDC(hWnd, hDC);
  470. return nFontSize;
  471. }
  472. void COptionsGeneral::OnBnClickedButtonFont()
  473. {
  474. CFontDialog dlg(&m_LogFont, (CF_TTONLY | CF_SCREENFONTS), 0, this);
  475. if (dlg.DoModal() == IDOK)
  476. {
  477. m_Font.DeleteObject();
  478. memcpy(&m_LogFont, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
  479. m_Font.CreateFontIndirect(&m_LogFont);
  480. m_btFont.SetFont(&m_Font);
  481. CString cs;
  482. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  483. m_btFont.SetWindowText(cs);
  484. }
  485. }
  486. //void COptionsGeneral::OnNMClickSyslinkEnvVarInfo(NMHDR *pNMHDR, LRESULT *pResult)
  487. //{
  488. // CString url = _T("https:////sourceforge.net//p//ditto-cp//wiki//EnvironmentVariables//");
  489. //
  490. // CHyperLink::GotoURL(url, SW_SHOW);
  491. //
  492. // *pResult = 0;
  493. //}
  494. //
  495. //
  496. //void COptionsGeneral::OnEnChangePath()
  497. //{
  498. // // TODO: If this is a RICHEDIT control, the control will not
  499. // // send this notification unless you override the CPropertyPage::OnInitDialog()
  500. // // function and call CRichEditCtrl().SetEventMask()
  501. // // with the ENM_CHANGE flag ORed into the mask.
  502. //
  503. // // TODO: Add your control notification handler code here
  504. //}
  505. void COptionsGeneral::OnEnChangePath()
  506. {
  507. // TODO: If this is a RICHEDIT control, the control will not
  508. // send this notification unless you override the CPropertyPage::OnInitDialog()
  509. // function and call CRichEditCtrl().SetEventMask()
  510. // with the ENM_CHANGE flag ORed into the mask.
  511. // TODO: Add your control notification handler code here
  512. CString toSavePath;
  513. m_ePath.GetWindowText(toSavePath);
  514. if (toSavePath.Find(_T("%")) >= 0)
  515. {
  516. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  517. m_envVarLink.SetWindowText(resolvedPath);
  518. }
  519. else
  520. {
  521. m_envVarLink.SetWindowText(_T("Environment Variables"));
  522. }
  523. }