Hi Roberto,Roberto Lopez wrote:I'm asking your permission to include this sample in the next HMG test build.gfilatov wrote: I've adapted this sample for HMG 3.0 already.
Take a look for attached working demo with project files and needed library
Many thanks for your request
You have my permission, of course.
Please take a look for the updated source of this sample below
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*
* FreeImage.dll should present to use this sample
* http://freeimage.sourceforge.net/
*
* Copyright 2003-2009 Grigory Filatov <gfilatov@freemail.ru>
*/
#include "FreeImage.ch"
#include "minigui.ch"
#define PROGRAM 'FreeImage Viewer Lite'
#define VERSION ' version 1.4.0'
#define COPYRIGHT ' 2003-2008 Grigory Filatov'
#define MsgAlert( c ) MsgStop( c, "Attention" )
Static handle, nWidth, nHeight, nKoef := 1
Function Main( fname )
default fname := "test.tif"
IF !FILE('FreeImage.Dll')
MsgAlert("Can't found the FreeImage.Dll")
Return Nil
ENDIF
fi_Initialise()
SET CENTURY ON
SET DATE GERMAN
DEFINE WINDOW Form_Main ;
AT 0,0 ;
WIDTH 400 HEIGHT 600 ;
TITLE PROGRAM ;
MAIN ;
ON INIT {|| handle := FI_Load( FIF_TIFF, fname, TIFF_DEFAULT ), ;
nWidth := FI_GetWidth( handle ), nHeight := FI_GetHeight( handle ), ;
Form_Main.Width := nWidth + GetBorderWidth() + 4, ;
Form_Main.Height := nHeight + GetBorderHeight() + GetTitleHeight() + 4, ;
PaintWindow( 'Form_Main' ) } ;
ON PAINT PaintWindow( 'Form_Main' ) ;
ON MOUSECLICK MsgAbout() ;
ON RELEASE fi_Deinitialise() ;
FONT 'MS Sans Serif' SIZE 9
END WINDOW
CENTER WINDOW Form_Main
ACTIVATE WINDOW Form_Main
Return Nil
Static Function PaintWindow( Window )
Local i := GetFormIndex ( Window )
Local FormHandle := _HMG_SYSDATA [ 67 ] [i]
Local hDC := GetDC( FormHandle )
IF handle == Nil
Return -1
ENDIF
FI_WinDraw( handle, hDC, 0, 0, Round( nHeight * nKoef, 0 ), Round( nWidth * nKoef, 0 ) )
ReleaseDC( FormHandle, hDC )
Return 0
Static Function MsgAbout()
return MsgInfo( padc(PROGRAM + VERSION, 40) + CRLF + ;
padc("Copyright " + Chr(169) + COPYRIGHT, 40) + CRLF + CRLF + ;
hb_compiler() + CRLF + version() + CRLF + ;
Left(MiniGuiVersion(), 36) + CRLF + ;
"FreeImage.dll version: "+FI_GetVersion() + CRLF + CRLF + ;
padc("This program is Freeware!", 40), "About..." )