void InstallerWindow::OnExecBegin() { SetProgress(m_recorded_progress + 1); SetControlValues(); InstallConfiguration * p_configuration = reinterpret_cast<InstallConfiguration *>(get(m_configuration)); CHECK_BOOL(p_configuration != NULL, L"Invalid configuration"); ExtractCab(L"", p_configuration->show_cab_dialog); }
STDMETHODIMP CStrokeDlg::handleActivateObjectEvent(IUnknown* object, long* cookie) { CComQIPtr<IPDStrokeSettings> stroke = object; if (stroke) { m_targetObjects.Add(stroke.Detach()); *cookie = m_targetObjects.GetSize(); SetControlValues(); } return S_OK; }
STDMETHODIMP CStrokeDlg::handleDeactivateObjectEvent(IUnknown* object, long cookie, BOOL* bAllow) { for (int i = 0; i < m_targetObjects.GetSize(); i++) { if (IsUnknownEqualUnknown(m_targetObjects[i], object)) { m_targetObjects[i]->Release(); m_targetObjects.RemoveAt(i); } } SetControlValues(); return S_OK; }
//================================================= // Overrides //================================================= BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); // Add "About..." menu item to system menu. CMenu* pSysMenu = GetSystemMenu(FALSE); if(pSysMenu != NULL) { CString strAboutMenu = _T("About..."); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // Set max-length on edit boxes CEdit* pEdit = NULL; VERIFY(pEdit = (CEdit*)GetDlgItem(IDC_IMAGE_NAME)); pEdit->SetLimitText(50); // Fill combo with all supported image formats CComboBox* pCombo = NULL; VERIFY(pCombo = (CComboBox*)GetDlgItem(IDC_IMAGE_EXT)); ImageCodecInfo* pImageCodecInfo = NULL; UINT nCount = 0; // number of image encoders UINT nSize = 0; // size of the image encoder array in bytes GetImageEncodersSize(&nCount, &nSize); if(nSize > 0) { pImageCodecInfo = (ImageCodecInfo*)(malloc(nSize)); if(pImageCodecInfo != NULL) { GetImageEncoders(nCount, nSize, pImageCodecInfo); for(UINT x = 0; x < nCount; x ++) { CString strFormat(pImageCodecInfo[x].FormatDescription); int iItem = pCombo->AddString(strFormat); ASSERT(iItem != -1); CLSID* pCLSID = new CLSID; ASSERT(pCLSID); *pCLSID = pImageCodecInfo[x].Clsid; pCombo->SetItemData(iItem, (DWORD_PTR)pCLSID); // JPEG will be our default image type if(strFormat.CompareNoCase(_T("jpeg")) == 0) { m_clsidImgType = pImageCodecInfo[x].Clsid; pCombo->SetCurSel(iItem); } } free(pImageCodecInfo); } } SetControlValues(); // Start keyboard hook to capture the print screen key ActivateKeyboardHook(TRUE); return TRUE; // return TRUE unless you set the focus to a control }