Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » II: Saving Icons to file Collapse All
Subject Author Date
Raha Mohtasham Feb 23, 2008 - 9:06 AM

Dear Support,

CExtCmdIcon has a Serialize method. Is it possible to Save Icons to a file using this method?

If yes, why doesn’t the following code work?

CExtBitmap bmp;
HICON hIcon;

VERIFY( bmp.LoadBMP_Resource( MAKEINTRESOURCE( IDB_BITMAP1 ) ) );
bmp.AlphaColor( RGB(255,255,255), RGB(0,0,0), 0 );
bmp.SaveBMP_File("C:/TEST/BITMAP1");

hIcon = bmp.CreateHICON();
///////////////////////////////////////////////////////////Save the Icon to file/////////////
CExtCmdIcon cmdIcon;
CFile file;
cmdIcon.AssignFromHICON(hIcon, true);
if(file.Open("C:/TEST/ICON1", CFile::modeCreate | CFile::modeWrite))
{
CArchive ar(&file, CArchive::store);
cmdIcon.Serialize(ar);
ar.Close();
file.Close();
}
///////////////////////////////////////////


Thanks

Technical Support Feb 25, 2008 - 3:52 AM

Prof-UIS allows you to save and load only .BMP images. The .ICO format is not supported. The advantage of using .BMP files instead of icons is that 32-bit BMP images are pefectly painted on any Windows OS starting from Windows 95 and Windows NT 4.0, which fully solves the compatibility issues. You can also use the CExtCmdIcon::Serialize() method in your project but this method does not work with the .ICO format. It simply serializes data of a CExtCmdIcon in a binary form.