InfoLayers example for C++ 5.0 and later
ILEADRasterIO *pRasterIO=NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
// This example all the layers in a file to a bitmap list
pRasterIO->GetFileInfo(m_RasterView1.GetRaster (), "c:\\temp\\layers.psd", 0, 0);
if(pRasterIO->InfoLayers== 0)
AfxMessageBox(TEXT("This file has no layers!"));
else
{
// load the first layer directly
pRasterIO->LoadLayer(m_RasterView1.GetRaster(), "c:\\temp\\layers.psd", 0, 0);
// steal the bitmaps from the other object
m_RasterView1.GetRaster()SetRefBitmap (TRUE);
for(int i = 1; i < pRasterIO->InfoLayers; ++i)
{
// use a second control to load the other layers
// using LEAD1 to load the other layers would invalidate the bitmap list
pRasterIO->LoadLayer(m_RasterView2.GetRaster(), "c:\\temp\\layers.psd", 0, i);
// append the layer to the bitmap list
m_RasterView1.GetRaster()InsertBitmapListItem (-1, m_RasterView2.GetRaster().GetBitmap());
}
}
pRasterIO->Release();