home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / api2help / welcome.cpp < prev    next >
C/C++ Source or Header  |  1998-04-02  |  2KB  |  78 lines

  1. // Welcome.cpp : implementation file
  2. //
  3.  
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6.  
  7.  
  8. #include "stdafx.h"
  9. #include "API2Help.h"
  10. #include "Welcome.h"
  11. #include "options.h"
  12. #include <winuser.h>
  13.  
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CWelcome dialog
  22.  
  23.  
  24. CWelcome::CWelcome(CString strAPIFunc, CWnd* pParent /*=NULL*/)
  25.     : CDialog(CWelcome::IDD, pParent)
  26. {
  27.     m_strSelected = strAPIFunc;
  28.     //{{AFX_DATA_INIT(CWelcome)
  29.         // NOTE: the ClassWizard will add member initialization here
  30.     //}}AFX_DATA_INIT
  31. }
  32.  
  33.  
  34. void CWelcome::DoDataExchange(CDataExchange* pDX)
  35. {
  36.     CDialog::DoDataExchange(pDX);
  37.     //{{AFX_DATA_MAP(CWelcome)
  38.     DDX_Control(pDX, IDC_SELECTED, m_Selected);
  39.     //}}AFX_DATA_MAP
  40. }
  41.  
  42.  
  43. BEGIN_MESSAGE_MAP(CWelcome, CDialog)
  44.     //{{AFX_MSG_MAP(CWelcome)
  45.     //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CWelcome message handlers
  50.  
  51. BOOL CWelcome::OnInitDialog()
  52. {
  53.     CDialog::OnInitDialog();
  54.  
  55.     CString strSelected2 = m_strSelected;
  56.     for (int i = 0 ; i < strSelected2.GetLength() ; i++)
  57.         if ((strSelected2.GetAt(i) == '\n') || (strSelected2.GetAt(i) == '\t') ||
  58.                 (strSelected2.GetAt(i) == '\r'))
  59.         {
  60.             strSelected2 = strSelected2.Left(i) +
  61.                     strSelected2.Right(strSelected2.GetLength()-i-1);
  62.             i--;    //Because the character was removed, the next char
  63.                     //  Drops into it's place. But this character needs to
  64.                     //  be examined also, so we need to back up
  65.         }
  66.     m_Selected.SetWindowText(strSelected2);
  67.  
  68.     return TRUE;  // return TRUE unless you set the focus to a control
  69.                   // EXCEPTION: OCX Property Pages should return FALSE
  70. }
  71.  
  72. void CWelcome::OnOK()
  73. {
  74.     COptions FileOpt(m_strSelected, this);
  75.     FileOpt.DoModal();
  76.     CDialog::OnOK();
  77. }
  78.