|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Alfonso Bastias
|
Mar 28, 2006 - 11:40 AM
|
I will like to load a skin from the resource of my application instead a file. How can I do that?. I created a special resource section ("SKIN") with two components IDR_SKIN_AQUA and IDR_SKIN_BLACKDIAMOND. At the end I would like to create a special skin, but I do not want released it as a separate file (.skin). The next function load skin from file.
pPM->m_Skin.SearchAndLoadSkinFile( _T("Aqua.Skin"), false )
Maybe you just need to add another function such as
pPM->m_Skin.LoadSkinResource( IDR_SKIN_AQUA)
Thanks. Alfonso
|
|
Technical Support
|
Mar 29, 2006 - 6:50 AM
|
It is not difficult to load a binary .SKIN file from resources. We assume you inserted a binary .SKIN file as a custom type resource named "SKIN" using the IDR_SKIN_AQUA resource identifier. The following code loads the Aqua skin: bool bInstallSimplePM = true;
CExtPaintManagerSkin * pPM = new CExtPaintManagerSkin;
CExtResourceManager::CExtResourceMemoryBuffer _SkinData;
if( g_ResourceManager->LoadResourceBuffer(
_SkinData,
"SKIN",
IDR_SKIN_AQUA // or IDR_SKIN_BLACK_DIAMOND
)
)
{
CMemFile _file;
_file.Attach( _SkinData.GetBuffer(), _SkinData.GetSize() );
_file.Seek( 0, CFile::begin );
if( pPM->m_Skin.SerializeFile(
_file,
false,
false
)
)
{
// IF WE ARE HERE, SKIN DATA WERE LOADED SUCCESSFULLY
bInstallSimplePM = false;
g_PaintManager.InstallPaintManager( pPM );
}
}
if( bInstallSimplePM )
{
// IF WE ARE HERE, THEN THE SKIN DATA WAS NOT LOADED SUCCESSFULLY
//::AfxMessageBox( _T("Failed to load skin.") );
delete pPM;
g_PaintManager.InstallPaintManager( RUNTIME_CLASS(CExtPaintManager) );
}
|
|
Alfonso Bastias
|
Mar 29, 2006 - 10:05 AM
|
|
|