#include #include #include // for GetCommandLine #include "datasrc.h" #include "autorun.h" #include "util.h" #include "resource.h" #include "assert.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CDataSource::CDataSource() { m_iItems = 0; } CDataSource::~CDataSource() { } CDataItem & CDataSource::operator[](int i) { return m_data[m_piScreen[i]]; } // Init // // For autorun we read all the items out of the resources. BOOL CDataSource::Init(LPSTR pszCommandLine) { BOOL fRet = FALSE; // read the text for the items from the resources HINSTANCE hinst = GetModuleHandle(NULL); if (hinst) { for (int i=0; i 3) { // we can always upgrade win98+ systems to NT m_Version = VER_OLDER; // Disable ARP. ARP is only enabled if the CD and the OS are the same version m_data[LAUNCH_ARP].m_dwFlags |= WF_DISABLED|WF_ALTERNATECOLOR; } else { m_Version = VER_INCOMPATIBLE; } } else if ((VER_PRODUCTMAJORVERSION > ovi.dwMajorVersion) || ((VER_PRODUCTMAJORVERSION == ovi.dwMajorVersion) && ((VER_PRODUCTMINORVERSION > ovi.dwMinorVersion) || ((VER_PRODUCTMINORVERSION == ovi.dwMinorVersion) && (VER_PRODUCTBUILD > ovi.dwBuildNumber))))) { // For NT to NT upgrades, we only upgrade if the version is lower m_Version = VER_OLDER; // Disable ARP. ARP is only enabled if the CD and the OS are the same version m_data[LAUNCH_ARP].m_dwFlags |= WF_DISABLED|WF_ALTERNATECOLOR; } else if ((VER_PRODUCTMAJORVERSION < ovi.dwMajorVersion) || (VER_PRODUCTMINORVERSION < ovi.dwMinorVersion) || (VER_PRODUCTBUILD < ovi.dwBuildNumber)) { m_Version = VER_NEWER; // disable upgrade and ARP buttons and associated things m_data[INSTALL_WINNT].m_dwFlags |= WF_DISABLED|WF_ALTERNATECOLOR; m_data[COMPAT_LOCAL].m_dwFlags |= WF_DISABLED|WF_ALTERNATECOLOR; m_data[LAUNCH_ARP].m_dwFlags |= WF_DISABLED|WF_ALTERNATECOLOR; } else { m_Version = VER_SAME; } if (m_Version == VER_SAME) { m_piScreen = c_aiWhistler; m_iItems = c_cWhistler; } else { m_piScreen = c_aiMain; m_iItems = c_cMain; } fRet = TRUE; } return fRet; } void CDataSource::SetWindow(HWND hwnd) { m_hwndDlg = hwnd; } void CDataSource::Invoke( int i, HWND hwnd ) { i = m_piScreen[i]; // if this item is disalbled then do nothing if ( m_data[i].m_dwFlags & WF_DISABLED ) { MessageBeep(0); return; } // otherwise we have already built the correct command and arg strings so just invoke them switch (i) { case INSTALL_WINNT: case LAUNCH_ARP: case BROWSE_CD: case COMPAT_WEB: case COMPAT_LOCAL: case HOMENET_WIZ: case MIGRATION_WIZ: case TS_CLIENT: case VIEW_RELNOTES: m_data[i].Invoke(hwnd); break; case SUPPORT_TOOLS: m_piScreen = c_aiSupport; m_iItems = c_cSupport; PostMessage(m_hwndDlg, ARM_CHANGESCREEN, SCREEN_TOOLS, 0); break; case COMPAT_TOOLS: m_piScreen = c_aiCompat; m_iItems = c_cCompat; PostMessage(m_hwndDlg, ARM_CHANGESCREEN, SCREEN_COMPAT, 0); break; case BACK: if (m_Version == VER_SAME) { m_piScreen = c_aiWhistler; m_iItems = c_cWhistler; } else { m_piScreen = c_aiMain; m_iItems = c_cMain; } PostMessage(m_hwndDlg, ARM_CHANGESCREEN, SCREEN_MAIN, 0); break; default: assert(0); break; } }