home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / mailx6 / _setup.2 / Group7 / Wiz95Dlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-22  |  3.3 KB  |  120 lines

  1. // Wizard95Dlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "resource.h"
  6. #include "Wiz95Dlg.h"
  7. #include "Wizard95.h"
  8. #include "PSheet.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CWizard95Dlg dialog
  18.  
  19. CWizard95Dlg::CWizard95Dlg(CWnd* pParent /*=NULL*/)
  20.     : CDialog(CWizard95Dlg::IDD, pParent)
  21. {
  22.     //{{AFX_DATA_INIT(CWizard95Dlg)
  23.         // NOTE: the ClassWizard will add member initialization here
  24.     //}}AFX_DATA_INIT
  25.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  26.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  27. }
  28.  
  29. void CWizard95Dlg::DoDataExchange(CDataExchange* pDX)
  30. {
  31.     CDialog::DoDataExchange(pDX);
  32.     //{{AFX_DATA_MAP(CWizard95Dlg)
  33.     DDX_Control(pDX, IDC_MSESSCTRL1, m_Session);
  34.     DDX_Control(pDX, IDC_MMSGCTRL1, m_Message);
  35.     DDX_Control(pDX, IDC_MMSGCTRL2, m_ReadMsg);
  36.     DDX_Control(pDX, IDC_MRECICTRL1, m_Originator);
  37.     //}}AFX_DATA_MAP
  38. }
  39.  
  40. BEGIN_MESSAGE_MAP(CWizard95Dlg, CDialog)
  41.     //{{AFX_MSG_MAP(CWizard95Dlg)
  42.     ON_WM_PAINT()
  43.     ON_WM_QUERYDRAGICON()
  44.     ON_BN_CLICKED(IDC_WIZARD, OnWizard)
  45.     //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CWizard95Dlg message handlers
  50.  
  51. BOOL CWizard95Dlg::OnInitDialog()
  52. {
  53.     CDialog::OnInitDialog();
  54.  
  55.     // Set the icon for this dialog.  The framework does this automatically
  56.     //  when the application's main window is not a dialog
  57.     SetIcon(m_hIcon, TRUE);            // Set big icon
  58.     SetIcon(m_hIcon, FALSE);        // Set small icon
  59.     
  60.     // TODO: Add extra initialization here
  61.     m_Message.BindWith(m_Session.GetObjRef());    
  62.     m_ReadMsg.BindWith(m_Session.GetObjRef());    
  63.     m_Originator.BindWith(m_ReadMsg.GetObjRef());    
  64.     return TRUE;  // return TRUE  unless you set the focus to a control
  65. }
  66.  
  67. // If you add a minimize button to your dialog, you will need the code below
  68. //  to draw the icon.  For MFC applications using the document/view model,
  69. //  this is automatically done for you by the framework.
  70.  
  71. void CWizard95Dlg::OnPaint() 
  72. {
  73.     if (IsIconic())
  74.     {
  75.         CPaintDC dc(this); // device context for painting
  76.  
  77.         SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  78.  
  79.         // Center icon in client rectangle
  80.         int cxIcon = GetSystemMetrics(SM_CXICON);
  81.         int cyIcon = GetSystemMetrics(SM_CYICON);
  82.         CRect rect;
  83.         GetClientRect(&rect);
  84.         int x = (rect.Width() - cxIcon + 1) / 2;
  85.         int y = (rect.Height() - cyIcon + 1) / 2;
  86.  
  87.         // Draw the icon
  88.         dc.DrawIcon(x, y, m_hIcon);
  89.     }
  90.     else
  91.     {
  92.         CDialog::OnPaint();
  93.     }
  94. }
  95.  
  96. // The system calls this to obtain the cursor to display while the user drags
  97. //  the minimized window.
  98. HCURSOR CWizard95Dlg::OnQueryDragIcon()
  99. {
  100.     return (HCURSOR) m_hIcon;
  101. }
  102.  
  103. void CWizard95Dlg::OnWizard()
  104. {
  105.     // TODO: The property sheet attached to your project
  106.     // via this function is not hooked up to any message
  107.     // handler.  In order to actually use the property sheet,
  108.     // you will need to associate this function with a control
  109.     // in your project such as a menu item or tool bar button.
  110.  
  111.     CMyPropertySheet propSheet;
  112.  
  113.     propSheet.m_psh.dwFlags&=~PSH_HASHELP;
  114.     propSheet.DoModal();
  115.  
  116.     // This is where you would retrieve information from the property
  117.     // sheet if propSheet.DoModal() returned IDOK.  We aren't doing
  118.     // anything for simplicity.
  119. }
  120.