icon from a .RC file
icon from a .RC file
Is it possible to save an icon from a .RC file to a file ?
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: icon from a .RC file
You can save it from a RES file but you can't save it from a RC file as you only have the icon name there.
The RES file does include the icon contents.
The RES file does include the icon contents.
Re: icon from a .RC file
Sorry, Antonio, I wrote it wrong. Of course I meant the RES file
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: icon from a .RC file
Simply open the RES file with a resources editor and save the icon file
Re: icon from a .RC file
I guess I didn't ask the question well. I compiled .prg and .rc into a single .exe In some situation I need to save one of the resources (icon) to a bitmap file from the program.
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: icon from a .RC file
Open the EXE with the resources editor and save the icon
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: icon from a .RC file
If you want to save an Icon resource to an icon file "filename.ico"
If you want to save any image resource to a file of the same type or different type:
Ex. Save bmp resource as bmp file.
Ex. Save bmp resource as PNG file.
This reads bitmap image from the resource, converts to png image and saves as png image.
Code: Select all | Expand
hIcon := LoadIcon( GetResources(), cResIcoName )
FW_SaveHIconToIco( hIcon, "name.ico" )
Ex. Save bmp resource as bmp file.
Code: Select all | Expand
FW_SaveImage( BmpResourceName, "name.bmp" )
Code: Select all | Expand
FW_SaveImage( BmpResourceName, "name.png" )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: icon from a .RC file
Sample:
Using this rc file:
"saveres.rc"
build and run this sample program in the fwh\samples folder:
"saveres.prg"
Using this rc file:
"saveres.rc"
Code: Select all | Expand
BOOKSICO ICON "..\icons\books.ico"
CHARTICO ICON "..\icons\chart.ico"
USERSICO ICON "..\icons\users.ico"
SEA BITMAP "..\bitmaps\sea.bmp"
OLGA 10 "..\bitmaps\olga1.jpg"
"saveres.prg"
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oWnd, oIco, oBar, oBtn
DEFINE ICON oIco RESOURCE "BOOKSICO"
DEFINE WINDOW oWnd ICON oIco SIZE 600,400 PIXEL
DEFINE BUTTONBAR oBar SIZE 140,30 2007
DEFINE BUTTON OF oBar PROMPT "OLGA.JPG->PNG" CENTER ACTION ( ;
FW_SaveImage( "OLGA", "olga.png" ), XImage( "olga.png" ) )
DEFINE BUTTON OF oBar PROMPT "SEA.BMP->JPG" CENTER ACTION ( ;
FW_SaveImage( "SEA", "sea.jpg", 100 ), XImage( "sea.jpg" ) )
DEFINE BUTTON OF oBar PROMPT "SAVE-ICO" CENTER ACTION ( ;
FW_SaveHIconToIco( LoadIcon( GetResources(), "BOOKSICO" ), "books2.ico" ), ;
XImage( "books2.ico" ) )
ACTIVATE WINDOW oWnd CENTERED
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: icon from a .RC file
Thank you ! That's just what I need.