The following is a C++
sample code display of the thumbnail browser dialog
window, and it handles the paths of selected images.
Users must include BiThumbnail.h and use BiThumbnail.lib
and BiThumbnail.dll. The Thumbnail control comes with
sample code for several languages such as VB, VB.NET,
C#, J# and Delphi.
|
#include "BiThumbnail.h"
…
BiThumbnailDlg dlg(this);
// display dialog window
INT_PTR ret = dlg.DisplayThumbnailDlg();
// check error code
if(dlg.GetLastThumbnailError()){
CString str;
str.Format("Error code:%i\n%s",
dlg.GetLastThumbnailError(),
dlg.GetThumbnailErrorString().c_str());
AfxMessageBox(str);
}
if( ret == IDOK ){
// show selected image list
CString str;
int numOfItems = dlg.GetNumOfSelectedItems();
for(int i=0; i<numOfItems; ++i){
int buffSize = 255;
char strPath[255];
if(!dlg.GetSelectedItem(i, buffSize, strPath)){
CString strTmp(str);
str.Format("%s%s\n", strTmp, strPath);
}else{
AfxMessageBox(
"String buffer size is too small!");
}
}
AfxMessageBox(str);
}
|