home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / src / ccdata.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.4 KB  |  80 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFX_INIT_SEG
  14. #pragma code_seg(AFX_INIT_SEG)
  15. #endif
  16.  
  17. #if defined(_WIN32_WCE)
  18. #if !defined(_WIN32_WCE_NO_DELAYLOAD)
  19. #pragma comment(lib, "commctrl.lib")
  20. #endif // _WIN32_WCE_NO_DELAYLOAD
  21. #else // _WIN32_WCE
  22. #pragma comment(lib, "imagehlp.lib")
  23. #pragma comment(lib, "comctl32.lib")
  24. #pragma comment(lib, "shell32.lib")
  25. #pragma comment(lib, "comdlg32.lib")
  26. #pragma comment(lib, "winspool.lib")
  27. #pragma comment(lib, "advapi32.lib")
  28. #endif // _WIN32_WCE
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // AfxGetPropSheetFont
  32.  
  33. struct _AFX_PROPPAGEFONTINFO : public CNoTrackObject
  34. {
  35.     LPTSTR m_pszFaceName;
  36.     WORD m_wSize;
  37.     _AFX_PROPPAGEFONTINFO() : m_pszFaceName(NULL), m_wSize(0) {}
  38.     ~_AFX_PROPPAGEFONTINFO() { WCE_FCTN(GlobalFree)(m_pszFaceName); }
  39. };
  40.  
  41. PROCESS_LOCAL(_AFX_PROPPAGEFONTINFO, _afxPropPageFontInfo)
  42.  
  43. #define IDD_PROPSHEET   1006
  44. #define IDD_WIZARD      1020
  45.  
  46. BOOL AFXAPI AfxGetPropSheetFont(CString& strFace, WORD& wSize, BOOL bWizard)
  47. {
  48.     _AFX_PROPPAGEFONTINFO* pFontInfo = _afxPropPageFontInfo.GetData();
  49.  
  50.     // determine which font property sheet will use
  51.     if (pFontInfo->m_wSize == 0)
  52.     {
  53.         ASSERT(pFontInfo->m_pszFaceName == NULL);
  54.  
  55.         HINSTANCE hInst = WCE_FCTN(GetModuleHandleA)(WCE_IF("COMMCTRL.DLL","COMCTL32.DLL"));
  56.         if (hInst != NULL)
  57.         {
  58.             HRSRC hResource = ::FindResource(hInst,
  59.                 MAKEINTRESOURCE(bWizard ? IDD_WIZARD : IDD_PROPSHEET),
  60.                 RT_DIALOG);
  61.             HGLOBAL hTemplate = LoadResource(hInst, hResource);
  62.             if (hTemplate != NULL)
  63.                 CDialogTemplate::GetFont((DLGTEMPLATE*)hTemplate, strFace,
  64.                     wSize);
  65.         }
  66.  
  67.         pFontInfo->m_pszFaceName = (LPTSTR)WCE_FCTN(GlobalAlloc)(GPTR, sizeof(TCHAR) *
  68.             (strFace.GetLength() + 1));
  69.         lstrcpy(pFontInfo->m_pszFaceName, strFace);
  70.         pFontInfo->m_wSize = wSize;
  71.     }
  72.  
  73.     strFace = pFontInfo->m_pszFaceName;
  74.     wSize = pFontInfo->m_wSize;
  75.  
  76.     return (wSize != 0xFFFF);
  77. }
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80.