TBitMap to file

TBitMap to file

Postby Natter » Mon Feb 26, 2018 10:39 am

I get an icon associated with a file type
img:=BmpFromIcon(EXTRACTASSICON( 0, nam, @sol))
img:=TBitmap():Define(,, oWnd:aControls[1]:aDialogs[2], img)

img - is an object of TBitMap. How can I save this bitmap to a file ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: TBitMap to file

Postby nageswaragunupudi » Mon Feb 26, 2018 4:28 pm

Code: Select all  Expand view
function icofile2bmpfile()

   local cFile, cBmpFile
   local hIco, hBmp, hDib

   cFile    := "\fwh\manual\manual FWH english.doc"
   cBmpFile := "doc.bmp"

   if File( cFile )
      hIco     := ICON_READ( TrueName( cFile ) )
      hBmp     := BMPFROMICON( hIco )
      hDib     := DibFromBitmap( hBmp )
      DibWrite( cBmpFile, hDib )

      DestroyIcon( hIco )
      DeleteObject( hBmp )
      GlobalFree( hDIB )
   endif

return nil
 

The functions I used are available in all versions of FWH.
If you use current versions of FWH you do not need to convert files from ico to bmp, because you can directly use ico files for any purpose.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TBitMap to file

Postby Silvio.Falconi » Mon Feb 26, 2018 6:34 pm

ib think we can use gdi save functions
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: TBitMap to file

Postby nageswaragunupudi » Mon Feb 26, 2018 6:59 pm

Silvio

The function I suggested uses GDI functions.
I guess you mean GDI+, not GDI.
Yes, there are many ways to do the same thing.
I preferred to do it in the simplest and shortest manner, using functions existing in FWH of all versions.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TBitMap to file

Postby Natter » Tue Feb 27, 2018 6:24 am

Thank you, Mr. Rao !
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests