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.

720 lines
24 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. config.cpp
  5. Abstract:
  6. This module contains routines for the fax config dialog.
  7. Author:
  8. Wesley Witt (wesw) 13-Aug-1996
  9. Revision History:
  10. 20/10/99 -danl-
  11. Fix ConfigDlgProc to view proper printer properties.
  12. dd/mm/yy -author-
  13. description
  14. --*/
  15. #include "faxext.h"
  16. #include "faxutil.h"
  17. #include "faxreg.h"
  18. #include "resource.h"
  19. #include "debugex.h"
  20. extern HINSTANCE g_hModule; // DLL handle
  21. extern HINSTANCE g_hResource; // Resource DLL handle
  22. VOID
  23. AddCoverPagesToList(
  24. HWND hwndList,
  25. LPTSTR pDirPath,
  26. BOOL ServerCoverPage
  27. )
  28. /*++
  29. Routine Description:
  30. Add the cover page files in the specified directory to a listbox
  31. Arguments:
  32. hwndList - Handle to a list window
  33. pDirPath - Directory to look for coverpage files
  34. ServerCoverPage - TRUE if the dir contains server cover pages
  35. Return Value:
  36. NONE
  37. --*/
  38. {
  39. WIN32_FIND_DATA findData;
  40. TCHAR tszDirName[MAX_PATH] = {0};
  41. TCHAR CpName[MAX_PATH] = {0};
  42. HANDLE hFindFile = INVALID_HANDLE_VALUE;
  43. TCHAR tszFileName[MAX_PATH] = {0};
  44. TCHAR tszPathName[MAX_PATH] = {0};
  45. TCHAR* pPathEnd;
  46. LPTSTR pExtension;
  47. INT listIndex;
  48. INT dirLen;
  49. INT fileLen;
  50. BOOL bGotFile = FALSE;
  51. DBG_ENTER(TEXT("AddCoverPagesToList"));
  52. //
  53. // Copy the directory path to a local buffer
  54. //
  55. if (pDirPath == NULL || pDirPath[0] == 0)
  56. {
  57. return;
  58. }
  59. if ((dirLen = _tcslen( pDirPath )) >= MAX_PATH - MAX_FILENAME_EXT - 1)
  60. {
  61. return;
  62. }
  63. _tcscpy( tszDirName, pDirPath );
  64. TCHAR* pLast = NULL;
  65. pLast = _tcsrchr(tszDirName,TEXT('\\'));
  66. if( !( pLast && (*_tcsinc(pLast)) == '\0' ) )
  67. {
  68. // the last character is not a backslash, add one...
  69. _tcscat(tszDirName, TEXT("\\"));
  70. dirLen += sizeof(TCHAR);
  71. }
  72. _tcsncpy(tszPathName, tszDirName, ARR_SIZE(tszPathName)-1);
  73. pPathEnd = _tcschr(tszPathName, '\0');
  74. TCHAR file_to_find[MAX_PATH] = {0};
  75. _tcscpy(file_to_find,tszDirName);
  76. _tcscat(file_to_find, FAX_COVER_PAGE_MASK );
  77. //
  78. // Call FindFirstFile/FindNextFile to enumerate the files
  79. // matching our specification
  80. //
  81. hFindFile = FindFirstFile( file_to_find, &findData );
  82. if (hFindFile == INVALID_HANDLE_VALUE)
  83. {
  84. CALL_FAIL(GENERAL_ERR, TEXT("FindFirstFile"), ::GetLastError());
  85. bGotFile = FALSE;
  86. }
  87. else
  88. {
  89. bGotFile = TRUE;
  90. }
  91. while (bGotFile)
  92. {
  93. _tcsncpy(pPathEnd, findData.cFileName, MAX_PATH - dirLen);
  94. if(!IsValidCoverPage(tszPathName))
  95. {
  96. goto next;
  97. }
  98. //
  99. // Exclude directories and hidden files
  100. //
  101. if (findData.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY))
  102. {
  103. continue;
  104. }
  105. //
  106. // Make sure we have enough room to store the full pathname
  107. //
  108. if ((fileLen = _tcslen( findData.cFileName)) <= MAX_FILENAME_EXT )
  109. {
  110. continue;
  111. }
  112. if (fileLen + dirLen >= MAX_PATH)
  113. {
  114. continue;
  115. }
  116. //
  117. // Add the cover page name to the list window,
  118. // but don't display the filename extension
  119. //
  120. _tcscpy( CpName, findData.cFileName );
  121. if (pExtension = _tcsrchr(CpName,TEXT('.')))
  122. {
  123. *pExtension = NULL;
  124. }
  125. if ( ! ServerCoverPage )
  126. {
  127. TCHAR szPersonal[30];
  128. LoadString( g_hResource, IDS_PERSONAL, szPersonal, 30 );
  129. _tcscat( CpName, TEXT(" "));
  130. _tcscat( CpName, szPersonal );
  131. }
  132. listIndex = (INT)SendMessage(
  133. hwndList,
  134. LB_ADDSTRING,
  135. 0,
  136. (LPARAM) CpName);
  137. if (listIndex != LB_ERR)
  138. {
  139. SendMessage(hwndList,
  140. LB_SETITEMDATA,
  141. listIndex,
  142. ServerCoverPage ? SERVER_COVER_PAGE : 0);
  143. }
  144. next:
  145. bGotFile = FindNextFile(hFindFile, &findData);
  146. if (! bGotFile)
  147. {
  148. VERBOSE(DBG_MSG, TEXT("FindNextFile"), ::GetLastError());
  149. break;
  150. }
  151. }
  152. if(INVALID_HANDLE_VALUE != hFindFile)
  153. {
  154. FindClose(hFindFile);
  155. }
  156. }
  157. void EnableCoverPageList(HWND hDlg)
  158. {
  159. DBG_ENTER(TEXT("EnableCoverPageList"));
  160. if (IsDlgButtonChecked( hDlg, IDC_USE_COVERPAGE ) == BST_CHECKED)
  161. {
  162. EnableWindow( GetDlgItem( hDlg, IDC_COVERPAGE_LIST ), TRUE );
  163. EnableWindow( GetDlgItem( hDlg, IDC_STATIC_COVERPAGE ), TRUE );
  164. }
  165. else
  166. {
  167. EnableWindow( GetDlgItem( hDlg, IDC_COVERPAGE_LIST ), FALSE );
  168. EnableWindow( GetDlgItem( hDlg, IDC_STATIC_COVERPAGE ), FALSE );
  169. }
  170. }
  171. INT_PTR CALLBACK
  172. ConfigDlgProc(
  173. HWND hDlg,
  174. UINT message,
  175. WPARAM wParam,
  176. LPARAM lParam
  177. )
  178. /*++
  179. Routine Description:
  180. Dialog procedure for the fax mail transport configuration
  181. Arguments:
  182. hDlg - Window handle for this dialog
  183. message - Message number
  184. wParam - Parameter #1
  185. lParam - Parameter #2
  186. Return Value:
  187. TRUE - Message was handled
  188. FALSE - Message was NOT handled
  189. --*/
  190. {
  191. static PFAXXP_CONFIG FaxConfig = NULL;
  192. static HWND hwndListPrn = NULL;
  193. static HWND hwndListCov = NULL;
  194. PPRINTER_INFO_2 PrinterInfo = NULL;
  195. DWORD CountPrinters = 0;
  196. DWORD dwSelectedItem = 0;
  197. DWORD dwNewSelectedItem = 0;
  198. TCHAR Buffer [256] = {0};
  199. TCHAR CpDir[MAX_PATH] = {0};
  200. LPTSTR p = NULL;
  201. HANDLE hFax = NULL;
  202. DWORD dwError = 0;
  203. DWORD dwMask = 0;
  204. BOOL bShortCutCp = FALSE;
  205. BOOL bGotFaxPrinter = FALSE;
  206. BOOL bIsCpLink = FALSE;
  207. DBG_ENTER(TEXT("ConfigDlgProc"));
  208. switch( message )
  209. {
  210. case WM_INITDIALOG:
  211. FaxConfig = (PFAXXP_CONFIG) lParam;
  212. hwndListPrn = GetDlgItem( hDlg, IDC_PRINTER_LIST );
  213. hwndListCov = GetDlgItem( hDlg, IDC_COVERPAGE_LIST );
  214. //
  215. // populate the printers combobox
  216. //
  217. PrinterInfo = (PPRINTER_INFO_2) MyEnumPrinters(NULL,
  218. 2,
  219. &CountPrinters,
  220. PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS);
  221. if (NULL != PrinterInfo)
  222. {
  223. DWORD j = 0;
  224. for (DWORD i=0; i < CountPrinters; i++)
  225. {
  226. if ((NULL != PrinterInfo[i].pDriverName) &&
  227. (_tcscmp( PrinterInfo[i].pDriverName, FAX_DRIVER_NAME ) == 0))
  228. {
  229. //
  230. //if the current printer is a fax printer, add it to the CB list
  231. //
  232. bGotFaxPrinter = TRUE;
  233. SendMessage( hwndListPrn, CB_ADDSTRING, 0, (LPARAM) PrinterInfo[i].pPrinterName );
  234. if ((NULL != FaxConfig->PrinterName) &&
  235. (NULL != PrinterInfo[i].pPrinterName) &&
  236. (_tcscmp( PrinterInfo[i].pPrinterName, FaxConfig->PrinterName ) == 0))
  237. {
  238. //
  239. //if it is also the default printer according to transport config.
  240. //place the default selection on it
  241. //
  242. dwSelectedItem = j;
  243. }
  244. if(FaxConfig->PrinterName == NULL || _tcslen(FaxConfig->PrinterName) == 0)
  245. {
  246. //
  247. // There is no default fax printer
  248. // Choose the first one
  249. //
  250. MemFree(FaxConfig->PrinterName);
  251. FaxConfig->PrinterName = StringDup(PrinterInfo[i].pPrinterName);
  252. if(FaxConfig->PrinterName == NULL)
  253. {
  254. CALL_FAIL(MEM_ERR, TEXT("StringDup"), ERROR_NOT_ENOUGH_MEMORY);
  255. ErrorMsgBox(g_hResource, hDlg, IDS_NOT_ENOUGH_MEMORY);
  256. EndDialog( hDlg, IDABORT);
  257. return FALSE;
  258. }
  259. if(PrinterInfo[i].pServerName)
  260. {
  261. MemFree(FaxConfig->ServerName);
  262. FaxConfig->ServerName = StringDup(PrinterInfo[i].pServerName);
  263. if(FaxConfig->ServerName == NULL)
  264. {
  265. CALL_FAIL(MEM_ERR, TEXT("StringDup"), ERROR_NOT_ENOUGH_MEMORY);
  266. ErrorMsgBox(g_hResource, hDlg, IDS_NOT_ENOUGH_MEMORY);
  267. EndDialog( hDlg, IDABORT);
  268. return FALSE;
  269. }
  270. }
  271. dwSelectedItem = j;
  272. }
  273. j += 1;
  274. } // if fax printer
  275. } // for
  276. MemFree( PrinterInfo );
  277. PrinterInfo = NULL;
  278. SendMessage( hwndListPrn, CB_SETCURSEL, (WPARAM)dwSelectedItem, 0 );
  279. }
  280. if (! bGotFaxPrinter)
  281. {
  282. //
  283. // there were no printers at all, or non of the printers is a fax printer.
  284. //
  285. CALL_FAIL(GENERAL_ERR, TEXT("MyEnumPrinters"), ::GetLastError());
  286. ErrorMsgBox(g_hResource, hDlg, IDS_NO_FAX_PRINTER);
  287. EndDialog( hDlg, IDABORT);
  288. break;
  289. }
  290. //
  291. // Get the Server CP flag and receipts options
  292. //
  293. FaxConfig->ServerCpOnly = FALSE;
  294. if (FaxConnectFaxServer(FaxConfig->ServerName, &hFax) )
  295. {
  296. DWORD dwReceiptOptions;
  297. BOOL bEnableReceiptsCheckboxes = FALSE;
  298. if(!FaxGetPersonalCoverPagesOption(hFax, &FaxConfig->ServerCpOnly))
  299. {
  300. CALL_FAIL(GENERAL_ERR, TEXT("FaxGetPersonalCoverPagesOption"), ::GetLastError());
  301. ErrorMsgBox(g_hResource, hDlg, IDS_CANT_ACCESS_SERVER);
  302. }
  303. else
  304. {
  305. //
  306. // Inverse logic
  307. //
  308. FaxConfig->ServerCpOnly = !FaxConfig->ServerCpOnly;
  309. }
  310. if (!FaxGetReceiptsOptions (hFax, &dwReceiptOptions))
  311. {
  312. CALL_FAIL(GENERAL_ERR, TEXT("FaxGetPersonalCoverPagesOption"), GetLastError());
  313. }
  314. else
  315. {
  316. if (DRT_EMAIL & dwReceiptOptions)
  317. {
  318. //
  319. // Server supports receipts by email - enable the checkboxes
  320. //
  321. bEnableReceiptsCheckboxes = TRUE;
  322. }
  323. }
  324. EnableWindow( GetDlgItem( hDlg, IDC_ATTACH_FAX), bEnableReceiptsCheckboxes);
  325. EnableWindow( GetDlgItem( hDlg, IDC_SEND_SINGLE_RECEIPT), bEnableReceiptsCheckboxes);
  326. FaxClose(hFax);
  327. hFax = NULL;
  328. }
  329. else
  330. {
  331. CALL_FAIL(GENERAL_ERR, TEXT("FaxConnectFaxServer"), ::GetLastError())
  332. ErrorMsgBox(g_hResource, hDlg, IDS_CANT_ACCESS_SERVER);
  333. }
  334. //
  335. //send single receipt for a fax sent to multiple recipients?
  336. //
  337. if(FaxConfig->SendSingleReceipt)
  338. {
  339. CheckDlgButton( hDlg, IDC_SEND_SINGLE_RECEIPT, BST_CHECKED );
  340. }
  341. if (FaxConfig->bAttachFax)
  342. {
  343. CheckDlgButton( hDlg, IDC_ATTACH_FAX, BST_CHECKED );
  344. }
  345. //
  346. // cover page CB & LB enabling
  347. //
  348. if (FaxConfig->UseCoverPage)
  349. {
  350. CheckDlgButton( hDlg, IDC_USE_COVERPAGE, BST_CHECKED );
  351. }
  352. EnableCoverPageList(hDlg);
  353. //
  354. // Emulate printer's selection change, in order to collect printer config info.
  355. // including cover pages LB population
  356. //
  357. ConfigDlgProc(hDlg, WM_COMMAND,MAKEWPARAM(IDC_PRINTER_LIST,CBN_SELCHANGE),(LPARAM)0);
  358. break;
  359. case WM_COMMAND:
  360. if (HIWORD(wParam) == BN_CLICKED)
  361. {
  362. if (LOWORD(wParam) == IDC_USE_COVERPAGE)
  363. {
  364. EnableCoverPageList(hDlg);
  365. return FALSE;
  366. }
  367. }
  368. if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_PRINTER_LIST)
  369. {
  370. //
  371. // refresh cover pages list
  372. //
  373. TCHAR SelectedPrinter[MAX_PATH];
  374. DWORD dwPrinterNameLength = 0;
  375. //
  376. // a new fax printer was selected - delete all old coverpages from the list
  377. // because they might include the old fax server's cover pages
  378. //
  379. SendMessage(hwndListCov, LB_RESETCONTENT, 0, 0);
  380. if (CB_ERR != (dwSelectedItem =(DWORD)SendMessage( hwndListPrn, CB_GETCURSEL, 0, 0)))
  381. //
  382. // get the 0 based index of the currently pointed printer
  383. //
  384. {
  385. if (CB_ERR != (dwPrinterNameLength = (DWORD)SendMessage( hwndListPrn, CB_GETLBTEXTLEN, dwSelectedItem, 0)))
  386. {
  387. if (dwPrinterNameLength < MAX_PATH)
  388. {
  389. if (CB_ERR != SendMessage( hwndListPrn, CB_GETLBTEXT, dwSelectedItem, (LPARAM) SelectedPrinter ))
  390. //
  391. // get that printer's name into SelectedPrinter
  392. //
  393. {
  394. if(NULL != (PrinterInfo = (PPRINTER_INFO_2) MyGetPrinter( SelectedPrinter, 2 )))
  395. {
  396. LPTSTR lptszServerName = NULL;
  397. if (GetServerNameFromPrinterInfo(PrinterInfo,&lptszServerName))
  398. {
  399. if (GetServerCpDir( lptszServerName, CpDir, sizeof(CpDir)/sizeof(CpDir[0]) ))
  400. {
  401. AddCoverPagesToList( hwndListCov, CpDir, TRUE );
  402. }
  403. if ((NULL == FaxConfig->ServerName) || (NULL == lptszServerName) ||
  404. (_tcscmp(FaxConfig->ServerName,lptszServerName) != 0) )
  405. {
  406. //
  407. // the server's name and config are not updated - refresh them
  408. //
  409. MemFree(FaxConfig->ServerName);
  410. FaxConfig->ServerName = lptszServerName;
  411. FaxConfig->ServerCpOnly = FALSE;
  412. if (FaxConnectFaxServer(FaxConfig->ServerName,&hFax) )
  413. {
  414. DWORD dwReceiptOptions;
  415. BOOL bEnableReceiptsCheckboxes = FALSE;
  416. //
  417. // Get the new server's ServerCpOnly flag
  418. //
  419. if (!FaxGetPersonalCoverPagesOption(hFax,&FaxConfig->ServerCpOnly))
  420. {
  421. CALL_FAIL(GENERAL_ERR, TEXT("FaxGetPersonalCoverPagesOption"), GetLastError());
  422. }
  423. else
  424. {
  425. //
  426. // Inverse logic
  427. //
  428. FaxConfig->ServerCpOnly = !FaxConfig->ServerCpOnly;
  429. }
  430. if (!FaxGetReceiptsOptions (hFax, &dwReceiptOptions))
  431. {
  432. CALL_FAIL(GENERAL_ERR, TEXT("FaxGetPersonalCoverPagesOption"), GetLastError());
  433. }
  434. else
  435. {
  436. if (DRT_EMAIL & dwReceiptOptions)
  437. {
  438. //
  439. // Server supports receipts by email - enable the checkboxes
  440. //
  441. bEnableReceiptsCheckboxes = TRUE;
  442. }
  443. }
  444. EnableWindow( GetDlgItem( hDlg, IDC_ATTACH_FAX), bEnableReceiptsCheckboxes);
  445. EnableWindow( GetDlgItem( hDlg, IDC_SEND_SINGLE_RECEIPT), bEnableReceiptsCheckboxes);
  446. FaxClose(hFax);
  447. hFax = NULL;
  448. }
  449. }
  450. else
  451. //
  452. // the server's name hasn't changed, all details are OK
  453. //
  454. {
  455. MemFree(lptszServerName);
  456. lptszServerName = NULL;
  457. }
  458. }
  459. else
  460. //
  461. // GetServerNameFromPrinterInfo failed
  462. //
  463. {
  464. FaxConfig->ServerCpOnly = FALSE;
  465. }
  466. //
  467. // don't add client coverpages if FaxConfig->ServerCpOnly is set to true
  468. //
  469. if (!FaxConfig->ServerCpOnly)
  470. {
  471. if(GetClientCpDir( CpDir, sizeof(CpDir) / sizeof(CpDir[0])))
  472. {
  473. //
  474. // if the function failes- the ext. is installed on a machine
  475. // that doesn't have a client on it,
  476. // so we shouldn't look for personal cp
  477. //
  478. AddCoverPagesToList( hwndListCov, CpDir, FALSE );
  479. }
  480. }
  481. MemFree(PrinterInfo);
  482. PrinterInfo = NULL;
  483. //
  484. // check if we have any cp in the LB, if not- don't allow the user to
  485. // ask for a cp with he's fax
  486. //
  487. DWORD dwItemCount = (DWORD)SendMessage(hwndListCov, LB_GETCOUNT, NULL, NULL);
  488. if(LB_ERR == dwItemCount)
  489. {
  490. CALL_FAIL(GENERAL_ERR, TEXT("SendMessage (LB_GETCOUNT)"), ::GetLastError());
  491. }
  492. else
  493. {
  494. EnableWindow( GetDlgItem( hDlg, IDC_USE_COVERPAGE ), dwItemCount ? TRUE : FALSE );
  495. }
  496. if (FaxConfig->CoverPageName)
  497. {
  498. _tcscpy( Buffer, FaxConfig->CoverPageName );
  499. }
  500. if ( ! FaxConfig->ServerCoverPage )
  501. {
  502. TCHAR szPersonal[30] = _T("");
  503. LoadString( g_hResource, IDS_PERSONAL, szPersonal, 30 );
  504. _tcscat( Buffer, _T(" ") );
  505. _tcscat( Buffer, szPersonal );
  506. }
  507. dwSelectedItem = (DWORD)SendMessage( hwndListCov, LB_FINDSTRING, -1, (LPARAM) Buffer );
  508. //
  509. // get the index of the default CP
  510. //
  511. if (dwSelectedItem == LB_ERR)
  512. {
  513. dwSelectedItem = 0;
  514. }
  515. SendMessage( hwndListCov, LB_SETCURSEL, (WPARAM) dwSelectedItem, 0 );
  516. //
  517. // place the default selection on that CP
  518. //
  519. }
  520. }
  521. }
  522. }
  523. }
  524. break;
  525. }
  526. switch (wParam)
  527. {
  528. case IDOK :
  529. //
  530. // Update UseCoverPage
  531. //
  532. FaxConfig->UseCoverPage = (IsDlgButtonChecked( hDlg, IDC_USE_COVERPAGE ) == BST_CHECKED);
  533. //
  534. // Update SendSingleReceipt
  535. //
  536. FaxConfig->SendSingleReceipt = (IsDlgButtonChecked(hDlg, IDC_SEND_SINGLE_RECEIPT) == BST_CHECKED);
  537. FaxConfig->bAttachFax = (IsDlgButtonChecked(hDlg, IDC_ATTACH_FAX) == BST_CHECKED);
  538. //
  539. // Update selected printer
  540. //
  541. dwSelectedItem = (DWORD)SendMessage( hwndListPrn, CB_GETCURSEL, 0, 0 );
  542. if (dwSelectedItem != LB_ERR)
  543. {
  544. if (LB_ERR != SendMessage( hwndListPrn, CB_GETLBTEXT, dwSelectedItem, (LPARAM) Buffer ))/***/
  545. {
  546. MemFree( FaxConfig->PrinterName );
  547. FaxConfig->PrinterName = StringDup( Buffer );
  548. if(!FaxConfig->PrinterName)
  549. {
  550. CALL_FAIL(MEM_ERR, TEXT("StringDup"), ERROR_NOT_ENOUGH_MEMORY);
  551. ErrorMsgBox(g_hResource, hDlg, IDS_NOT_ENOUGH_MEMORY);
  552. EndDialog( hDlg, IDABORT);
  553. return FALSE;
  554. }
  555. }
  556. }
  557. //
  558. // Update cover page
  559. //
  560. dwSelectedItem = (DWORD)SendMessage( hwndListCov, LB_GETCURSEL, 0, 0 );
  561. if (dwSelectedItem != LB_ERR)// LB_ERR when no items in list
  562. {
  563. if (LB_ERR != SendMessage( hwndListCov, LB_GETTEXT, dwSelectedItem, (LPARAM) Buffer ))
  564. //
  565. // get the selected CP name into the buffer
  566. //
  567. {
  568. dwMask = (DWORD)SendMessage( hwndListCov, LB_GETITEMDATA, dwSelectedItem, 0 );
  569. if (dwMask != LB_ERR)
  570. {
  571. FaxConfig->ServerCoverPage = (dwMask & SERVER_COVER_PAGE) == SERVER_COVER_PAGE;
  572. if (!FaxConfig->ServerCoverPage)
  573. {
  574. //
  575. // if the selected CP in the LB is not a server's CP
  576. // Omit the suffix: "(personal)"
  577. //
  578. p = _tcsrchr( Buffer, '(' );
  579. Assert(p);
  580. if( p )
  581. {
  582. p = _tcsdec(Buffer,p);
  583. if( p )
  584. {
  585. _tcsnset(p,TEXT('\0'),1);
  586. }
  587. }
  588. }
  589. }
  590. //
  591. // update CP name to the selected one in the LB
  592. //
  593. MemFree( FaxConfig->CoverPageName );
  594. FaxConfig->CoverPageName = StringDup( Buffer );
  595. if(!FaxConfig->CoverPageName)
  596. {
  597. CALL_FAIL(MEM_ERR, TEXT("StringDup"), ERROR_NOT_ENOUGH_MEMORY);
  598. ErrorMsgBox(g_hResource, hDlg, IDS_NOT_ENOUGH_MEMORY);
  599. EndDialog( hDlg, IDABORT);
  600. return FALSE;
  601. }
  602. }
  603. }
  604. EndDialog( hDlg, IDOK );
  605. break;
  606. case IDCANCEL:
  607. EndDialog( hDlg, IDCANCEL );
  608. break;
  609. }
  610. break;
  611. case WM_HELP:
  612. WinHelpContextPopup(((LPHELPINFO)lParam)->dwContextId, hDlg);
  613. return TRUE;
  614. case WM_CONTEXTMENU:
  615. WinHelpContextPopup(GetWindowContextHelpId((HWND)wParam), hDlg);
  616. return TRUE;
  617. }
  618. return FALSE;
  619. }