FileOpen Example for C++ 4.0 and later

void CShowOpenDlgDlg::OnBnClickedOk()

{

 

   // TODO: Add your control notification handler code here

   int nRet;

   ILEADRasterDlgKrn_U * m_pRasterKrnDlg = NULL;

   CoCreateInstance(CLSID_LEADRasterDlgKrn_U, NULL, CLSCTX_ALL,

                     IID_ILEADRasterDlgKrn_U, (void **)&m_pRasterKrnDlg);

   nRet = m_pRasterKrnDlg->InitDlg(INIT_WITH_COLOR);

    

   ILEADRasterDlgFile_U * m_pRasterFileDlg = NULL;

   CoCreateInstance(CLSID_LEADRasterDlgFile_U, NULL, CLSCTX_ALL,

                     IID_ILEADRasterDlgFile_U, (void **)&m_pRasterFileDlg);

   m_pRasterFileDlg->DialogTitle = "LEADTOOLS Open dialog box";

   m_pRasterFileDlg->InitialDir = "e:\\images";

   m_pRasterFileDlg->FileDlgFlags = 0;

   m_pRasterFileDlg->EnableShowPreview = true;

   m_pRasterFileDlg->EnableShowLoadOptions = false;

   m_pRasterFileDlg->LoadRotated = false;

   m_pRasterFileDlg->LoadCompressed = false;

   m_pRasterFileDlg->LoadPasses = 0;

   m_pRasterFileDlg->UIFlags = OPEN_SHOW_PROGRESSIVE |

   OPEN_SHOW_MULTIPAGE      |

                               OPEN_SHOW_LOADROTATED    |

   OPEN_SHOW_LOADCOMPRESSED |

   OPEN_SHOW_FILEINFO       |

   OPEN_SHOW_PREVIEW        |

                               OPEN_SHOW_DELPAGE        |

                               OPEN_VIEWTOTALPAGES;

   nRet= m_pRasterFileDlg->ShowOpenDlg((long)this->m_hWnd );

   m_pLead1 = m_Lead1.GetControlUnknown();

   if ( nRet == 0 && m_pRasterFileDlg->DialogStatus ==DLG_OK )

   {

   m_pLead1.Load (m_pRasterFileDlg->FileName,0,m_pRasterFileDlg->PageNumber, 1 );

   }

}