Available in the LEADTOOLS Imaging toolkit. |
FileLoad Example for C++ 5.0 and later
void CDialogs::ShowOpenDlg() { HRESULT hr; int nRet; m_pRasterDlgFile = NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgFile_U, NULL, CLSCTX_ALL, IID_ILEADRasterDlgFile_U, (LPVOID*)&m_pRasterDlgFile); nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR); CRasterDlgFile *m_pRasterDlgFileSink = new CRasterDlgFile; LPUNKNOWN pUnkSink = m_pRasterDlgFileSink->GetIDispatch(false); unsigned long m_dwCookie = NULL; AfxConnectionAdvise(m_pRasterDlgFile, DIID__ILEADRasterDlgFileEvents_U, pUnkSink, FALSE, &m_dwCookie); m_pRasterDlgFile->DialogTitle = "LEADTOOLS Open dialog box"; m_pRasterDlgFile->InitialDir = "D:\\Images\\Vista"; m_pRasterDlgFile->FileDlgFlags = OPEN_ALLOWMULTI; m_pRasterDlgFile->UIFlags = OPEN_LOADBITMAP | OPEN_SHOW_PROGRESSIVE | OPEN_SHOW_MULTIPAGE | OPEN_SHOW_LOADROTATED | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_FILEINFO | OPEN_SHOW_PREVIEW | OPEN_SHOW_DELPAGE | OPEN_VIEWTOTALPAGES | OPEN_LOADBITMAP | OPEN_GENERATETHUMBNAIL; nRet = m_pRasterDlgFile->ShowOpenDlg((long)m_hWnd); } void CRasterDlgFile::OnFileLoad(short iTotalPercent, short iPercent) { CmfcDlg * pDialog = (CmfcDlg*)AfxGetApp()->GetMainWnd(); if (iPercent == 100) { long Bitmap = pDialog->m_pRasterDlgFile->GetBitmap(); pDialog->m_pLead1.SetBitmap(Bitmap); MessageBox(0, pDialog->m_pRasterDlgFile->GetFileName(), 0, 0); } }