FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How load png from resource
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
How load png from resource
Posted: Tue Mar 31, 2009 07:52 PM

Hi

There are any way to load a .png file stored in a resource (rc) file and display it using drawalpha() ?

Thanks in advance,

Best regards,

Toninho.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How load png from resource
Posted: Tue Mar 31, 2009 08:23 PM

Hello,

I don't know any resource-editors can save a PNG-file to resource.
The solution, I'm working with ( Resource-Builder ), can handle JPG's :

The Graphic-part of the Help-file :

Advanced features in working with graphic resources
Resource Builder allows you to work with images in the JPEG format as easily as with standard BMP images. Support for images with any size and colors count allows using Resource Builder as a replacement for Borland Resource Workshop or Image Editor, which unable to support "quality" images in projects. Moreover, the graphic editor of the program allows you to process images with the help of various filters making it no worse than serious graphic packages.

Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Re: How load png from resource
Posted: Tue Mar 31, 2009 11:39 PM

Hi Uwe,

Borland Resource Workshop can do it:

define RT_RCDATA 10

nId RT_RCDATA NONDISCARDABLE "imagem.png"

My question is another: How to load it and have a valid handle, maybe something like:

hBitmap = LoadBitmap( GetResources(), cResName )

Thanks and best regards,

Toninho.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How load png from resource
Posted: Wed Apr 01, 2009 02:00 PM

Toninho,

Please review FWH\source\winapi\resource.c function cResToStr( cnResName, cType ) --> cResourceBytes

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Re: How load png from resource
Posted: Wed Apr 01, 2009 04:16 PM
Antonio Linares wrote:Toninho,
Please review FWH\source\winapi\resource.c function cResToStr( cnResName, cType ) --> cResourceBytes

Thanks Mr Antonio,

Regards,

Toninho.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: How load png from resource
Posted: Thu Mar 27, 2025 06:39 PM

I tried this test

PROCEDURE Main()

LOCAL cDatiPng

cDatiPng := cResToStr("DASH_HOME","PNG")

IF !Empty(cDatiPng)

  hb_MemoWrit("immagine_estratta.png", cDatiPng)

  ? "PNG estratto con successo!"

ELSE

  ? "Errore: risorsa non trovata."

ENDIF

RETURN

and not found the resource why ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion