Leaked source code of windows server 2003
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.

871 lines
21 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : ppFaxServerLogging.cpp //
  3. // //
  4. // DESCRIPTION : prop pages of //
  5. // //
  6. // AUTHOR : yossg //
  7. // //
  8. // HISTORY : //
  9. // Oct 25 1999 yossg created //
  10. // Nov 3 1999 yossg OnInitDialog, SetProps //
  11. // Nov 15 1999 yossg Call RPC func //
  12. // Nov 24 1999 yossg OnApply create call to all tabs from parent //
  13. // Dec 10 2000 yossg Update Windows XP //
  14. // //
  15. // Copyright (C) 1999 Microsoft Corporation All Rights Reserved //
  16. // //
  17. /////////////////////////////////////////////////////////////////////////////
  18. #include "stdafx.h"
  19. #include "MSFxsSnp.h"
  20. #include "ppFaxServerLogging.h"
  21. #include "FaxServer.h"
  22. #include "FaxServerNode.h"
  23. #include "FxsValid.h"
  24. #include "dlgutils.h"
  25. #ifdef _DEBUG
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. //
  30. // Constructor
  31. //
  32. CppFaxServerLogging::CppFaxServerLogging(
  33. LONG_PTR hNotificationHandle,
  34. CSnapInItem *pNode,
  35. BOOL fIsLocalServer,
  36. HINSTANCE hInst)
  37. : CPropertyPageExImpl<CppFaxServerLogging>(pNode, NULL)
  38. {
  39. m_pParentNode = static_cast <CFaxServerNode *> (pNode);
  40. m_pFaxActLogConfig = NULL;
  41. m_fIsDialogInitiated = FALSE;
  42. m_fIsDirty = FALSE;
  43. m_fIsLocalServer = fIsLocalServer;
  44. }
  45. //
  46. // Destructor
  47. //
  48. CppFaxServerLogging::~CppFaxServerLogging()
  49. {
  50. if (NULL != m_pFaxActLogConfig)
  51. {
  52. FaxFreeBuffer( m_pFaxActLogConfig );
  53. }
  54. }
  55. //////////////////////////////////////////////////////////////////////////////
  56. // CppFaxServerLogging message handlers
  57. /*
  58. - CppFaxServerLogging::InitRPC
  59. -
  60. * Purpose:
  61. * Initiates the configuration structure from RPC get Call.
  62. *
  63. * Arguments:
  64. *
  65. * Return:
  66. * OLE error code
  67. */
  68. HRESULT CppFaxServerLogging::InitRPC( )
  69. {
  70. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::InitRPC"));
  71. HRESULT hRc = S_OK;
  72. DWORD ec = ERROR_SUCCESS;
  73. //
  74. // get RPC Handle
  75. //
  76. if (!m_pFaxServer->GetFaxServerHandle())
  77. {
  78. ec= GetLastError();
  79. DebugPrintEx(
  80. DEBUG_ERR,
  81. _T("Failed to GetFaxServerHandle. (ec: %ld)"),
  82. ec);
  83. goto Error;
  84. }
  85. //
  86. // Retrieve the fax activity logging configuration structure
  87. //
  88. if (!FaxGetActivityLoggingConfiguration(m_pFaxServer->GetFaxServerHandle(),
  89. &m_pFaxActLogConfig))
  90. {
  91. ec = GetLastError();
  92. DebugPrintEx(
  93. DEBUG_ERR,
  94. _T("Fail to get Activity logging configuration. (ec: %ld)"),
  95. ec);
  96. if (IsNetworkError(ec))
  97. {
  98. DebugPrintEx(
  99. DEBUG_ERR,
  100. _T("Network Error was found. (ec: %ld)"),
  101. ec);
  102. m_pFaxServer->Disconnect();
  103. }
  104. goto Error;
  105. }
  106. //For max verification
  107. ATLASSERT(m_pFaxActLogConfig);
  108. m_bstrLastGoodFolder = m_pFaxActLogConfig->lptstrDBPath ? m_pFaxActLogConfig->lptstrDBPath : TEXT("");
  109. if (!m_bstrLastGoodFolder)
  110. {
  111. DebugPrintEx(
  112. DEBUG_ERR,
  113. TEXT("Failed to allocate string (m_bstrLastGoodFolder)."));
  114. ec = ERROR_OUTOFMEMORY;
  115. goto Error;
  116. }
  117. ATLASSERT(ERROR_SUCCESS == ec);
  118. DebugPrintEx( DEBUG_MSG,
  119. _T("Succeed to get acitivity logging configuration."));
  120. goto Exit;
  121. Error:
  122. ATLASSERT(ERROR_SUCCESS != ec);
  123. hRc = HRESULT_FROM_WIN32(ec);
  124. ATLASSERT(NULL != m_pParentNode);
  125. m_pParentNode->NodeMsgBox(GetFaxServerErrorMsg(ec));
  126. Exit:
  127. return (hRc);
  128. }
  129. /*
  130. - CppFaxServerLogging::OnInitDialog
  131. -
  132. * Purpose:
  133. * Initiates all controls when dialog is called.
  134. *
  135. * Arguments:
  136. *
  137. * Return:
  138. * OLE error code
  139. */
  140. LRESULT CppFaxServerLogging::OnInitDialog( UINT uiMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled )
  141. {
  142. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::PageInitDialog"));
  143. UNREFERENCED_PARAMETER( uiMsg );
  144. UNREFERENCED_PARAMETER( wParam );
  145. UNREFERENCED_PARAMETER( lParam );
  146. UNREFERENCED_PARAMETER( fHandled );
  147. BOOL fToCheck;
  148. UINT CheckState1;
  149. UINT CheckState2;
  150. //
  151. // Attach & limit length
  152. //
  153. m_LogFileBox.Attach(GetDlgItem(IDC_LOG_FILE_EDIT));
  154. m_LogFileBox.SetLimitText(MAX_DIR_PATH);
  155. SHAutoComplete (GetDlgItem(IDC_LOG_FILE_EDIT), SHACF_FILESYSTEM);
  156. //
  157. // init controls
  158. //
  159. ATLASSERT(NULL != m_pFaxActLogConfig);
  160. //
  161. // To-log activity checkboxes
  162. //
  163. fToCheck = m_pFaxActLogConfig->bLogIncoming;
  164. CheckState1 = (fToCheck) ? BST_CHECKED : BST_UNCHECKED;
  165. CheckDlgButton(IDC_INCOMING_LOG_CHECK, CheckState1);
  166. fToCheck = m_pFaxActLogConfig->bLogOutgoing;
  167. CheckState2 = (fToCheck) ? BST_CHECKED : BST_UNCHECKED;
  168. CheckDlgButton(IDC_OUTGOING_LOG_CHECK, CheckState2);
  169. //
  170. // Log file address
  171. //
  172. m_LogFileBox.SetWindowText(m_pFaxActLogConfig->lptstrDBPath ? m_pFaxActLogConfig->lptstrDBPath : TEXT(""));
  173. //
  174. // Inactivate m_LogFileBox
  175. //
  176. if ( !(CheckState1 || CheckState2) )
  177. {
  178. EnableDataBasePath(FALSE);
  179. }
  180. else
  181. {
  182. EnableDataBasePath(TRUE); // To check IsLocalServer for Browse button
  183. }
  184. m_fIsDialogInitiated = TRUE;
  185. return(1);
  186. }
  187. /*
  188. - CppFaxServerLogging::SetProps
  189. -
  190. * Purpose:
  191. * Sets properties on apply.
  192. *
  193. * Arguments:
  194. * IN pCtrlFocus - focus pointer (int)
  195. *
  196. * Return:
  197. * OLE error code
  198. */
  199. HRESULT CppFaxServerLogging::SetProps(int *pCtrlFocus)
  200. {
  201. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::SetProps"));
  202. HRESULT hRc = S_OK;
  203. DWORD ec = ERROR_SUCCESS;
  204. BOOL fSkipMessage = FALSE;
  205. CComBSTR bstrLogFile;
  206. UINT uRetIDS = 0;
  207. FAX_ACTIVITY_LOGGING_CONFIG FaxActLogConfig;
  208. HINSTANCE hInst = _Module.GetResourceInstance();
  209. //
  210. // Collect all data and init the structure's fields
  211. // uses Copy() to copy and also allocate before
  212. //
  213. ZeroMemory (&FaxActLogConfig, sizeof(FAX_ACTIVITY_LOGGING_CONFIG));
  214. //
  215. // Size of struct.
  216. //
  217. FaxActLogConfig.dwSizeOfStruct = sizeof(FAX_ACTIVITY_LOGGING_CONFIG);
  218. //
  219. // To log incoming activity
  220. //
  221. if (IsDlgButtonChecked(IDC_INCOMING_LOG_CHECK) == BST_CHECKED)
  222. {
  223. FaxActLogConfig.bLogIncoming = TRUE;
  224. }
  225. else
  226. {
  227. FaxActLogConfig.bLogIncoming = FALSE;
  228. }
  229. //
  230. // To log outgoing activity
  231. //
  232. if (IsDlgButtonChecked(IDC_OUTGOING_LOG_CHECK) == BST_CHECKED)
  233. {
  234. FaxActLogConfig.bLogOutgoing = TRUE;
  235. }
  236. else
  237. {
  238. FaxActLogConfig.bLogOutgoing = FALSE;
  239. }
  240. if ( FaxActLogConfig.bLogIncoming || FaxActLogConfig.bLogOutgoing )
  241. {
  242. //
  243. // Log file
  244. //
  245. if ( !m_LogFileBox.GetWindowText(&bstrLogFile) )
  246. {
  247. *pCtrlFocus = IDC_LOG_FILE_EDIT;
  248. DebugPrintEx(
  249. DEBUG_ERR,
  250. TEXT("Failed to GetWindowText(&bstrLogFile)"));
  251. }
  252. if (!IsNotEmptyString(bstrLogFile))
  253. {
  254. DebugPrintEx( DEBUG_ERR,
  255. _T("Log file path string empty or spaces only."));
  256. uRetIDS = IDS_LOG_PATH_EMPTY;
  257. *pCtrlFocus = IDC_LOG_FILE_EDIT;
  258. goto Error;
  259. }
  260. FaxActLogConfig.lptstrDBPath = bstrLogFile;
  261. //
  262. // follow-up for an OnApply following submition
  263. // with both unchecked IDC_OUTGOING_LOG_CHECK and IDC_INCOMING_LOG_CHECK
  264. //
  265. m_bstrLastGoodFolder = bstrLogFile;
  266. if (!m_bstrLastGoodFolder)
  267. {
  268. *pCtrlFocus = IDC_LOG_FILE_EDIT;
  269. DebugPrintEx(
  270. DEBUG_ERR,
  271. TEXT("Failed to allocate string (m_bstrLastGoodFolder)."));
  272. ec = ERROR_OUTOFMEMORY;
  273. goto Error;
  274. }
  275. }
  276. else
  277. {
  278. FaxActLogConfig.lptstrDBPath = m_bstrLastGoodFolder;
  279. }
  280. //
  281. // get RPC Handle
  282. //
  283. if (!m_pFaxServer->GetFaxServerHandle())
  284. {
  285. ec= GetLastError();
  286. DebugPrintEx(
  287. DEBUG_ERR,
  288. _T("Failed to GetFaxServerHandle. (ec: %ld)"),
  289. ec);
  290. goto Error;
  291. }
  292. //
  293. // Set Config
  294. //
  295. if (!FaxSetActivityLoggingConfiguration(m_pFaxServer->GetFaxServerHandle(),
  296. &FaxActLogConfig))
  297. {
  298. ec = GetLastError();
  299. DebugPrintEx(DEBUG_ERR, _T("Fail to Set Activity Logging configuration. (ec: %ld)"), ec);
  300. //
  301. // Try to adjust folder
  302. //
  303. PropSheet_SetCurSelByID( GetParent(), IDD);
  304. GotoDlgCtrl(GetDlgItem(IDC_LOG_FILE_EDIT));
  305. ec = AskUserAndAdjustFaxFolder(m_hWnd,
  306. m_pFaxServer->GetServerName(),
  307. FaxActLogConfig.lptstrDBPath,
  308. ec);
  309. if(ERROR_SUCCESS != ec)
  310. {
  311. if(ERROR_BAD_PATHNAME == ec)
  312. {
  313. //
  314. // The error message has been shown by AskUserAndAdjustFaxFolder
  315. //
  316. fSkipMessage = TRUE;
  317. }
  318. goto Error;
  319. }
  320. //
  321. // The folder has been adjusted, set it again
  322. //
  323. if (!FaxSetActivityLoggingConfiguration(m_pFaxServer->GetFaxServerHandle(),
  324. &FaxActLogConfig))
  325. {
  326. ec = GetLastError();
  327. DebugPrintEx(DEBUG_ERR, _T("Fail to Set Activity Logging configuration. (ec: %ld)"), ec);
  328. goto Error;
  329. }
  330. }
  331. ATLASSERT(S_OK == hRc);
  332. m_fIsDirty = FALSE;
  333. DebugPrintEx(DEBUG_MSG, _T("Succeed to set Activity Logging configuration."));
  334. return hRc;
  335. Error:
  336. ATLASSERT(ERROR_SUCCESS != ec);
  337. hRc = HRESULT_FROM_WIN32(ec);
  338. DWORD dwIDS = 0;
  339. switch (ec)
  340. {
  341. case ERROR_DISK_FULL:
  342. DebugPrintEx( DEBUG_ERR, _T("ERROR_DISK_FULL == ec"));
  343. dwIDS = IDS_LOGGING_ERROR_DISK_FULL;
  344. break;
  345. case FAX_ERR_FILE_ACCESS_DENIED:
  346. DebugPrintEx( DEBUG_ERR, _T("FAX_ERR_FILE_ACCESS_DENIED == ec"));
  347. dwIDS = IDS_LOGGING_FAX_ERR_FILE_ACCESS_DENIED;
  348. break;
  349. default:
  350. dwIDS = GetFaxServerErrorMsg(ec);
  351. break;
  352. }
  353. if (dwIDS && !fSkipMessage)
  354. {
  355. PropSheet_SetCurSelByID( GetParent(), IDD);
  356. ATLASSERT(::IsWindow(m_hWnd));
  357. PageError(dwIDS, m_hWnd);
  358. }
  359. if (IsNetworkError(ec))
  360. {
  361. DebugPrintEx(DEBUG_ERR, _T("Network Error was found. (ec: %ld)"), ec);
  362. m_pFaxServer->Disconnect();
  363. }
  364. return hRc;
  365. }
  366. /*
  367. - CppFaxServerLogging::PreApply
  368. -
  369. * Purpose:
  370. * Checks properties before apply.
  371. *
  372. * Arguments:
  373. *
  374. * Return:
  375. * OLE error code
  376. */
  377. HRESULT CppFaxServerLogging::PreApply(int *pCtrlFocus, UINT * puIds)
  378. {
  379. HRESULT hRc = S_OK;
  380. //
  381. // PreApply Checks
  382. //
  383. if (!AllReadyToApply(/*fSilent =*/ FALSE, pCtrlFocus , puIds))
  384. {
  385. SetModified(FALSE);
  386. hRc = E_FAIL ;
  387. }
  388. else
  389. {
  390. SetModified(TRUE);
  391. }
  392. return(hRc);
  393. }
  394. /*
  395. - CppFaxServerLogging::OnApply
  396. -
  397. * Purpose:
  398. * Calls PreApply and SetProp to Apply changes.
  399. *
  400. * Arguments:
  401. *
  402. * Return:
  403. * TRUE or FALSE
  404. */
  405. BOOL CppFaxServerLogging::OnApply()
  406. {
  407. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::OnApply"));
  408. HRESULT hRc = S_OK;
  409. int CtrlFocus = 0;
  410. UINT uIds = 0;
  411. if (!m_fIsDirty)
  412. {
  413. return TRUE;
  414. }
  415. hRc = PreApply(&CtrlFocus, &uIds);
  416. if (FAILED(hRc))
  417. {
  418. if (PropSheet_SetCurSelByID( GetParent(), IDD) )
  419. {
  420. PageError(uIds, m_hWnd, _Module.GetResourceInstance());
  421. if (CtrlFocus)
  422. {
  423. GotoDlgCtrl(GetDlgItem(CtrlFocus));
  424. }
  425. }
  426. return FALSE;
  427. }
  428. else //(Succeeded(hRc))
  429. {
  430. hRc = SetProps(&CtrlFocus);
  431. if (FAILED(hRc))
  432. {
  433. //Error Msg by called func.
  434. if (CtrlFocus)
  435. {
  436. GotoDlgCtrl(GetDlgItem(CtrlFocus));
  437. }
  438. return FALSE;
  439. }
  440. else //(Succeeded(hRc))
  441. {
  442. return TRUE;
  443. }
  444. }
  445. }
  446. /*
  447. + Routine Description:
  448. +
  449. * Browse for a directory
  450. *
  451. * Arguments:
  452. *
  453. * hwndDlg - Specifies the dialog window on which the Browse button is displayed
  454. *
  455. * Return Value:
  456. *
  457. * TRUE if successful, FALSE if the user presses Cancel
  458. -
  459. -
  460. */
  461. BOOL
  462. CppFaxServerLogging::BrowseForFile( WORD wNotifyCode, WORD wID, HWND hwndDlg, BOOL& bHandled )
  463. {
  464. UNREFERENCED_PARAMETER( wNotifyCode );
  465. UNREFERENCED_PARAMETER( wID );
  466. UNREFERENCED_PARAMETER( hwndDlg );
  467. UNREFERENCED_PARAMETER( bHandled );
  468. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::BrowseForFile"));
  469. BOOL fResult = FALSE;
  470. WCHAR szBrowseFile[MAX_PATH]={0};
  471. WCHAR szBrowseDlgTitle[FXS_MAX_TITLE_LEN];
  472. CComBSTR bstrOldPath;
  473. unsigned int len;
  474. unsigned long ulBrowseFlags;
  475. //
  476. // Collecting the browse dialog headline
  477. //
  478. if (!LoadString( _Module.GetResourceInstance(),
  479. IDS_GET_LOG_FILE,
  480. szBrowseDlgTitle,
  481. FXS_MAX_TITLE_LEN))
  482. {
  483. DWORD ec;
  484. ec = GetLastError();
  485. if (ec == ERROR_NOT_ENOUGH_MEMORY)
  486. {
  487. DebugPrintEx(
  488. DEBUG_ERR,
  489. _T("Out of Memory - fail to load string."));
  490. DlgMsgBox(this, IDS_MEMORY);
  491. return fResult;
  492. }
  493. DebugPrintEx(
  494. DEBUG_ERR,
  495. _T("Failed to load titile string - unexpected behavior."));
  496. szBrowseDlgTitle[0] = 0;
  497. }
  498. //
  499. // Collecting the old path from the calling dialog edit box
  500. //
  501. if(! GetDlgItemText( IDC_LOG_FILE_EDIT, bstrOldPath.m_str))
  502. {
  503. DebugPrintEx(
  504. DEBUG_ERR,
  505. _T("Failed to collect old path from the property page edit box."));
  506. szBrowseFile[0] = 0;
  507. }
  508. else
  509. {
  510. len = bstrOldPath.Length();
  511. if ( len > MAX_PATH )
  512. {
  513. DebugPrintEx(
  514. DEBUG_ERR,
  515. _T("Old Path Length is bigger then alowed maximal path."));
  516. szBrowseFile[0] = 0;
  517. }
  518. else
  519. {
  520. wcsncpy(szBrowseFile, bstrOldPath, ARR_SIZE(szBrowseFile)-1);
  521. }
  522. }
  523. //
  524. // Preparing the browse dialog style flags.
  525. //
  526. ulBrowseFlags = BIF_BROWSEINCLUDEFILES | //the files also flag
  527. BIF_STATUSTEXT |
  528. BIF_NEWDIALOGSTYLE |
  529. BIF_NONEWFOLDERBUTTON |
  530. BIF_VALIDATE;
  531. //
  532. // Invoke the browse dialog with a function based on
  533. // Shell functions.
  534. //
  535. if (InvokeBrowseDialog(szBrowseFile,
  536. MAX_DIR_PATH,
  537. szBrowseDlgTitle,
  538. ulBrowseFlags,
  539. this))
  540. {
  541. SetDlgItemText(IDC_LOG_FILE_EDIT, szBrowseFile);
  542. fResult = TRUE;
  543. }
  544. return fResult;
  545. }
  546. /*
  547. - CppFaxServerLogging::SetApplyButton
  548. -
  549. * Purpose:
  550. * Modify Apply buttton.
  551. *
  552. * Arguments:
  553. *
  554. * Return:
  555. * 1
  556. */
  557. LRESULT CppFaxServerLogging::SetApplyButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  558. {
  559. if (!m_fIsDialogInitiated) //event receieved in too early stage
  560. {
  561. return 0;
  562. }
  563. else
  564. {
  565. m_fIsDirty = TRUE;
  566. }
  567. SetModified(TRUE);
  568. bHandled = TRUE;
  569. return(1);
  570. }
  571. /*
  572. - CppFaxServerLogging::OnCheckboxClicked
  573. -
  574. * Purpose:
  575. * Gray/Ungray controls
  576. * Enable apply button.
  577. *
  578. * Arguments:
  579. *
  580. * Return:
  581. * 1
  582. */
  583. LRESULT CppFaxServerLogging::OnCheckboxClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  584. {
  585. BOOL fActivate = FALSE;
  586. if (!m_fIsDialogInitiated) //event receieved in too early stage
  587. {
  588. return 1;
  589. }
  590. else
  591. {
  592. m_fIsDirty = TRUE;
  593. }
  594. if (
  595. BST_CHECKED == IsDlgButtonChecked(IDC_INCOMING_LOG_CHECK)
  596. ||
  597. BST_CHECKED == IsDlgButtonChecked(IDC_OUTGOING_LOG_CHECK)
  598. )
  599. {
  600. if (AllReadyToApply(TRUE))
  601. {
  602. SetModified(TRUE);
  603. }
  604. else
  605. {
  606. SetModified(FALSE);
  607. }
  608. fActivate = TRUE;
  609. }
  610. else
  611. {
  612. SetModified(TRUE);
  613. }
  614. EnableDataBasePath(fActivate);
  615. return(1);
  616. }
  617. /*
  618. - CppFaxServerLogging::OnCheckboxClicked
  619. -
  620. * Purpose:
  621. * Gray/Ungray controls
  622. * Enable apply button.
  623. *
  624. * Arguments:
  625. *
  626. * Return:
  627. * 1
  628. */
  629. LRESULT CppFaxServerLogging::OnTextChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  630. {
  631. BOOL fActivate = FALSE;
  632. if (!m_fIsDialogInitiated) //event receieved in too early stage
  633. {
  634. return 1;
  635. }
  636. else
  637. {
  638. m_fIsDirty = TRUE;
  639. }
  640. if (AllReadyToApply(TRUE))
  641. {
  642. SetModified(TRUE);
  643. }
  644. else
  645. {
  646. SetModified(FALSE);
  647. }
  648. return(1);
  649. }
  650. /*
  651. - CppFaxServerLogging::AllReadyToApply
  652. -
  653. * Purpose:
  654. * This function validate that no zero length strings
  655. * are found data areas that should be saved.
  656. *
  657. * Arguments:
  658. * [in] fSilent - boolean who defines if to pop up messages (FALSE)
  659. * or not.(TRUE)
  660. *
  661. * Return:
  662. * BOOOLEAN
  663. */
  664. BOOL CppFaxServerLogging::AllReadyToApply(BOOL fSilent, int *pCtrlFocus, UINT *pIds)
  665. {
  666. DEBUG_FUNCTION_NAME( _T("CppFaxServerLogging::AllReadyToApply"));
  667. DWORD ec = ERROR_SUCCESS;
  668. if (
  669. BST_CHECKED == IsDlgButtonChecked(IDC_INCOMING_LOG_CHECK)
  670. ||
  671. BST_CHECKED == IsDlgButtonChecked(IDC_OUTGOING_LOG_CHECK)
  672. )
  673. {
  674. if ( !m_LogFileBox.GetWindowTextLength() )
  675. {
  676. ec = GetLastError();
  677. DebugPrintEx(
  678. DEBUG_ERR,
  679. _T("Zero text length - m_LogFileBox. (ec: %ld)"),
  680. ec);
  681. if (!fSilent)
  682. {
  683. *pCtrlFocus = IDC_LOG_FILE_EDIT;
  684. *pIds = IDS_LOG_PATH_EMPTY;
  685. }
  686. return FALSE;
  687. }
  688. }
  689. ATLASSERT(ERROR_SUCCESS == ec);
  690. //
  691. // Cheers!
  692. // ...every thing ready to apply now.
  693. //
  694. return TRUE;
  695. }
  696. /*
  697. - CppFaxServerLogging::EnableDataBasePath
  698. -
  699. * Purpose:
  700. * Enable/dissable the data base path controls.
  701. *
  702. * Arguments:
  703. * [in] state - boolean value to enable TRUE or FALSE to disable
  704. *
  705. * Return:
  706. * void
  707. */
  708. void CppFaxServerLogging::EnableDataBasePath(BOOL fState)
  709. {
  710. ::EnableWindow(GetDlgItem(IDC_LOG_FILE_EDIT), fState);
  711. ::EnableWindow(GetDlgItem(IDC_LOG_BROWSE_BUTTON), fState && m_fIsLocalServer);
  712. ::EnableWindow(GetDlgItem(IDC_DATABASE_FSTATIC), fState);
  713. }
  714. //////////////////////////////////////////////////////////////////////////////
  715. /*++
  716. CppFaxServerLogging::OnHelpRequest
  717. This is called in response to the WM_HELP Notify
  718. message and to the WM_CONTEXTMENU Notify message.
  719. WM_HELP Notify message.
  720. This message is sent when the user presses F1 or <Shift>-F1
  721. over an item or when the user clicks on the ? icon and then
  722. presses the mouse over an item.
  723. WM_CONTEXTMENU Notify message.
  724. This message is sent when the user right clicks over an item
  725. and then clicks "What's this?"
  726. --*/
  727. /////////////////////////////////////////////////////////////////////////////
  728. LRESULT
  729. CppFaxServerLogging::OnHelpRequest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
  730. {
  731. DEBUG_FUNCTION_NAME(_T("CppFaxServerLogging::OnHelpRequest"));
  732. switch (uMsg)
  733. {
  734. case WM_HELP:
  735. WinContextHelp(((LPHELPINFO)lParam)->dwContextId, m_hWnd);
  736. break;
  737. case WM_CONTEXTMENU:
  738. WinContextHelp(::GetWindowContextHelpId((HWND)wParam), m_hWnd);
  739. break;
  740. }
  741. return TRUE;
  742. }
  743. /////////////////////////////////////////////////////////////////////////////