FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TBitMap to file
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
TBitMap to file
Posted: 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 ?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TBitMap to file
Posted: Mon Feb 26, 2018 04:28 PM
Code (fw): Select all Collapse
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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: TBitMap to file
Posted: Mon Feb 26, 2018 06: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 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TBitMap to file
Posted: Mon Feb 26, 2018 06: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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: TBitMap to file
Posted: Tue Feb 27, 2018 06:24 AM

Thank you, Mr. Rao !

Continue the discussion