FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Something like oImage:loadFromString()
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Something like oImage:loadFromString()
Posted: Thu Feb 28, 2008 12:49 PM
Hi Guys!


I have trying this:

cResult := Result of this query -> [ SELECT image FROM table1 ]

memoWrit( "C:\IMG001.BMP", cResult )

oImagem:loadBMP( "C:\IMG001.BMP" )
oImagem:refresh()



Is there a way to load an image into an object of type TBitmap or any other kind of a string directly from the database?

Something like loadFromString () method from the Delphi?

Thanks for all!
Greats!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Something like oImage:loadFromString()
Posted: Thu Feb 28, 2008 05:29 PM
Julio,

Try this:
METHOD LoadFromString( cString ) CLASS TBitmap

   local hBmpOld  := ::hBitmap
   local hPalOld  := ::hPalette

   if Empty( cString )
      return .F.
   endif

   ::hBitmap = CreateMemBitmap( ::GetDC(), cString )
   ::ReleaseDC()

   if ! Empty( hBmpOld )
      PalBmpFree( hBmpOld, hPalOld )
   endif

   PalBmpNew( ::hWnd, ::hBitmap, nil )

return .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Something like oImage:loadFromString()
Posted: Thu Feb 28, 2008 05:38 PM
CreateMemBitmap() has to be implemented this way:
#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

HBITMAP CreateMemBitmap( HDC hDC, BYTE far * cBitmap );

HB_FUNC( CREATEMEMBITMAP )
{
   hb_retnl( ( LONG ) CreateMemBitmap( ( HDC ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Something like oImage:loadFromString()
Posted: Fri Feb 29, 2008 02:17 PM

Amazing! Worked perfectly.

I thank the tip Linares.. this helped very, very, very much! Very much!

Greats!

Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9

Continue the discussion