BOOL CGfxDriverUpdaterApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); SetRegistryKey(_T("GraphicsDriverUpdater")); CPropertySheet dlg; CPage1 page1; dlg.AddPage(&page1); CPage2 page2; dlg.AddPage(&page2); dlg.SetWizardMode(); m_pMainWnd = &dlg; dlg.DoModal(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
bool CSetupApp::PreInstallSequence() { CPropertySheet sheet; sheet.m_psh.dwFlags&= ~PSH_HASHELP; CPageWelcome pageWelcome; CPageDestFolder pageDestFolder; CPageShortcuts pageShortcuts; CPageReady pageReady; sheet.AddPage(&pageWelcome); sheet.AddPage(&pageDestFolder); sheet.AddPage(&pageShortcuts); sheet.AddPage(&pageReady); sheet.SetWizardMode(); if (ID_WIZFINISH == sheet.DoModal()) { m_destFolder= pageDestFolder.m_destFolder; m_shortcutStartMenu= pageShortcuts.m_shortcutStartMenu; m_shortcutDesktop= pageShortcuts.m_shortcutDesktop; m_shortcutSendTo= pageShortcuts.m_shortcutSendTo; return true; } else { return false; } }
// @pymethod |PyCPropertySheet|SetWizardMode|Enables the wizard mode PyObject *ui_propsheet_set_wizard_mode( PyObject *self, PyObject *args ) { CPropertySheet *pPS = pPS=GetPropSheet(self); if (!pPS) return NULL; CHECK_NO_ARGS2(args,SetWizardMode); GUI_BGN_SAVE; pPS->SetWizardMode(); GUI_END_SAVE; RETURN_NONE; }
void CFPAnalysisView::OnViewWizard() { CPropertySheet ps; CHistogramPage page1; CGaussianPage page2; ps.AddPage(&page1); ps.AddPage(&page2); ps.SetWizardMode(); ps.DoModal(); }
void CSetupApp::PostInstallSequence() { CPropertySheet sheet; sheet.m_psh.dwFlags&= ~PSH_HASHELP; CPageFinished pageFinished; pageFinished.m_message= m_errorMessage; pageFinished.m_canStartApplication= m_canStartApplication; sheet.AddPage(&pageFinished); sheet.SetWizardMode(); if (ID_WIZFINISH == sheet.DoModal()) { m_startApplication= pageFinished.m_startApplication; } }
BOOL CFileEncryptApp::InitInstance() { // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _DEBUG CMfxTrace::Init(); #endif g_bCreateSelfExtractFile = FALSE; CPropertySheet EncryptWizard; CEncryptWiz_1 EncryptWiz_1; CEncryptWiz_2 EncryptWiz_2; CEncryptWiz_3 EncryptWiz_3; EncryptWizard.AddPage(&EncryptWiz_1); EncryptWizard.AddPage(&EncryptWiz_2); EncryptWizard.AddPage(&EncryptWiz_3); EncryptWizard.SetWizardMode(); int nResponse = EncryptWizard.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
BOOL CFileDecryptApp::InitInstance() { #ifdef _DEBUG CMfxTrace::Init(); #endif if (!AfxOleInit()) return FALSE; // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. // CFileDecryptDlg dlg; // m_pMainWnd = &dlg; // int nResponse = dlg.DoModal(); #ifdef CREATE_SELF_EXTRACTING_FILE TCHAR buf[MAX_PATH]; memset(buf,0,sizeof(buf)); GetModuleFileName(NULL,buf,MAX_PATH); GetLongPathName(buf, buf, MAX_PATH); CString modulePath = buf; //memset(buf,0,sizeof(buf)); //::GetTempPath(MAX_PATH, buf); //GetLongPathName(buf, buf, MAX_PATH); //CString tempDirPath = buf; BOOL isValid = FALSE; BOOL isSelfExtractingFile = FALSE; LARGE_INTEGER address; LARGE_INTEGER size; isSelfExtractingFile = CheckIsSelfExtractingFile(modulePath, address, size, isValid); if (!isSelfExtractingFile || !isValid || modulePath.GetLength() >= MAX_PATH) { CString strText; CString strTitle; strText.LoadString(IDS_INVALID_IMAGE_FILE); strTitle.LoadString(IDS_APP_NAME); MessageBox(0, strText, strTitle, MB_OK | MB_ICONWARNING); } else { BOOL openationResult = FALSE; //CString tempFilePath = tempDirPath + modulePath.Mid(modulePath.ReverseFind(L'\\') + 1) + SELF_EXTRACTING_TEMP_EXTENSION; CString tempFilePath = modulePath + SELF_EXTRACTING_TEMP_EXTENSION; do { HANDLE hTempFile = CreateFile(tempFilePath,GENERIC_WRITE, NULL, NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_HIDDEN,NULL); SetFileAttributes(tempFilePath, FILE_ATTRIBUTE_HIDDEN); if (hTempFile == INVALID_HANDLE_VALUE) { break; } HANDLE hModule = CreateFile(modulePath, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hModule == INVALID_HANDLE_VALUE) { break; } if (!SetFilePointerEx(hModule, address, 0, FILE_BEGIN)) { break; } char chBuf[1024]; ZeroMemory(chBuf, sizeof(chBuf)); DWORD dwRead = 0; DWORD dwWrite = 0; LARGE_INTEGER remainToRead; remainToRead.QuadPart = size.QuadPart; LARGE_INTEGER totalRead; totalRead.QuadPart = 0; DWORD dwToRead = 0; if (remainToRead.QuadPart > sizeof(chBuf)) { dwToRead = sizeof(chBuf); } else { dwToRead = remainToRead.QuadPart; } while (dwToRead != 0 && ReadFile(hModule, chBuf, dwToRead, &dwRead, 0) && dwToRead == dwRead){ totalRead.QuadPart += dwRead; remainToRead.QuadPart -= dwRead; if (WriteFile(hTempFile, chBuf, dwToRead, &dwWrite, 0) && dwWrite == dwToRead) { if (remainToRead.QuadPart > sizeof(chBuf)) { dwToRead = sizeof(chBuf); } else { dwToRead = remainToRead.QuadPart; } dwRead = dwWrite = 0; ZeroMemory(chBuf, sizeof(chBuf)); } else { break; } } if (dwToRead == 0) { openationResult = TRUE; } CloseHandle(hTempFile); CloseHandle(hModule); } while (0); if (!openationResult) { CString strText; CString strTitle; strText.LoadString(IDS_INVALID_IMAGE_FILE); strTitle.LoadString(IDS_APP_NAME); MessageBox(0, strText, strTitle, MB_OK | MB_ICONWARNING); return FALSE; } g_isSelfExtractingFile = TRUE; wcsncpy(g_DecryptInfo.szImageFile,(LPCTSTR)tempFilePath,MAX_PATH-1); CPropertySheet DecryptWizard; CDecryptWiz_2 DecryptWiz_2; CDecryptWiz_3 DecryptWiz_3; CDecryptWiz_4 DecryptWiz_4; CDecryptWiz_5 DecryptWiz_5; DecryptWizard.AddPage(&DecryptWiz_2); DecryptWizard.AddPage(&DecryptWiz_3); DecryptWizard.AddPage(&DecryptWiz_4); DecryptWizard.AddPage(&DecryptWiz_5); DecryptWizard.SetWizardMode(); DecryptWizard.DoModal(); DeleteFile(tempFilePath); } #else CPropertySheet DecryptWizard; CDecryptWiz_1 DecryptWiz_1; CDecryptWiz_2 DecryptWiz_2; CDecryptWiz_3 DecryptWiz_3; CDecryptWiz_4 DecryptWiz_4; CDecryptWiz_5 DecryptWiz_5; DecryptWizard.AddPage(&DecryptWiz_1); DecryptWizard.AddPage(&DecryptWiz_2); DecryptWizard.AddPage(&DecryptWiz_3); DecryptWizard.AddPage(&DecryptWiz_4); DecryptWizard.AddPage(&DecryptWiz_5); DecryptWizard.SetWizardMode(); DecryptWizard.DoModal(); #endif // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }