Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1513 lines
42 KiB

  1. //-------------------------------------------------------------------
  2. //
  3. // FILE: Config.cpp
  4. //
  5. // Summary;
  6. // This file contains the dialog proc for IDD_CPADLG_LCACONF
  7. //
  8. // History;
  9. // Feb-06-95 ChandanS Created
  10. // Mar-14-95 MikeMi Added F1 Message Filter and PWM_HELP message
  11. // Mar-30-95 MikeMi Added Replication Help Context
  12. // Dec-15-95 JeffParh Disallowed local server as own enterprise server.
  13. // Feb-28-96 JeffParh Moved from private cpArrow window class to
  14. // Up-Down common ctrl, in the process fixing the
  15. // multi-colored background problems
  16. // Apr-17-96 JeffParh Imported variable definitions that were in the
  17. // config.hpp header file.
  18. //
  19. //-------------------------------------------------------------------
  20. #include <windows.h>
  21. #include <commctrl.h>
  22. #include "resource.h"
  23. #include <stdlib.h>
  24. #include <tchar.h>
  25. #include <wchar.h>
  26. #include <htmlhelp.h>
  27. #include "liccpa.hpp"
  28. #include "config.hpp"
  29. extern "C"
  30. {
  31. #include <lmcons.h>
  32. #include <icanon.h>
  33. INT_PTR CALLBACK dlgprocLICCPACONFIG( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  34. }
  35. static BOOL OnEnSetFocus( HWND hwndDlg, short nID );
  36. static BOOL OnDeltaPosSpinTime( HWND hwndDlg, NM_UPDOWN * pnmud );
  37. static HBRUSH OnCtlColorStatic( HWND hwndDlg, HDC hDC, HWND hwndStatic );
  38. DWORD HOUR_MIN = HOUR_MIN_24;
  39. DWORD HOUR_MAX = HOUR_MAX_24;
  40. DWORD HOUR_PAGE = HOUR_PAGE_24;
  41. SERVICEPARAMS ServParams;
  42. static PSERVICEPARAMS pServParams = &ServParams;
  43. // JBP 96/04/17 : This #ifdef should not be necessary; the default is only used
  44. // in the event that GetLocalInfo() fails.
  45. //
  46. // #ifdef JAPAN
  47. // INTLSTRUCT IntlDefault = { 1,
  48. // 0,
  49. // TEXT(""),
  50. // TEXT(""),
  51. // TEXT(":")
  52. // };
  53. // #else
  54. INTLSTRUCT IntlDefault = { 0,
  55. 0,
  56. TEXT("AM"),
  57. TEXT("PM"),
  58. TEXT(":")
  59. };
  60. // #endif
  61. INTLSTRUCT IntlCurrent;
  62. //-------------------------------------------------------------------
  63. // Function: GetLocaleValue
  64. //
  65. // Summary:
  66. //
  67. // In:
  68. // lcid :
  69. // lcType :
  70. // pszStr :
  71. // size :
  72. // pszDefault :
  73. // Out:
  74. // Returns:
  75. //
  76. // Caveats:
  77. //
  78. // History:
  79. // Feb-07-95 ChandanS Created
  80. //-------------------------------------------------------------------
  81. int GetLocaleValue(
  82. LCID lcid,
  83. LCTYPE lcType,
  84. WCHAR *pszStr,
  85. int size,
  86. LPWSTR pszDefault )
  87. {
  88. /*
  89. * Initialize the output buffer.
  90. */
  91. *pszStr = (WCHAR) 0;
  92. /*
  93. * Get the locale information.
  94. */
  95. if (!GetLocaleInfo ( lcid,
  96. lcType,
  97. pszStr,
  98. size ))
  99. {
  100. /*
  101. * Couldn't get info from GetLocaleInfo.
  102. */
  103. if (pszDefault)
  104. {
  105. /*
  106. * Return the default info.
  107. */
  108. lstrcpy (pszStr, pszDefault);
  109. }
  110. else
  111. {
  112. /*
  113. * Return error.
  114. */
  115. return (-1);
  116. }
  117. }
  118. /*
  119. * Convert the string to an integer and return the result.
  120. * This will only be used by the caller of this routine when
  121. * appropriate.
  122. */
  123. return ( _wtoi(pszStr) );
  124. }
  125. //-------------------------------------------------------------------
  126. // Function: TimeInit
  127. //
  128. // Summary:
  129. //
  130. // In:
  131. // Out:
  132. // Returns:
  133. //
  134. // Caveats:
  135. //
  136. // History:
  137. // Feb-07-95 ChandanS Created
  138. //-------------------------------------------------------------------
  139. VOID TimeInit()
  140. {
  141. WCHAR szTemp[128];
  142. GetLocaleValue (0,
  143. LOCALE_STIME,
  144. IntlCurrent.szTime,
  145. sizeof(IntlCurrent.szTime),
  146. IntlDefault.szTime);
  147. GetLocaleValue (0,
  148. LOCALE_ITLZERO,
  149. szTemp,
  150. sizeof(szTemp)/sizeof(TCHAR),
  151. TEXT("0"));
  152. IntlCurrent.iTLZero = _wtoi(szTemp);
  153. GetLocaleValue (0,
  154. LOCALE_ITIME,
  155. szTemp,
  156. sizeof(szTemp)/sizeof(TCHAR),
  157. TEXT("0"));
  158. IntlCurrent.iTime = _wtoi(szTemp);
  159. if (!IntlCurrent.iTime)
  160. {
  161. GetLocaleValue (0,
  162. LOCALE_S1159,
  163. IntlCurrent.sz1159,
  164. sizeof(IntlCurrent.sz1159),
  165. IntlDefault.sz1159);
  166. GetLocaleValue (0,
  167. LOCALE_S2359,
  168. IntlCurrent.sz2359,
  169. sizeof(IntlCurrent.sz2359),
  170. IntlDefault.sz2359);
  171. HOUR_MIN = HOUR_MIN_12;
  172. HOUR_MAX = HOUR_MAX_12;
  173. HOUR_PAGE = HOUR_PAGE_12;
  174. }
  175. }
  176. //-------------------------------------------------------------------
  177. // Function: ReadRegistry
  178. //
  179. // Summary:
  180. // Opens the registry & reads in the key values
  181. //
  182. // In:
  183. // Out:
  184. // Returns:
  185. //
  186. // Caveats:
  187. //
  188. // History:
  189. // Feb-07-95 ChandanS Created
  190. //-------------------------------------------------------------------
  191. LONG ReadRegistry()
  192. {
  193. DWORD dwDisposition;
  194. LONG lrt;
  195. BOOL fNew;
  196. HKEY hKey;
  197. fNew = FALSE;
  198. lrt = ::RegCreateKeyEx( HKEY_LOCAL_MACHINE,
  199. szLicenseKey,
  200. 0,
  201. NULL,
  202. REG_OPTION_NON_VOLATILE,
  203. KEY_ALL_ACCESS,
  204. NULL,
  205. &hKey,
  206. &dwDisposition );
  207. if ((ERROR_SUCCESS == lrt) &&
  208. (REG_CREATED_NEW_KEY == dwDisposition) )
  209. {
  210. fNew = TRUE;
  211. // Set normal values
  212. //
  213. lrt = ::RegSetValueEx( hKey,
  214. szUseEnterprise,
  215. 0,
  216. REG_DWORD,
  217. (PBYTE)&dwUseEnterprise,
  218. sizeof( DWORD ) );
  219. if (ERROR_SUCCESS == lrt)
  220. {
  221. lrt = ::RegSetValueEx( hKey,
  222. szReplicationType,
  223. 0,
  224. REG_DWORD,
  225. (PBYTE)&dwReplicationType,
  226. sizeof( DWORD ) );
  227. if (ERROR_SUCCESS == lrt)
  228. {
  229. lrt = ::RegSetValueEx( hKey,
  230. szReplicationTime,
  231. 0,
  232. REG_DWORD,
  233. (PBYTE)&dwReplicationTimeInSec, // In seconds
  234. sizeof( DWORD ) );
  235. if (ERROR_SUCCESS == lrt)
  236. {
  237. WCHAR szNull[] = L"";
  238. lrt = ::RegSetValueEx( hKey,
  239. szEnterpriseServer,
  240. 0,
  241. REG_SZ,
  242. (PBYTE)szNull,
  243. sizeof(WCHAR));
  244. }
  245. }
  246. }
  247. }
  248. if (ERROR_SUCCESS == lrt)
  249. { // read values into pServParams
  250. DWORD dwSize = sizeof( DWORD );
  251. DWORD dwRegType = REG_DWORD;
  252. lrt = ::RegQueryValueEx( hKey,
  253. (LPWSTR)szUseEnterprise,
  254. 0,
  255. &dwRegType,
  256. (PBYTE)&(pServParams->dwUseEnterprise),
  257. &dwSize );
  258. if (lrt == REG_OPENED_EXISTING_KEY)
  259. {
  260. lrt = ::RegSetValueEx( hKey,
  261. szUseEnterprise,
  262. 0,
  263. REG_DWORD,
  264. (PBYTE)&dwUseEnterprise,
  265. sizeof( DWORD ) );
  266. pServParams->dwUseEnterprise = dwUseEnterprise;
  267. }
  268. else if ((dwRegType != REG_DWORD) ||
  269. (dwSize != sizeof( DWORD )) )
  270. {
  271. lrt = ERROR_BADDB;
  272. }
  273. if (!lrt )
  274. {
  275. dwSize = sizeof( DWORD );
  276. dwRegType = REG_DWORD;
  277. lrt = ::RegQueryValueEx( hKey,
  278. (LPWSTR)szReplicationType,
  279. 0,
  280. &dwRegType,
  281. (PBYTE)&(pServParams->dwReplicationType),
  282. &dwSize );
  283. if (lrt == REG_OPENED_EXISTING_KEY)
  284. {
  285. lrt = ::RegSetValueEx( hKey,
  286. szReplicationType,
  287. 0,
  288. REG_DWORD,
  289. (PBYTE)&dwReplicationType,
  290. sizeof(DWORD));
  291. pServParams->dwReplicationType = dwReplicationType;
  292. }
  293. else if ( lrt || (dwRegType != REG_DWORD) ||
  294. (dwSize != sizeof( DWORD )) )
  295. {
  296. lrt = ERROR_BADDB;
  297. }
  298. if (!lrt)
  299. {
  300. dwSize = sizeof( DWORD );
  301. dwRegType = REG_DWORD;
  302. lrt = ::RegQueryValueEx( hKey,
  303. (LPWSTR)szReplicationTime,
  304. 0,
  305. &dwRegType,
  306. (PBYTE)&(pServParams->dwReplicationTime),
  307. &dwSize );
  308. if (lrt == REG_OPENED_EXISTING_KEY)
  309. {
  310. lrt = ::RegSetValueEx( hKey,
  311. szReplicationTime,
  312. 0,
  313. REG_DWORD,
  314. (PBYTE)&dwReplicationTimeInSec,
  315. sizeof(DWORD));
  316. pServParams->dwReplicationTime = dwReplicationTimeInSec;
  317. }
  318. else if ( (dwRegType != REG_DWORD) ||
  319. (dwSize != sizeof( DWORD )) )
  320. {
  321. lrt = ERROR_BADDB;
  322. }
  323. if (!lrt)
  324. {
  325. dwRegType = REG_SZ;
  326. lrt = RegQueryValueEx( hKey,
  327. (LPWSTR)szEnterpriseServer,
  328. 0,
  329. &dwRegType,
  330. (PBYTE)NULL, //request for size
  331. &dwSize );
  332. if (lrt == REG_OPENED_EXISTING_KEY)
  333. {
  334. WCHAR szNull[] = L"";
  335. lrt = ::RegSetValueEx( hKey,
  336. szEnterpriseServer,
  337. 0,
  338. REG_SZ,
  339. (PBYTE)szNull,
  340. sizeof(WCHAR));
  341. pServParams->pszEnterpriseServer = (LPWSTR)GlobalAlloc(GPTR, (wcslen(szNull) + 1) * sizeof(WCHAR));
  342. wcscpy(pServParams->pszEnterpriseServer, szNull);
  343. }
  344. else if (dwRegType != REG_SZ)
  345. {
  346. lrt = ERROR_BADDB;
  347. }
  348. else
  349. {
  350. pServParams->pszEnterpriseServer = (LPWSTR) GlobalAlloc(GPTR, dwSize);
  351. if (pServParams->pszEnterpriseServer)
  352. {
  353. lrt = ::RegQueryValueEx( hKey,
  354. (LPWSTR)szEnterpriseServer,
  355. 0,
  356. &dwRegType,
  357. (PBYTE)(pServParams->pszEnterpriseServer),
  358. &dwSize );
  359. if ( (dwRegType != REG_SZ) ||
  360. (dwSize != (wcslen(pServParams->pszEnterpriseServer ) + 1) * sizeof(WCHAR)))
  361. {
  362. lrt = ERROR_BADDB;
  363. }
  364. }
  365. else
  366. {
  367. lrt = ERROR_BADDB;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. }
  374. if (hKey && lrt == ERROR_SUCCESS)
  375. {
  376. // Init the globals
  377. if (pServParams->dwReplicationType)
  378. {
  379. DWORD dwTemp = pServParams->dwReplicationTime;
  380. pServParams->dwHour = dwTemp / (60 * 60);
  381. pServParams->dwMinute = (dwTemp - (pServParams->dwHour * 60 * 60)) / 60;
  382. pServParams->dwSecond = dwTemp - (pServParams->dwHour * 60 * 60) -
  383. (pServParams->dwMinute * 60);
  384. if (!IntlCurrent.iTime)
  385. { // it's in 12 hour format
  386. if (pServParams->dwHour > 12)
  387. {
  388. pServParams->fPM = TRUE;
  389. pServParams->dwHour -= 12;
  390. }
  391. else if (pServParams->dwHour == 12)
  392. {
  393. pServParams->fPM = TRUE;
  394. }
  395. else
  396. {
  397. if (pServParams->dwHour == 0)
  398. pServParams->dwHour = HOUR_MAX;
  399. pServParams->fPM = FALSE;
  400. }
  401. }
  402. }
  403. else
  404. {
  405. pServParams->dwReplicationTime = pServParams->dwReplicationTime / (60 * 60);
  406. if (!IntlCurrent.iTime)
  407. // it's in 12 hour format
  408. pServParams->dwHour = HOUR_MAX;
  409. else
  410. pServParams->dwHour = HOUR_MIN;
  411. pServParams->dwMinute = MINUTE_MIN;
  412. pServParams->dwSecond = SECOND_MIN;
  413. pServParams->fPM = FALSE;
  414. }
  415. return (RegCloseKey(hKey));
  416. }
  417. else if (hKey)
  418. RegCloseKey(hKey);
  419. return( lrt );
  420. }
  421. //-------------------------------------------------------------------
  422. // Function: ConfigAccessOk
  423. //
  424. // Summary:
  425. // Checks access rights form reg call and raise dialog as needed
  426. //
  427. // In:
  428. // hDlg - Handle to working dialog to raise error dlgs with
  429. // lrc - the return status from a reg call
  430. // Out:
  431. // Returns:
  432. //
  433. // Caveats:
  434. //
  435. // History:
  436. // Feb-07-95 ChandanS Created
  437. //-------------------------------------------------------------------
  438. inline BOOL ConfigAccessOk( HWND hDlg, LONG lrc )
  439. {
  440. BOOL frt = TRUE;
  441. if (ERROR_SUCCESS != lrc)
  442. {
  443. WCHAR szText[TEMPSTR_SIZE];
  444. WCHAR szTitle[TEMPSTR_SIZE];
  445. UINT wId;
  446. if (ERROR_ACCESS_DENIED == lrc)
  447. {
  448. wId = IDS_NOACCESS;
  449. }
  450. else
  451. {
  452. wId = IDS_BADREG;
  453. }
  454. LoadString(g_hinst, IDS_CPCAPTION, szTitle, TEMPSTR_SIZE);
  455. LoadString(g_hinst, wId, szText, TEMPSTR_SIZE);
  456. MessageBox (hDlg, szText, szTitle, MB_OK|MB_ICONSTOP);
  457. frt = FALSE;
  458. }
  459. return( frt );
  460. }
  461. //-------------------------------------------------------------------
  462. // Function: ConfigInitUserEdit
  463. //
  464. // Summary:
  465. // Initializes and defines user count edit control behaviour
  466. //
  467. // In:
  468. // hwndDlg - Parent dialog of user count edit dialog
  469. // Out:
  470. // Returns:
  471. //
  472. // Caveats:
  473. //
  474. // History:
  475. // Feb-07-95 ChandanS Created
  476. //-------------------------------------------------------------------
  477. void ConfigInitUserEdit( HWND hwndDlg )
  478. {
  479. HWND hwndCount = GetDlgItem( hwndDlg, IDC_HOURS);
  480. SendMessage( hwndCount, EM_LIMITTEXT, cchEDITLIMIT, 0 );
  481. hwndCount = GetDlgItem( hwndDlg, IDC_HOUR);
  482. SendMessage( hwndCount, EM_LIMITTEXT, cchEDITLIMIT, 0 );
  483. hwndCount = GetDlgItem( hwndDlg, IDC_MINUTE);
  484. SendMessage( hwndCount, EM_LIMITTEXT, cchEDITLIMIT, 0 );
  485. hwndCount = GetDlgItem( hwndDlg, IDC_SECOND);
  486. SendMessage( hwndCount, EM_LIMITTEXT, cchEDITLIMIT, 0 );
  487. hwndCount = GetDlgItem( hwndDlg, IDC_AMPM);
  488. SendMessage( hwndCount, EM_LIMITTEXT, max(wcslen(IntlCurrent.sz1159),
  489. wcslen(IntlCurrent.sz2359)), 0 );
  490. SetDlgItemText (hwndDlg, IDC_TIMESEP1, IntlCurrent.szTime);
  491. SetDlgItemText (hwndDlg, IDC_TIMESEP2, IntlCurrent.szTime);
  492. }
  493. //-------------------------------------------------------------------
  494. // Function: ConfigInitDialogForService
  495. //
  496. // Summary:
  497. // Initialize dialog controls to the service state
  498. //
  499. // In:
  500. // hwndDlg - Parent dialog to init controls in
  501. // Out:
  502. // Returns:
  503. //
  504. // Caveats:
  505. //
  506. // History:
  507. // Feb-07-95 ChandanS Created
  508. // Feb-28-96 JeffParh Added range set for interval spin ctrl
  509. //-------------------------------------------------------------------
  510. void ConfigInitDialogForService( HWND hwndDlg, DWORD dwGroup )
  511. {
  512. HWND hwndHour = GetDlgItem( hwndDlg, IDC_HOUR);
  513. HWND hwndMinute = GetDlgItem( hwndDlg, IDC_MINUTE);
  514. HWND hwndSecond = GetDlgItem( hwndDlg, IDC_SECOND);
  515. HWND hwndAMPM = GetDlgItem( hwndDlg, IDC_AMPM);
  516. HWND hwndInterval = GetDlgItem( hwndDlg, IDC_HOURS);
  517. HWND hwndIntervalSpin = GetDlgItem( hwndDlg, IDC_HOURARROW );
  518. HWND hwndTimeSpin = GetDlgItem( hwndDlg, IDC_TIMEARROW );
  519. BOOL fEnterprise = (pServParams->dwUseEnterprise);
  520. BOOL fReplAtTime = (pServParams->dwReplicationType);
  521. if (dwGroup == ATINIT || dwGroup == FORTIME)
  522. {
  523. if (fReplAtTime)
  524. {
  525. WCHAR szTemp[3];
  526. CheckDlgButton( hwndDlg, IDC_REPL_TIME, fReplAtTime);
  527. CheckDlgButton( hwndDlg, IDC_REPL_INT, !fReplAtTime);
  528. if (IntlCurrent.iTLZero)
  529. {
  530. wsprintf(szTemp,TEXT("%02u"), pServParams->dwHour);
  531. szTemp[2] = UNICODE_NULL;
  532. SetDlgItemText( hwndDlg, IDC_HOUR, szTemp);
  533. }
  534. else
  535. {
  536. SetDlgItemInt( hwndDlg, IDC_HOUR, pServParams->dwHour, FALSE );
  537. }
  538. wsprintf(szTemp,TEXT("%02u"), pServParams->dwMinute);
  539. szTemp[2] = UNICODE_NULL;
  540. SetDlgItemText( hwndDlg, IDC_MINUTE, szTemp);
  541. wsprintf(szTemp,TEXT("%02u"), pServParams->dwSecond);
  542. szTemp[2] = UNICODE_NULL;
  543. SetDlgItemText( hwndDlg, IDC_SECOND, szTemp);
  544. if (pServParams->fPM)
  545. SetDlgItemText( hwndDlg, IDC_AMPM, IntlCurrent.sz2359);
  546. else
  547. SetDlgItemText( hwndDlg, IDC_AMPM, IntlCurrent.sz1159);
  548. SetDlgItemText( hwndDlg, IDC_HOURS, L"");
  549. SetFocus(GetDlgItem(hwndDlg, IDC_REPL_TIME));
  550. }
  551. else
  552. {
  553. CheckDlgButton( hwndDlg, IDC_REPL_INT, !fReplAtTime);
  554. CheckDlgButton( hwndDlg, IDC_REPL_TIME, fReplAtTime);
  555. SetDlgItemInt( hwndDlg, IDC_HOURS, pServParams->dwReplicationTime, FALSE);
  556. SetDlgItemText( hwndDlg, IDC_HOUR, L"");
  557. SetDlgItemText( hwndDlg, IDC_MINUTE, L"");
  558. SetDlgItemText( hwndDlg, IDC_SECOND, L"");
  559. SetDlgItemText( hwndDlg, IDC_AMPM, L"");
  560. SetFocus(GetDlgItem(hwndDlg, IDC_REPL_INT));
  561. }
  562. EnableWindow( hwndTimeSpin, fReplAtTime);
  563. EnableWindow( hwndHour, fReplAtTime);
  564. EnableWindow( hwndMinute, fReplAtTime);
  565. EnableWindow( hwndSecond, fReplAtTime);
  566. if ( IntlCurrent.iTime )
  567. {
  568. ShowWindow( hwndAMPM, SW_HIDE );
  569. }
  570. else
  571. {
  572. EnableWindow( hwndAMPM, fReplAtTime );
  573. }
  574. EnableWindow( hwndInterval, !fReplAtTime);
  575. EnableWindow( hwndIntervalSpin, !fReplAtTime);
  576. SendMessage( hwndIntervalSpin, UDM_SETRANGE, 0, (LPARAM) MAKELONG( (short) INTERVAL_MAX, (short) INTERVAL_MIN ) );
  577. }
  578. }
  579. //-------------------------------------------------------------------
  580. // Function: ConfigFreeServiceEntry
  581. //
  582. // Summary:
  583. // Free all allocated memory when a service structure is created
  584. //
  585. // In:
  586. // pServParams - The Service structure to free
  587. // Out:
  588. // Returns:
  589. //
  590. // Caveats:
  591. //
  592. // History:
  593. // Feb-07-95 ChandanS Created
  594. //-------------------------------------------------------------------
  595. void ConfigFreeServiceEntry( )
  596. {
  597. if (pServParams->pszEnterpriseServer)
  598. GlobalFree( pServParams->pszEnterpriseServer );
  599. }
  600. //-------------------------------------------------------------------
  601. // Function: ConfigSaveServiceToReg
  602. //
  603. // Summary:
  604. // Save the given Service structure to the registry
  605. //
  606. // In:
  607. // pServParams - Service structure to save
  608. // Out:
  609. // Returns:
  610. //
  611. // Caveats:
  612. //
  613. // History:
  614. // Feb-07-95 ChandanS Created
  615. //-------------------------------------------------------------------
  616. void ConfigSaveServiceToReg( )
  617. {
  618. DWORD dwDisposition;
  619. LONG lrt;
  620. HKEY hKey;
  621. if (!pServParams->dwReplicationType)
  622. pServParams->dwReplicationTime = pServParams->dwReplicationTime * 60 *60;
  623. lrt = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
  624. szLicenseKey,
  625. 0,
  626. NULL,
  627. REG_OPTION_NON_VOLATILE,
  628. KEY_ALL_ACCESS,
  629. NULL,
  630. &hKey,
  631. &dwDisposition );
  632. if (ERROR_SUCCESS == lrt)
  633. {
  634. lrt = RegSetValueEx( hKey,
  635. szUseEnterprise,
  636. 0,
  637. REG_DWORD,
  638. (PBYTE)&(pServParams->dwUseEnterprise),
  639. sizeof( DWORD ) );
  640. if (ERROR_SUCCESS == lrt)
  641. {
  642. lrt = RegSetValueEx( hKey,
  643. szEnterpriseServer,
  644. 0,
  645. REG_SZ,
  646. (PBYTE)pServParams->pszEnterpriseServer,
  647. (wcslen (pServParams->pszEnterpriseServer) + 1) * sizeof(WCHAR));
  648. if (ERROR_SUCCESS == lrt)
  649. {
  650. lrt = RegSetValueEx( hKey,
  651. szReplicationTime,
  652. 0,
  653. REG_DWORD,
  654. (PBYTE)&(pServParams->dwReplicationTime),
  655. sizeof( DWORD ) );
  656. if (ERROR_SUCCESS == lrt)
  657. {
  658. lrt = ::RegSetValueEx( hKey,
  659. szReplicationType,
  660. 0,
  661. REG_DWORD,
  662. (PBYTE)&(pServParams->dwReplicationType),
  663. sizeof( DWORD ) );
  664. }
  665. }
  666. }
  667. }
  668. if (hKey && lrt == ERROR_SUCCESS)
  669. lrt = RegCloseKey(hKey);
  670. else if (hKey)
  671. lrt = RegCloseKey(hKey);
  672. }
  673. //-------------------------------------------------------------------
  674. // Function: ConfigEditInvalidDlg
  675. //
  676. // Summary:
  677. // Display Dialog when user count edit control value is invalid
  678. //
  679. // In:
  680. // hwndDlg - hwnd of dialog
  681. // Out:
  682. // Returns:
  683. //
  684. // Caveats:
  685. //
  686. // History:
  687. // Feb-07-95 ChandanS Created
  688. //-------------------------------------------------------------------
  689. void ConfigEditInvalidDlg( HWND hwndDlg, short nID, BOOL fBeep)
  690. {
  691. HWND hwnd = GetDlgItem( hwndDlg, nID);
  692. if (fBeep) //If we've already put up a MessageBox, we shouldn't beep
  693. MessageBeep( MB_VALUELIMIT );
  694. SetFocus(hwnd);
  695. SendMessage(hwnd, EM_SETSEL, 0, -1 );
  696. }
  697. //-------------------------------------------------------------------
  698. // Function: ConfigEditValidate
  699. //
  700. // Summary:
  701. // Handle when the value within the user count edit control changes
  702. //
  703. // In:
  704. // hwndDlg - hwnd of dialog
  705. // pserv - currently selected service
  706. // Out:
  707. // Returns: FALSE if Edit Value is not valid, TRUE if it is
  708. //
  709. // Caveats:
  710. //
  711. // History:
  712. // Feb-07-95 ChandanS Created
  713. //-------------------------------------------------------------------
  714. BOOL ConfigEditValidate( HWND hwndDlg, short *pnID, BOOL *pfBeep)
  715. {
  716. UINT nValue;
  717. BOOL fValid = FALSE;
  718. WCHAR szTemp[MAX_PATH + 1];
  719. DWORD NumberOfHours, SecondsinHours;
  720. WCHAR szText[TEMPSTR_SIZE];
  721. WCHAR szTitle[TEMPSTR_SIZE];
  722. *pfBeep = TRUE;
  723. // only do this if license info is replicated to an ES
  724. do {
  725. if (IsDlgButtonChecked(hwndDlg, IDC_REPL_INT))
  726. {
  727. nValue = GetDlgItemInt( hwndDlg, IDC_HOURS, &fValid, FALSE);
  728. *pnID = IDC_HOURS;
  729. if (fValid)
  730. {
  731. if (nValue < INTERVAL_MIN)
  732. {
  733. fValid = FALSE;
  734. pServParams->dwReplicationTime = INTERVAL_MIN;
  735. SetDlgItemInt(hwndDlg, IDC_HOURS, INTERVAL_MIN, FALSE);
  736. break;
  737. }
  738. else if (nValue > INTERVAL_MAX)
  739. {
  740. fValid = FALSE;
  741. pServParams->dwReplicationTime = INTERVAL_MAX;
  742. SetDlgItemInt(hwndDlg, IDC_HOURS, INTERVAL_MAX, FALSE);
  743. break;
  744. }
  745. else
  746. pServParams->dwReplicationTime = nValue;
  747. }
  748. else
  749. {
  750. fValid = FALSE;
  751. break;
  752. }
  753. pServParams->dwReplicationType = FALSE;
  754. }
  755. else
  756. {
  757. nValue = GetDlgItemInt( hwndDlg, IDC_HOUR, &fValid, FALSE);
  758. if (fValid)
  759. pServParams->dwHour = nValue;
  760. else
  761. {
  762. *pnID = IDC_HOUR;
  763. break;
  764. }
  765. nValue = GetDlgItemInt( hwndDlg, IDC_MINUTE, &fValid, FALSE);
  766. if (fValid)
  767. pServParams->dwMinute = nValue;
  768. else
  769. {
  770. *pnID = IDC_MINUTE;
  771. break;
  772. }
  773. nValue = GetDlgItemInt( hwndDlg, IDC_SECOND, &fValid, FALSE);
  774. if (fValid)
  775. pServParams->dwSecond = nValue;
  776. else
  777. {
  778. *pnID = IDC_SECOND;
  779. break;
  780. }
  781. if (!IntlCurrent.iTime)
  782. {
  783. *pnID = IDC_AMPM;
  784. nValue = GetDlgItemText( hwndDlg, IDC_AMPM, szTemp, MAX_PATH);
  785. if (nValue == 0)
  786. {
  787. fValid = FALSE;
  788. break;
  789. }
  790. szTemp[nValue] = UNICODE_NULL;
  791. if (!_wcsicmp(szTemp, IntlCurrent.sz1159))
  792. {
  793. pServParams->fPM = FALSE;
  794. }
  795. else if (!_wcsicmp(szTemp, IntlCurrent.sz2359))
  796. {
  797. pServParams->fPM = TRUE;
  798. }
  799. else
  800. {
  801. fValid = FALSE;
  802. break;
  803. }
  804. }
  805. if (!IntlCurrent.iTime)
  806. { // It's in 12 hour format
  807. if (pServParams->fPM)
  808. {
  809. NumberOfHours = 12 + pServParams->dwHour -
  810. ((pServParams->dwHour / 12) * 12);
  811. }
  812. else
  813. {
  814. NumberOfHours = pServParams->dwHour -
  815. ((pServParams->dwHour / 12) * 12);
  816. }
  817. }
  818. else
  819. { // It's in 24 hour format
  820. NumberOfHours = pServParams->dwHour;
  821. }
  822. SecondsinHours = NumberOfHours * 60 * 60;
  823. pServParams->dwReplicationTime = SecondsinHours +
  824. (pServParams->dwMinute * 60) + pServParams->dwSecond;
  825. pServParams->dwReplicationType = TRUE;
  826. }
  827. } while(FALSE);
  828. return( fValid );
  829. }
  830. //-------------------------------------------------------------------
  831. // Function: OnCpaConfigClose
  832. //
  833. // Summary:
  834. // Do work needed when the Control Panel applet is closed.
  835. // Free all Service structures alloced and possible save.
  836. //
  837. // In:
  838. // hwndDlg - Dialog close was requested on
  839. // fSave - Save Services to Registry
  840. // Out:
  841. // Returns:
  842. //
  843. // Caveats:
  844. //
  845. // History:
  846. // Feb-07-95 ChandanS Created
  847. //-------------------------------------------------------------------
  848. void OnCpaConfigClose( HWND hwndDlg, BOOL fSave , WPARAM wParam)
  849. {
  850. short nID;
  851. BOOL fBeep = TRUE;
  852. if (fSave)
  853. {
  854. if ( ConfigEditValidate(hwndDlg, &nID, &fBeep))
  855. {
  856. ConfigSaveServiceToReg( );
  857. ConfigFreeServiceEntry( );
  858. EndDialog( hwndDlg, fSave );
  859. }
  860. else
  861. {
  862. ConfigEditInvalidDlg(hwndDlg, nID, fBeep);
  863. }
  864. }
  865. else
  866. {
  867. ConfigFreeServiceEntry( );
  868. EndDialog( hwndDlg, fSave );
  869. }
  870. }
  871. //-------------------------------------------------------------------
  872. // Function: OnSetReplicationTime
  873. //
  874. // Summary:
  875. // Handle the users request to change replication time
  876. //
  877. // In:
  878. // hwndDlg - hwnd of dialog
  879. // idCtrl - the control id that was pressed to make this request
  880. // Out:
  881. // Returns:
  882. //
  883. // Caveats:
  884. //
  885. // History:
  886. // Feb-07-95 ChandanS Created
  887. // Feb-28-96 JeffParh Added code to modify time bg color
  888. //-------------------------------------------------------------------
  889. void OnSetReplicationTime( HWND hwndDlg, WORD idCtrl )
  890. {
  891. if (idCtrl == IDC_REPL_INT)
  892. {
  893. pServParams->dwReplicationType = dwReplicationType;
  894. }
  895. else
  896. {
  897. pServParams->dwReplicationType = !dwReplicationType;
  898. }
  899. // Edit control within this IDC_TIMEEDIT_BORDER should be subclassed and
  900. // use some other backgroup brush to repaint the background.
  901. // following code works but...
  902. // change the background color of the time edit control
  903. HWND hwndTimeEdit = GetDlgItem( hwndDlg, IDC_TIMEEDIT_BORDER );
  904. InvalidateRect( hwndTimeEdit, NULL, TRUE );
  905. UpdateWindow( hwndTimeEdit );
  906. HWND hwndTimeSep1 = GetDlgItem( hwndDlg, IDC_TIMESEP1 );
  907. InvalidateRect( hwndTimeSep1, NULL, TRUE );
  908. UpdateWindow( hwndTimeSep1 );
  909. HWND hwndTimeSep2 = GetDlgItem( hwndDlg, IDC_TIMESEP2 );
  910. InvalidateRect( hwndTimeSep2, NULL, TRUE );
  911. UpdateWindow( hwndTimeSep2 );
  912. InvalidateRect(
  913. GetDlgItem(hwndDlg, IDC_TIMEARROW),
  914. NULL,
  915. FALSE
  916. );
  917. UpdateWindow( GetDlgItem(hwndDlg, IDC_TIMEARROW) );
  918. ConfigInitDialogForService( hwndDlg, FORTIME);
  919. }
  920. //-------------------------------------------------------------------
  921. // Function: OnCpaConfigInitDialog
  922. //
  923. // Summary:
  924. // Handle the initialization of the Control Panel Applet Dialog
  925. //
  926. // In:
  927. // hwndDlg - the dialog to initialize
  928. // Out:
  929. // iSel - the current service selected
  930. // pServParams - the current service
  931. // Returns:
  932. // TRUE if succesful, otherwise false
  933. //
  934. // Caveats:
  935. //
  936. // History:
  937. // Feb-07-95 ChandanS Created
  938. //-------------------------------------------------------------------
  939. BOOL OnCpaConfigInitDialog( HWND hwndDlg)
  940. {
  941. BOOL frt;
  942. LONG lrt;
  943. TimeInit();
  944. // Do Registry stuff
  945. lrt = ReadRegistry();
  946. frt = ConfigAccessOk( hwndDlg, lrt );
  947. if (frt)
  948. {
  949. CenterDialogToScreen( hwndDlg );
  950. // Set edit text chars limit
  951. ConfigInitUserEdit( hwndDlg );
  952. ConfigInitDialogForService( hwndDlg, ATINIT);
  953. if (pServParams->dwReplicationType)
  954. SetFocus(GetDlgItem(hwndDlg, IDC_HOUR));
  955. else
  956. SetFocus(GetDlgItem(hwndDlg, IDC_HOURS));
  957. }
  958. else
  959. {
  960. EndDialog( hwndDlg, -1 );
  961. }
  962. return( frt );
  963. }
  964. //-------------------------------------------------------------------
  965. // Function: CheckNum
  966. //
  967. // Summary:
  968. //
  969. // In:
  970. // Out:
  971. // Returns:
  972. //
  973. // Caveats:
  974. //
  975. // History:
  976. // Feb-07-95 ChandanS Created
  977. //-------------------------------------------------------------------
  978. BOOL CheckNum (HWND hDlg, WORD nID)
  979. {
  980. short i;
  981. WCHAR szNum[4];
  982. BOOL bReturn;
  983. INT iVal;
  984. UINT nValue;
  985. bReturn = TRUE;
  986. // JonN 5/15/00: PREFIX 112120
  987. ::ZeroMemory( szNum, sizeof(szNum) );
  988. nValue = GetDlgItemText (hDlg, nID, szNum, 3);
  989. for (i = 0; szNum[i]; i++)
  990. if (!_istdigit (szNum[i]))
  991. return (FALSE);
  992. iVal = _wtoi(szNum);
  993. switch (nID)
  994. {
  995. case IDC_HOURS:
  996. if (!nValue)
  997. {
  998. pServParams->dwReplicationTime = dwReplicationTime;
  999. break;
  1000. }
  1001. if (iVal < 9)
  1002. {
  1003. pServParams->dwReplicationTime = (DWORD)iVal;
  1004. break;
  1005. }
  1006. if ((iVal < INTERVAL_MIN) || (iVal > INTERVAL_MAX))
  1007. bReturn = FALSE;
  1008. else
  1009. pServParams->dwReplicationTime = (DWORD)iVal;
  1010. break;
  1011. case IDC_HOUR:
  1012. if (!nValue)
  1013. {
  1014. if (IntlCurrent.iTime)
  1015. { // 24 hour format
  1016. pServParams->dwHour = 0;
  1017. pServParams->fPM = FALSE;
  1018. }
  1019. else
  1020. { // 12 hour format
  1021. pServParams->dwHour = HOUR_MAX;
  1022. pServParams->fPM = FALSE;
  1023. }
  1024. break;
  1025. }
  1026. if ((iVal < (int)HOUR_MIN) || (iVal > (int)HOUR_MAX))
  1027. bReturn = FALSE;
  1028. break;
  1029. case IDC_MINUTE:
  1030. if (!nValue)
  1031. {
  1032. pServParams->dwMinute = MINUTE_MIN;
  1033. break;
  1034. }
  1035. if ((iVal < MINUTE_MIN) || (iVal > MINUTE_MAX))
  1036. bReturn = FALSE;
  1037. break;
  1038. case IDC_SECOND:
  1039. if (!nValue)
  1040. {
  1041. pServParams->dwSecond = SECOND_MIN;
  1042. break;
  1043. }
  1044. if ((iVal < SECOND_MIN) || (iVal > SECOND_MAX))
  1045. bReturn = FALSE;
  1046. break;
  1047. }
  1048. return (bReturn);
  1049. }
  1050. //-------------------------------------------------------------------
  1051. // Function: CheckAMPM
  1052. //
  1053. // Summary:
  1054. //
  1055. // In:
  1056. // Out:
  1057. // Returns:
  1058. //
  1059. // Caveats:
  1060. //
  1061. // History:
  1062. // Feb-07-95 ChandanS Created
  1063. //-------------------------------------------------------------------
  1064. BOOL CheckAMPM(HWND hDlg, WORD nID)
  1065. {
  1066. WCHAR szName[TIMESUF_LEN + 1];
  1067. UINT nValue;
  1068. nValue = GetDlgItemText (hDlg, nID, szName, TIMESUF_LEN);
  1069. szName[nValue] = UNICODE_NULL;
  1070. switch (nID)
  1071. {
  1072. case IDC_AMPM:
  1073. if (!nValue)
  1074. {
  1075. pServParams->fPM = FALSE; // default
  1076. return TRUE;
  1077. }
  1078. if (_wcsnicmp(szName, IntlCurrent.sz1159, nValue) &&
  1079. _wcsnicmp(szName, IntlCurrent.sz2359, nValue))
  1080. {
  1081. return FALSE;
  1082. }
  1083. else
  1084. { // One of them may match fully
  1085. if (!_wcsicmp (szName, IntlCurrent.sz1159))
  1086. {
  1087. pServParams->fPM = FALSE;
  1088. }
  1089. else if (!_wcsicmp(szName, IntlCurrent.sz2359))
  1090. {
  1091. pServParams->fPM = TRUE;
  1092. }
  1093. }
  1094. break;
  1095. }
  1096. return TRUE;
  1097. }
  1098. //-------------------------------------------------------------------
  1099. // Function: dlgprocLICCPACONFIG
  1100. //
  1101. // Summary:
  1102. // The dialog procedure for the main Control Panel Applet Dialog
  1103. //
  1104. // In:
  1105. // hwndDlg - handle of Dialog window
  1106. // uMsg - message
  1107. // lParam1 - first message parameter
  1108. // lParam2 - second message parameter
  1109. // Out:
  1110. // Returns:
  1111. // message dependant
  1112. //
  1113. // Caveats:
  1114. //
  1115. // History:
  1116. // Feb-07-95 ChandanS Created
  1117. // Mar-14-95 MikeMi Added F1 PWM_HELP message
  1118. // Mar-30-95 MikeMi Added Replication Help Context
  1119. // Feb-28-96 JeffParh Added handling of UDN_DELTAPOS and EN_SETFOCUS,
  1120. // removed WM_VSCROLL (switched from private
  1121. // cpArrow class to Up-Down common ctrl)
  1122. //
  1123. //-------------------------------------------------------------------
  1124. INT_PTR CALLBACK dlgprocLICCPACONFIG( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  1125. {
  1126. LRESULT frt = FALSE;
  1127. short nID;
  1128. switch (uMsg)
  1129. {
  1130. case WM_INITDIALOG:
  1131. OnCpaConfigInitDialog( hwndDlg );
  1132. return( (LRESULT)TRUE ); // use default keyboard focus
  1133. break;
  1134. case WM_COMMAND:
  1135. switch (HIWORD( wParam ))
  1136. {
  1137. case EN_UPDATE:
  1138. switch (LOWORD( wParam ))
  1139. {
  1140. case IDC_AMPM:
  1141. if (!CheckAMPM (hwndDlg, LOWORD(wParam)))
  1142. SendMessage ((HWND) lParam, EM_UNDO, 0, 0L);
  1143. break;
  1144. case IDC_HOURS:
  1145. case IDC_HOUR:
  1146. case IDC_MINUTE:
  1147. case IDC_SECOND:
  1148. if (!CheckNum (hwndDlg, LOWORD(wParam)))
  1149. SendMessage ((HWND) lParam, EM_UNDO, 0, 0L);
  1150. break;
  1151. default:
  1152. break;
  1153. }
  1154. break;
  1155. case EN_SETFOCUS:
  1156. frt = (LRESULT)OnEnSetFocus( hwndDlg, LOWORD( wParam ) );
  1157. break;
  1158. case BN_CLICKED:
  1159. switch (LOWORD( wParam ))
  1160. {
  1161. case IDOK:
  1162. frt = (LRESULT)TRUE; // use as save flag
  1163. // intentional no break
  1164. case IDCANCEL:
  1165. OnCpaConfigClose( hwndDlg, !!frt , wParam);
  1166. frt = (LRESULT)FALSE;
  1167. break;
  1168. case IDC_REPL_INT:
  1169. case IDC_REPL_TIME:
  1170. OnSetReplicationTime( hwndDlg, LOWORD(wParam) );
  1171. break;
  1172. case IDC_BUTTONHELP:
  1173. PostMessage( hwndDlg, PWM_HELP, 0, 0 );
  1174. break;
  1175. default:
  1176. break;
  1177. }
  1178. break;
  1179. default:
  1180. break;
  1181. }
  1182. break;
  1183. case WM_NOTIFY:
  1184. nID = (short) wParam;
  1185. if ( IDC_TIMEARROW == nID )
  1186. {
  1187. frt = (LRESULT)OnDeltaPosSpinTime( hwndDlg, (NM_UPDOWN*) lParam );
  1188. }
  1189. else
  1190. {
  1191. frt = (LRESULT)FALSE;
  1192. }
  1193. break;
  1194. case WM_CTLCOLORSTATIC:
  1195. frt = (LRESULT) OnCtlColorStatic( hwndDlg, (HDC) wParam, (HWND) lParam );
  1196. break;
  1197. default:
  1198. if (PWM_HELP == uMsg)
  1199. {
  1200. ::HtmlHelp( hwndDlg, LICCPA_HTMLHELPFILE, HH_DISPLAY_TOPIC,0);
  1201. }
  1202. break;
  1203. }
  1204. return( frt );
  1205. }
  1206. //-------------------------------------------------------------------
  1207. // Function: OnEnSetFocus
  1208. //
  1209. // Summary:
  1210. //
  1211. // In:
  1212. // Out:
  1213. // Returns:
  1214. //
  1215. // Caveats:
  1216. //
  1217. // History:
  1218. // Feb-28-96 JeffParh Created
  1219. //-------------------------------------------------------------------
  1220. static BOOL OnEnSetFocus( HWND hwndDlg, short nID )
  1221. {
  1222. BOOL fSetNewRange = TRUE;
  1223. HWND hwndSpinCtrl;
  1224. int nMax;
  1225. int nMin;
  1226. switch ( nID )
  1227. {
  1228. case IDC_AMPM:
  1229. nMin = 0;
  1230. nMax = 1;
  1231. break;
  1232. case IDC_HOUR:
  1233. nMin = HOUR_MIN;
  1234. nMax = HOUR_MAX;
  1235. break;
  1236. case IDC_MINUTE:
  1237. nMin = MINUTE_MIN;
  1238. nMax = MINUTE_MAX;
  1239. break;
  1240. case IDC_SECOND:
  1241. nMin = SECOND_MIN;
  1242. nMax = SECOND_MAX;
  1243. break;
  1244. default:
  1245. fSetNewRange = FALSE;
  1246. break;
  1247. }
  1248. if ( fSetNewRange )
  1249. {
  1250. hwndSpinCtrl = GetDlgItem( hwndDlg, IDC_TIMEARROW );
  1251. SendMessage( hwndSpinCtrl, UDM_SETRANGE, 0, (LPARAM) MAKELONG( (short) nMax, (short) nMin ) );
  1252. }
  1253. return FALSE;
  1254. }
  1255. //-------------------------------------------------------------------
  1256. // Function: OnDeltaPosSpinTime
  1257. //
  1258. // Summary:
  1259. //
  1260. // In:
  1261. // Out:
  1262. // Returns:
  1263. //
  1264. // Caveats:
  1265. //
  1266. // History:
  1267. // Feb-28-96 JeffParh Created
  1268. //-------------------------------------------------------------------
  1269. static BOOL OnDeltaPosSpinTime( HWND hwndDlg, NM_UPDOWN * pnmud )
  1270. {
  1271. WCHAR szTemp[ 16 ] = TEXT( "" );
  1272. HWND hwndEdit;
  1273. short nID;
  1274. int nValue;
  1275. LRESULT lRange;
  1276. short nRangeHigh;
  1277. short nRangeLow;
  1278. BOOL frt;
  1279. hwndEdit = GetFocus();
  1280. nID = (short) GetWindowLong( hwndEdit, GWL_ID );
  1281. if ( ( IDC_HOUR == nID )
  1282. || ( IDC_MINUTE == nID )
  1283. || ( IDC_SECOND == nID )
  1284. || ( IDC_AMPM == nID ) )
  1285. {
  1286. if ( IDC_AMPM == nID )
  1287. {
  1288. // AM/PM
  1289. GetDlgItemText( hwndDlg, nID, szTemp, sizeof( szTemp ) / sizeof( *szTemp ) );
  1290. nValue = _wcsicmp( szTemp, IntlCurrent.sz2359 );
  1291. SetDlgItemText( hwndDlg, nID, nValue ? IntlCurrent.sz2359 : IntlCurrent.sz1159 );
  1292. }
  1293. else
  1294. {
  1295. lRange = SendMessage( pnmud->hdr.hwndFrom, UDM_GETRANGE, 0, 0 );
  1296. nRangeHigh = LOWORD( lRange );
  1297. nRangeLow = HIWORD( lRange );
  1298. nValue = GetDlgItemInt( hwndDlg, nID, NULL, FALSE );
  1299. nValue += pnmud->iDelta;
  1300. if ( nValue < nRangeLow )
  1301. {
  1302. nValue = nRangeLow;
  1303. }
  1304. else if ( nValue > nRangeHigh )
  1305. {
  1306. nValue = nRangeHigh;
  1307. }
  1308. if ( ( IDC_HOUR == nID ) && !IntlCurrent.iTLZero )
  1309. {
  1310. // set value w/o leading 0
  1311. SetDlgItemInt( hwndDlg, nID, nValue, FALSE );
  1312. }
  1313. else
  1314. {
  1315. // set value w/ leading 0
  1316. wsprintf( szTemp, TEXT("%02u"), nValue );
  1317. SetDlgItemText( hwndDlg, nID, szTemp );
  1318. }
  1319. }
  1320. SetFocus( hwndEdit );
  1321. SendMessage( hwndEdit, EM_SETSEL, 0, -1 );
  1322. // handled
  1323. frt = TRUE;
  1324. }
  1325. else
  1326. {
  1327. // not handled
  1328. frt = FALSE;
  1329. }
  1330. return frt;
  1331. }
  1332. //-------------------------------------------------------------------
  1333. // Function: OnCtlColorStatic
  1334. //
  1335. // Summary:
  1336. //
  1337. // In:
  1338. // Out:
  1339. // Returns:
  1340. //
  1341. // Caveats:
  1342. //
  1343. // History:
  1344. // Feb-28-96 JeffParh Created
  1345. //-------------------------------------------------------------------
  1346. static HBRUSH OnCtlColorStatic( HWND hwndDlg, HDC hDC, HWND hwndStatic )
  1347. {
  1348. LONG nID;
  1349. HBRUSH hBrush;
  1350. nID = GetWindowLong( hwndStatic, GWL_ID );
  1351. if ( pServParams->dwReplicationType
  1352. && ( ( IDC_TIMESEP1 == nID )
  1353. || ( IDC_TIMESEP2 == nID )
  1354. || ( IDC_TIMEEDIT_BORDER == nID ) ) )
  1355. {
  1356. hBrush = (HBRUSH) DefWindowProc( hwndDlg, WM_CTLCOLOREDIT, (WPARAM) hDC, (LPARAM) hwndStatic );
  1357. }
  1358. else
  1359. {
  1360. hBrush = (HBRUSH) DefWindowProc( hwndDlg, WM_CTLCOLORSTATIC, (WPARAM) hDC, (LPARAM) hwndStatic );
  1361. }
  1362. return hBrush;
  1363. }