home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / Epoc / Palmtime / files / FrotzCE2_src.ZIP / FrotzCE / About.cpp next >
Encoding:
C/C++ Source or Header  |  1997-09-11  |  2.1 KB  |  94 lines

  1. #include "stdafx.h"
  2. #include "FrotzCE.h"
  3. #include "About.h"
  4. #include "MainFrm.h"
  5.  
  6. extern "C"
  7. {
  8. #include "Frotz/Frotz.h"
  9. }
  10.  
  11. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  12. {
  13.     //{{AFX_DATA_INIT(CAboutDlg)
  14.     //}}AFX_DATA_INIT
  15. }
  16.  
  17. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  18. {
  19.     CDialog::DoDataExchange(pDX);
  20.     //{{AFX_DATA_MAP(CAboutDlg)
  21.     //}}AFX_DATA_MAP
  22. }
  23.  
  24. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  25.     //{{AFX_MSG_MAP(CAboutDlg)
  26.         // No message handlers
  27.     //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CFrotzCEApp commands
  32.  
  33. BOOL CAboutDlg::OnInitDialog() 
  34. {
  35. CString strStoryInfo;
  36.  
  37.     CDialog::OnInitDialog();
  38.     
  39.     // Z Machine running?
  40.     if (FROTZCEAPP->m_bZmachineRunning)
  41.     {
  42.     CString strRelease;
  43.  
  44.         // Get story name
  45.         MAINFRAME->GetWindowText( strStoryInfo );
  46.         // Unrecognised story?
  47.         if (strStoryInfo == TEXT("FrotzCE"))
  48.         {
  49.             // Use file name
  50.             strStoryInfo = TEXT( "Story: " );
  51.             strStoryInfo += FROTZCEAPP->m_achStoryFile;
  52.  
  53.             for (int nPos = strStoryInfo.GetLength()-1; nPos >= 0; nPos--)
  54.             {
  55.                 // Found beginning of file name?    
  56.                 if (strStoryInfo[nPos] == _T('\\') || strStoryInfo[nPos] == _T('/'))
  57.                 {
  58.                 int nDotPos;
  59.  
  60.                     // Save file name
  61.                     strStoryInfo = strStoryInfo.Mid( nPos + 1 );
  62.                     // Remove extension
  63.                     if ((nDotPos = strStoryInfo.Find( _T('.') )) != -1)
  64.                         strStoryInfo = strStoryInfo.Left( nDotPos + 1 );
  65.  
  66.                     break;
  67.                 }
  68.             }
  69.         }
  70.         strStoryInfo = TEXT( "Story: " ) + strStoryInfo;
  71.  
  72.         // Add release no.
  73.         strRelease.Format( TEXT("\nRelease: %d"), h_release );
  74.         strStoryInfo += strRelease;
  75.         // Add serial no. to string
  76.         strStoryInfo += "  SerialNo: ";
  77.         strStoryInfo += h_serial;
  78.  
  79.         // Display string
  80.         SetDlgItemText( IDC_STORYINFO, strStoryInfo );
  81.     }
  82.     else 
  83.     {
  84.         strStoryInfo = TEXT( "Compiled: " );
  85.         strStoryInfo += __DATE__;
  86.         SetDlgItemText( IDC_STORYINFO, strStoryInfo );
  87.     }
  88.  
  89.     CenterWindow();
  90.     
  91.     return TRUE;  // return TRUE unless you set the focus to a control
  92.                   // EXCEPTION: OCX Property Pages should return FALSE
  93. }
  94.