// DonePage.cpp : implementation file // #include "stdafx.h" #include "DonePage.h" #include #include ///////////////////////////////////////////////////////////////////////////// // CDonePage property page CDonePage::CDonePage(CPropertySheet* pParent, UINT nPos /*= WIZPAGE_MIDDLE*/) : CPropertyPage(CDonePage::IDD), m_nPos(nPos) // Position in the Wizard (WIZPAGE_FIRST, WIZPAGE_MIDDLE // or WIZPAGE_LAST) { ASSERT(pParent); // Have to have a valid parent m_pParentSheet = pParent; // or we can't survive SetHelp(true); } CDonePage::~CDonePage() { } ///////////////////////////////////////////////////////////////////////////// // CDonePage message handlers LRESULT CDonePage::OnSetActive(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { DWORD dwButtons; // Depening on our Position in the Wizard // Set the Buttons at the bottom on and off switch(m_nPos){ case WIZPAGE_FIRST: dwButtons = PSWIZB_NEXT; break; case WIZPAGE_LAST: dwButtons = PSWIZB_BACK | PSWIZB_FINISH; break; default: dwButtons = PSWIZB_BACK | PSWIZB_NEXT; break; } m_pParentSheet->SetWizardButtons(dwButtons); return 0; } LRESULT CDonePage::OnHelp(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { WinHelp(NS_HELP_FILE, HELP_FINDER, 0); return 1; } LRESULT CDonePage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Set the Help ID for our Help File // m_nIDHelp = 300; HICON hIconNightSec = ::LoadIcon(_Module.m_hInstResource, MAKEINTRESOURCE(IDI_SHUTDOWN)); CButton btnNew = GetDlgItem(IDC_SHUTDOWN); btnNew.SetIcon(hIconNightSec); btnNew.Detach(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } LRESULT CDonePage::OnShutdown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { m_pParentSheet->PressButton(PSBTN_FINISH); string sShutdownCmd = GetProgramFolder(_Module.m_hInst); sShutdownCmd += _T("Shutdown.exe"); // Start the Shutdown Program if(ShellExecute(NULL, _T("open"), sShutdownCmd, NULL, NULL, SW_SHOWNORMAL) <= (HINSTANCE)32) ::MessageBox(NULL, _T("Couldn't start Secure Shutdown. Make sure it's installed properly."), _T("Secure Shutdown"), MB_ICONSTOP); return 1; }