QueryFileSystem Example for C++ 5.0 and later

ILEADRasterTwain_U * pRasterTwain;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain_U, NULL, CLSCTX_ALL, IID_ILEADRasterTwain_U, (void **)&pRasterTwain);
if (FAILED(hr) || !pRasterTwain)
{
	::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
	return;
}

pRasterTwain->InitSession((long)GetSafeHwnd()); 

int nRet = pRasterTwain->QueryFileSystem(FILESYSTEM_MSG_AUTOMATICCAPTUREDIRECTORY); 
if (nRet != 0) 
  AfxMessageBox(TEXT("Error occurred during call QueryFileSystem"));

CString csMsg; 
csMsg.Format(TEXT("Input Name = %s\nOutput Name = %s\nRecursive = %d\nFileType = %d\n"
			"FileSize = %d\nCreateTimeDate = %s\nModifiedTimeDate = %s\nFreeMediaSpace = %d\n"
			"NewImageSize = %d\nNumberOfFiles = %d\nNumberOfAudioSnippets = %d\nDeviceGroupMask = %d\n"),
			pRasterTwain->FileSystemInfo->InputName, 
			pRasterTwain->FileSystemInfo->OutputName, 
			pRasterTwain->FileSystemInfo->Recursive, 
			pRasterTwain->FileSystemInfo->FileType, 
			pRasterTwain->FileSystemInfo->FileSize, 
			pRasterTwain->FileSystemInfo->CreateTimeDate, 
			pRasterTwain->FileSystemInfo->ModifiedTimeDate, 
			pRasterTwain->FileSystemInfo->FreeMediaSpace, 
			pRasterTwain->FileSystemInfo->NewImageSize, 
			pRasterTwain->FileSystemInfo->NumberOfFiles, 
			pRasterTwain->FileSystemInfo->NumberOfAudioSnippets, 
			pRasterTwain->FileSystemInfo->DeviceGroupMask); 

AfxMessageBox(csMsg);