Alternative Gif Control

AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Alternative Gif Control

Post by AntoninoP »

Hello,
I develop an alternative version of Gif Control for FiveWin, I don't like the provider one for two reasons: it saves the resource in a file, it does not manage well the transparent gif...
I resolved the first problem keeping a HGLOBAL with the gif from resource, so loading it in memory.
The second problem is solved using double buffering and the background brush.

Because is a little big, i put the code online: http://amicoperry.altervista.org/data/gif.prg
It uses GDI+ then to compile is necessary use the C++ mode.

feedback are welcomes.
Antonino
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Alternative Gif Control

Post by Antonio Linares »

Antonino,

Many thanks

I copy here its code:

Code: Select all

#include <fivewin.ch>

********** TEST CODE **********
proc main
    LOCAL oWnd, oGif
    DEFINE WINDOW oWnd TITLE "3D objects"
    oGif := GifControl():New(10,10,oWnd,,,"segu0020.gif")
    oGif := GifControl():New(10,100,oWnd,100,100,"TEST_GIF")
    oGif := GifControl():New(10,200,oWnd,,,"TEST_GIF")  
    oGif:lUseDoubleBuffer := .T. // necessary for transparent gif
    ACTIVATE WINDOW oWnd
*******************************

********* GifControl **********
#define COLOR_WINDOW     5
#define COLOR_BTNFACE   15
#define SRCCOPY         0xCC0020

class GifControl FROM TControl
    CLASSDATA lRegistered AS LOGICAL
    DATA oImage
    DATA hGlobal //used in case of load from resource
    DATA aFrameLen
    DATA oTimer
    DATA nCurrFrame
    DATA lUseDoubleBuffer INIT .F.
    
    METHOD New( nRow, nCol, oWnd, nWidth, nHeight, szFileName ) CONSTRUCTOR
    METHOD Display() INLINE ::BeginPaint(),::Paint(),::EndPaint(),0
    METHOD Paint()
    
    METHOD ChangeFrame()
    
    METHOD Destroy()
    
endclass

METHOD New( nRow, nCol, oWnd, nWidth, nHeight, szFileName, nClrPane ) class GifControl  
    ::oImage := GDIBmp():New()
    if file(szFileName)
        ::oImage:hBmp := GDIPlusImageFromFile(szFileName)
    else
        ::hGlobal := CopyResourceInGlobal(GetResources(),szFileName, 10)
        ::oImage:hBmp := GDIPlusImageFromGlobal(::hGlobal)
    endif
    
    ::aFrameLen := GdiPlusImageGetFrameDimensions(::oImage:hBmp)
    
    DEFAULT nRow := 10, nCol := 10, oWnd := GetWndDefault()
    DEFAULT nWidth := ::oImage:GetWidth()-1
    DEFAULT nHeight := ::oImage:GetHeight()-1
    

    ::oWnd := oWnd
    ::nId       := ::GetNewId()
    ::nStyle    := nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
    ::nTop    := nRow
    ::nLeft  := nCol
    ::nBottom  := ::nTop + nHeight - 1
    ::nRight    := ::nLeft + nWidth
    
    if empty(nClrPane)
        //::nClrPane := GetSysColor( COLOR_WINDOW )
        //::nClrPane := GetSysColor(COLOR_BTNFACE)
        ::nClrPane := iif(Upper( oWnd:Classname() ) != "TWINDOW",;
                                GetSysColor( COLOR_BTNFACE ),;
                                oWnd:nClrPane)
    endif
    
    
    ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
    ::oBrush    := TBrush():New( , ::nClrPane )
    
    ::Create()
    oWnd:AddControl( Self )
    
    ::nCurrFrame := -1
    ::ChangeFrame()
return Self 

METHOD Destroy()
    ::Super:Destroy()
    if .not. empty(::hGlobal)
        GlobalFree(::hGlobal)
        ::hGlobal:=nil
    endif
    
    if .not. empty(::oImage)
        //is it necessary? it has the destroyer...
        ::oImage:Destroy()
    endif
    
    if .not. empty(::oTimer)
        ::oTimer:Destroy()
    endif

return nil

METHOD Paint() class GifControl
    local aRect := GetClientRect( ::hWnd )
    local hDCMem, hBmpMem
    local hOldBmp
    LOCAL g
    
    if ::lUseDoubleBuffer
        hDCMem  = CreateCompatibleDC( ::hDC )
        hBmpMem = CreateCompatibleBitmap( ::hDC, aRect[ 4 ], aRect[ 3 ] )
        hOldBmp = SelectObject( hDCMem, hBmpMem )
        g := Graphics():New(hDCMem)
    
        FillRect( hDCMem, aRect, ::oBrush:hBrush )
        
    else
        g := Graphics():New(::hDC)
    endif

    g:DrawImage(::oImage,0,0,aRect[ 4 ], aRect[ 3 ] )
    g:Destroy()

    if ::lUseDoubleBuffer
        BitBlt( ::hDC, 0, 0, aRect[4], aRect[3], hDCMem, 0, 0, SRCCOPY )
        SelectObject( hDCMem, hOldBmp )
        DeleteObject( hBmpMem )
        DeleteDC( hDCMem )
    endif
    
return nil

METHOD ChangeFrame() class GifControl
    LOCAL cS := Self
    ::nCurrFrame++
    //? ::nCurrFrame
    if empty(::aFrameLen)
        return
    endif
    if ::nCurrFrame == len(::aFrameLen)
        ::nCurrFrame := 0
    endif
    GdiPlusImageSelectActiveFrame(::oImage:hBmp,::nCurrFrame)
    
    if empty(::oTimer)
        DEFINE TIMER ::oTimer ;
                     INTERVAL ::aFrameLen[::nCurrFrame+1] ;
                     ACTION cS:ChangeFrame() ; 
                     OF Self
    else
        ::oTimer:DeActivate()
    endif
    ::oTimer:nInterval := ::aFrameLen[::nCurrFrame+1]
    ::oTimer:Activate()
    
    ::Refresh(.F.)
    
return nil
        
    
#pragma BEGINDUMP
#include <hbapi.h>
#include <Windows.h>
#include <gdiplus.h>
using namespace Gdiplus;


HB_FUNC( GDIPLUSIMAGEFROMFILE )
{
    wchar_t *cFileName = hb_mbtowc( hb_parc(1) );
    Image* pImage =  Image::FromFile(cFileName);
    hb_xfree( cFileName );
    hb_retptr(pImage);
}

HB_FUNC( COPYRESOURCEINGLOBAL )
{
    HINSTANCE hInst = ( HINSTANCE ) hb_parnl( 1 );
    
    HRSRC hResource = FindResource(hInst, hb_parc(2), MAKEINTRESOURCE( hb_parni( 3 ) ));
    if (!hResource) { hb_ret(); return; }
    
    DWORD imageSize = SizeofResource(hInst, hResource);
    if (!imageSize) { hb_ret(); return; }
    
    
    const void* pResourceData = LockResource(LoadResource(hInst, hResource));
    if (!pResourceData) { hb_ret(); return; }
    
    HANDLE hBuffer  = GlobalAlloc(GMEM_MOVEABLE, imageSize);
    if (hBuffer)
    {
        void* pBuffer = GlobalLock(hBuffer);
        if (pBuffer)
        {
            memcpy(pBuffer, pResourceData, imageSize);
            GlobalUnlock(hBuffer);
        }
    }
#ifndef _WIN64
    hb_retnl((long)hBuffer);
#else
   hb_parnll((long long)hBuffer);
#endif
}


HB_FUNC( GDIPLUSIMAGEFROMGLOBAL )
{
#ifndef _WIN64
    HGLOBAL hBuffer = ( HGLOBAL ) hb_parnl( 1 );
#else
    HGLOBAL hBuffer = ( HGLOBAL ) hb_parnll( 1 );
#endif
    IStream* pStream = NULL;
    Image* pImage = 0;
    if (CreateStreamOnHGlobal(hBuffer, TRUE, &pStream) == S_OK)
    {
            pImage = Image::FromStream(pStream);
            pStream->Release();
    }
    hb_retptr(pImage);
}

HB_FUNC( GDIPLUSIMAGEGETFRAMEDIMENSIONS )
{
    Image* pImage = (Image*)hb_parptr(1);
    UINT nFrame = pImage->GetFrameDimensionsCount();
    GUID g;
    if(nFrame == 0)
    {
        hb_ret();
        return;
    }
    pImage->GetFrameDimensionsList(&g,1);
    nFrame = pImage->GetFrameCount(&g);
    hb_reta(nFrame);
    
    UINT nSize = pImage->GetPropertyItemSize(PropertyTagFrameDelay);
    PropertyItem* pPropertyItem = (PropertyItem*) malloc(nSize);
    pImage->GetPropertyItem(PropertyTagFrameDelay, nSize, pPropertyItem);
    for(UINT i=0;i<nFrame;i++)
    {
        hb_storvni( ((UINT*)pPropertyItem[0].value)[i]  * 10 , -1, i+1 );
    }
    free(pPropertyItem);
}

HB_FUNC( GDIPLUSIMAGESELECTACTIVEFRAME )
{
    Image* pImage = (Image*)hb_parptr(1);
    GUID g = FrameDimensionTime;
    pImage->SelectActiveFrame(&g, hb_parni(2));
    hb_ret();
}

HB_FUNC( MYDRAW )
{
    Graphics g((HDC)hb_parnl(1));
    Image* i = (Image*)hb_parptr(2);
    g.DrawImage(i,0,0,i->GetWidth(),i->GetHeight());
}


#pragma ENDDUMP 
regards, saludos

Antonio Linares
www.fivetechsoft.com
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: Alternative Gif Control

Post by AntoninoP »

Added support for Dialog ;)

Code: Select all

#include <fivewin.ch>

********** TEST CODE **********
proc main
    LOCAL oWnd, oGif
    DEFINE DIALOG oWnd TITLE "3D objects"
    oGif := GifControl():New(10,10,oWnd,,,"segu0020.gif")
    oGif := GifControl():New(10,100,oWnd,100,100,"TEST_GIF")
    oGif := GifControl():New(10,200,oWnd,,,"TEST_GIF")
    oGif:lUseDoubleBuffer := .T. // necessary for transparent gif
    ACTIVATE DIALOG oWnd
*******************************

********* GifControl **********
#define COLOR_BTNFACE   15
#define SRCCOPY         0xCC0020

class GifControl FROM TControl
    CLASSDATA lRegistered AS LOGICAL
    DATA oImage
    DATA hGlobal //used in case of load from resource
    DATA aFrameLen
    DATA oTimer
    DATA nCurrFrame
    DATA lUseDoubleBuffer INIT .F.

    METHOD New( nRow, nCol, oWnd, nWidth, nHeight, szFileName ) CONSTRUCTOR
    METHOD Display() INLINE ::BeginPaint(),::Paint(),::EndPaint(),0
    METHOD Paint()
    METHOD Initiate( hDlg )

    METHOD ChangeFrame()

    METHOD Destroy()
endclass

METHOD New( nRow, nCol, oWnd, nWidth, nHeight, szFileName, nClrPane ) class GifControl
    ::oImage := GDIBmp():New()
    if file(szFileName)
        ::oImage:hBmp := GDIPlusImageFromFile(szFileName)
    else
        ::hGlobal := CopyResourceInGlobal(GetResources(),szFileName, 10)
        ::oImage:hBmp := GDIPlusImageFromGlobal(::hGlobal)
    endif

    ::aFrameLen := GdiPlusImageGetFrameDimensions(::oImage:hBmp)

    DEFAULT nRow := 10, nCol := 10, oWnd := GetWndDefault()
    DEFAULT nWidth := ::oImage:GetWidth()-1
    DEFAULT nHeight := ::oImage:GetHeight()-1


    ::oWnd := oWnd
    ::nId       := ::GetNewId()
    ::nStyle    := nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
    ::nTop    := nRow
    ::nLeft  := nCol
    ::nBottom  := ::nTop + nHeight - 1
    ::nRight    := ::nLeft + nWidth

    if empty(nClrPane)
        ::nClrPane := iif(Upper( oWnd:Classname() ) != "TWINDOW",;
                                GetSysColor( COLOR_BTNFACE ),;
                                oWnd:nClrPane)
    endif


    ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
    ::oBrush    := TBrush():New( , ::nClrPane )


    ::nCurrFrame := -1
   if ! Empty( oWnd:hWnd )
      ::Create( )
      oWnd:AddControl( Self )
      ::ChangeFrame()
   else
      oWnd:DefControl( Self )
      // In this case?
   endif

return Self

METHOD Initiate( hDlg ) class GifControl

   ::Super:Initiate( hDlg )

   ::ChangeFrame()

return nil


METHOD Destroy() class GifControl
    ::Super:Destroy()
    if .not. empty(::hGlobal)
        GlobalFree(::hGlobal)
        ::hGlobal:=nil
    endif
    if .not. empty(::oImage)
        ::oImage:Destroy()
    endif
    if .not. empty(::oTimer)
        ::oTimer:End()
    endif
return nil

METHOD Paint() class GifControl
    local aRect := GetClientRect( ::hWnd )
    local hDCMem, hBmpMem
    local hOldBmp
    LOCAL g

    if ::lUseDoubleBuffer
        hDCMem  = CreateCompatibleDC( ::hDC )
        hBmpMem = CreateCompatibleBitmap( ::hDC, aRect[ 4 ], aRect[ 3 ] )
        hOldBmp = SelectObject( hDCMem, hBmpMem )
        g := Graphics():New(hDCMem)

        FillRect( hDCMem, aRect, ::oBrush:hBrush )

    else
        g := Graphics():New(::hDC)
    endif

    g:DrawImage(::oImage,0,0,aRect[ 4 ], aRect[ 3 ] )
    g:Destroy()

    if ::lUseDoubleBuffer
        BitBlt( ::hDC, 0, 0, aRect[4], aRect[3], hDCMem, 0, 0, SRCCOPY )
        SelectObject( hDCMem, hOldBmp )
        DeleteObject( hBmpMem )
        DeleteDC( hDCMem )
    endif

return nil

METHOD ChangeFrame() class GifControl
    LOCAL cS := Self
    ::nCurrFrame++
    //? ::nCurrFrame
    if empty(::aFrameLen)
        return nil
    endif
    if ::nCurrFrame == len(::aFrameLen)
        ::nCurrFrame := 0
    endif
    GdiPlusImageSelectActiveFrame(::oImage:hBmp,::nCurrFrame)

    if empty(::oTimer)
        DEFINE TIMER ::oTimer ;
                     INTERVAL ::aFrameLen[::nCurrFrame+1] ;
                     ACTION cS:ChangeFrame() ;
                     OF Self
    else
        ::oTimer:DeActivate()
    endif
    ::oTimer:nInterval := ::aFrameLen[::nCurrFrame+1]
    ::oTimer:Activate()

    ::Refresh(.F.)

return nil


#pragma BEGINDUMP
#include <hbapi.h>
#include <Windows.h>
#include <gdiplus.h>
using namespace Gdiplus;


HB_FUNC( GDIPLUSIMAGEFROMFILE )
{
    wchar_t *cFileName = hb_mbtowc( hb_parc(1) );
    Image* pImage =  Image::FromFile(cFileName);
    hb_xfree( cFileName );
    hb_retptr(pImage);
}

HB_FUNC( COPYRESOURCEINGLOBAL )
{
    HINSTANCE hInst = ( HINSTANCE ) hb_parnl( 1 );

    HRSRC hResource = FindResource(hInst, hb_parc(2), MAKEINTRESOURCE( hb_parni( 3 ) ));
    if (!hResource) { hb_ret(); return; }

    DWORD imageSize = SizeofResource(hInst, hResource);
    if (!imageSize) { hb_ret(); return; }


    const void* pResourceData = LockResource(LoadResource(hInst, hResource));
    if (!pResourceData) { hb_ret(); return; }

    HANDLE hBuffer  = GlobalAlloc(GMEM_MOVEABLE, imageSize);
    if (hBuffer)
    {
        void* pBuffer = GlobalLock(hBuffer);
        if (pBuffer)
        {
            memcpy(pBuffer, pResourceData, imageSize);
            GlobalUnlock(hBuffer);
        }
    }
#ifndef _WIN64
    hb_retnl((long)hBuffer);
#else
   hb_parnll((long long)hBuffer);
#endif
}


HB_FUNC( GDIPLUSIMAGEFROMGLOBAL )
{
#ifndef _WIN64
    HGLOBAL hBuffer = ( HGLOBAL ) hb_parnl( 1 );
#else
    HGLOBAL hBuffer = ( HGLOBAL ) hb_parnll( 1 );
#endif
    IStream* pStream = NULL;
    Image* pImage = 0;
    if (CreateStreamOnHGlobal(hBuffer, TRUE, &pStream) == S_OK)
    {
            pImage = Image::FromStream(pStream);
            pStream->Release();
    }
    hb_retptr(pImage);
}

HB_FUNC( GDIPLUSIMAGEGETFRAMEDIMENSIONS )
{
    Image* pImage = (Image*)hb_parptr(1);
    UINT nFrame = pImage->GetFrameDimensionsCount();
    GUID g;
    if(nFrame == 0)
    {
        hb_ret();
        return;
    }
    pImage->GetFrameDimensionsList(&g,1);
    nFrame = pImage->GetFrameCount(&g);
    hb_reta(nFrame);

    UINT nSize = pImage->GetPropertyItemSize(PropertyTagFrameDelay);
    PropertyItem* pPropertyItem = (PropertyItem*) malloc(nSize);
    pImage->GetPropertyItem(PropertyTagFrameDelay, nSize, pPropertyItem);
    for(UINT i=0;i<nFrame;i++)
    {
        hb_storvni( ((UINT*)pPropertyItem[0].value)[i]  * 10 , -1, i+1 );
    }
    free(pPropertyItem);
}

HB_FUNC( GDIPLUSIMAGESELECTACTIVEFRAME )
{
    Image* pImage = (Image*)hb_parptr(1);
    GUID g = FrameDimensionTime;
    pImage->SelectActiveFrame(&g, hb_parni(2));
    hb_ret();
}

HB_FUNC( MYDRAW )
{
    Graphics g((HDC)hb_parnl(1));
    Image* i = (Image*)hb_parptr(2);
    g.DrawImage(i,0,0,i->GetWidth(),i->GetHeight());
}


#pragma ENDDUMP
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Alternative Gif Control

Post by marca »

I use xHarbour and am not able to compile. It gives a lot of mistakes.
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Alternative Gif Control

Post by Silvio.Falconi »

I think it run only on Harbour
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Alternative Gif Control

Post by Enrico Maria Giordano »

marca wrote:I use xHarbour and am not able to compile. It gives a lot of mistakes.
You have to compile it in C++ mode.

EMG
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Alternative Gif Control

Post by marca »

Enrico Maria Giordano wrote:
marca wrote:I use xHarbour and am not able to compile. It gives a lot of mistakes.
You have to compile it in C++ mode.

EMG
Enrico.

Sorry, but I did not understand what I have to do. Could you post an example?
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Alternative Gif Control

Post by karinha »

Master Enrico,

Code: Select all

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for xHarbour 17.01 - Jan. 2017          xHarbour development power ³Ü
³ (c) FiveTech 1993-2017 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20170215)
Copyright 1999-2017, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'testgif7.prg' and generating preprocessed output to 'testgif7.ppo'...

Done.

Lines 164, Functions/Procedures 7, pCodes 950
Embarcadero C++ 7.30 for Win32 Copyright (c) 1993-2017 Embarcadero Technologies, Inc.
testgif7.c:
Error E2141 c:\bcc73\include\dinkumware\exception 15: Declaration syntax error
Error E2293 c:\bcc73\include\dinkumware\exception 16: ) expected
Error E2141 c:\bcc73\include\dinkumware\exception 17: Declaration syntax error
Error E2293 c:\bcc73\include\dinkumware\exception 18: ) expected
Error E2141 c:\bcc73\include\dinkumware\exception 114: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\exception 145: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\exception 181: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\exception 182: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\exception 183: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\new 15: Declaration syntax error
Error E2453 c:\bcc73\include\dinkumware\new 73: Size of the type 'nothrow_t' is unknown or zero
Error E2141 c:\bcc73\include\dinkumware\new 75: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\new 79: Declaration syntax error
Error E2449 c:\bcc73\include\dinkumware\new 93: Size of 'operator' is unknown or zero
Error E2141 c:\bcc73\include\dinkumware\new 93: Declaration syntax error
Error E2356 c:\bcc73\include\dinkumware\new 95: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 93: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 95: Declaration syntax error
Error E2356 c:\bcc73\include\dinkumware\new 99: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 95: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 99: Declaration syntax error
Error E2092 c:\bcc73\include\dinkumware\new 102: Storage class 'inline' is not allowed here
Error E2356 c:\bcc73\include\dinkumware\new 102: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 99: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 102: Declaration syntax error
Error E2356 c:\bcc73\include\dinkumware\new 116: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 99: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 116: Declaration syntax error
Error E2356 c:\bcc73\include\dinkumware\new 120: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 116: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 120: Declaration syntax error
Error E2092 c:\bcc73\include\dinkumware\new 123: Storage class 'inline' is not allowed here
Error E2356 c:\bcc73\include\dinkumware\new 123: Type mismatch in redeclaration of 'operator'
Error E2344 c:\bcc73\include\dinkumware\new 120: Earlier declaration of 'operator'
Error E2141 c:\bcc73\include\dinkumware\new 123: Declaration syntax error
Error E2449 c:\bcc73\include\dinkumware\new 131: Size of 'operator' is unknown or zero
Error E2141 c:\bcc73\include\dinkumware\new 131: Declaration syntax error
Error E2449 c:\bcc73\include\dinkumware\new 134: Size of 'operator' is unknown or zero
Error E2141 c:\bcc73\include\dinkumware\new 134: Declaration syntax error
Error E2449 c:\bcc73\include\dinkumware\new 137: Size of 'operator' is unknown or zero
Error E2141 c:\bcc73\include\dinkumware\new 137: Declaration syntax error
Error E2356 c:\bcc73\include\dinkumware\cstring 29: Type mismatch in redeclaration of 'memchr'
Error E2344 c:\bcc73\include\windows\crtl\mem.h 81: Earlier declaration of 'memchr'
Error E2141 c:\bcc73\include\dinkumware\cwchar 36: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\cwchar 41: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\iosfwd 19: Declaration syntax error
Error E2141 c:\bcc73\include\dinkumware\iosfwd 107: Declaration syntax error
Error E2040 c:\bcc73\include\dinkumware\iosfwd 126: Declaration terminated incorrectly
Error E2257 c:\bcc73\include\dinkumware\iosfwd 129: , expected
Error E2141 c:\bcc73\include\dinkumware\iosfwd 132: Declaration syntax error
Error E2228 c:\bcc73\include\dinkumware\iosfwd 132: Too many error or warning messages
*** 51 errors in Compile ***
* Linking errors *
 
Regards,
João Santos - São Paulo - Brasil
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Alternative Gif Control

Post by karinha »

Master Enrico, BUILDX.BAT

Code: Select all

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for xHarbour 17.01 - Jan. 2017          xHarbour development power ³Ü
ECHO ³ (c) FiveTech 1993-2017 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

if "%FWDIR%" == "" set FWDIR=.\..\
if "%XHDIR%" == "" set XHDIR=c:\XHBBCC72
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui

set hdir=%XHDIR%
set hdirl=%hdir%\lib
set bcdir=c:\bcc73
set fwh=%FWDIR%


%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
REM %hdir%\bin\harbour %1 /m /n /w1 /es2 /i%fwh%\include;%hdir%\include /w  /p %2 %3 > comp.log 2> warnings.log

IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
@type warnings.log

echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c -v @b32.bc

:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32.exe -r -I%bcdir%\include -I%bcdir%\include\windows\sdk %1
REM IF EXIST %1.rc %bcdir%\bin\brc32.exe -p -I%bcdir%\include -I%bcdir%\include\windows\sdk %1

echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib %fwh%\lib\libmysql.lib + >> b32.bc
rem echo %fwh%\lib\Dolphin.lib + >> b32.bc
echo %fwh%\lib\libmariadb.lib + >> b32.bc
echo %fwh%\lib\libmysqld.lib + >> b32.bc
echo %fwh%\lib\libcurl.lib + >> b32.bc

echo %hdirl%\rtl.lib + >> b32.bc
echo %hdirl%\vm.lib + >> b32.bc
echo %hdirl%\%GT%.lib + >> b32.bc
echo %hdirl%\lang.lib + >> b32.bc
echo %hdirl%\macro.lib + >> b32.bc
echo %hdirl%\rdd.lib + >> b32.bc
echo %hdirl%\dbfntx.lib + >> b32.bc
echo %hdirl%\dbfcdx.lib + >> b32.bc
echo %hdirl%\dbffpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\debug.lib + >> b32.bc
echo %hdirl%\common.lib + >> b32.bc
echo %hdirl%\codepage.lib + >> b32.bc
echo %hdirl%\pp.lib + >> b32.bc
echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\ct.lib + >> b32.bc
echo %hdirl%\pdflib.lib + >> b32.bc
echo %hdirl%\hbzebra.lib + >> b32.bc
echo %hdirl%\zlib.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc
echo %hdirl%\libmisc.lib + >> b32.bc
echo %hdirl%\tip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib + >> b32.bc
rem echo %hdir%\lib\Ace32.lib + >> b32.bc


echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\wininet.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc

rem uncomment this line to use the debugger and comment the following one
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
%1
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c

:COMPILEERRORS
@type comp.log
ECHO * Compile errors *
GOTO EXIT

:LINKERROR
ECHO * Linking errors *
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT
Regards,
João Santos - São Paulo - Brasil
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Alternative Gif Control

Post by Enrico Maria Giordano »

There is no -P switch in that batch file. Please add -P switch here:

Code: Select all

%bcdir%\bin\bcc32 -M -c -v -P @b32.bc
EMG
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Alternative Gif Control

Post by marca »

Enrico Maria Giordano wrote:There is no -P switch in that batch file. Please add -P switch here:

Code: Select all

%bcdir%\bin\bcc32 -M -c -v -P @b32.bc
EMG
Bom dia Enrico.
Inclui o -P e agora da outro erro
┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for xHarbour 14.04 - Apr. 2014 xHarbour development power │▄
│ (c) FiveTech, 1993-2014 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20150518)
Copyright 1999-2015, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'SV_GIFS.prg' and generating preprocessed output to 'SV_GIFS.ppo'...
Generating C source output to 'SV_GIFS.c'...
Done.
Lines 168, Functions/Procedures 7, pCodes 945
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies,
Inc.
sv_gifs.c:
Warning W8022 c:\Language\Borland\include\windows\sdk\GdiplusHeaders.h 636: 'Bit
map::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
Error E2268 SV_GIFS.prg 252: Call to undefined function 'hb_storvni' in function
HB_FUN_GDIPLUSIMAGEGETFRAMEDIMENSIONS()
*** 1 errors in Compile ***
* Linking errors *
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Alternative Gif Control

Post by Enrico Maria Giordano »

hb_storni() is inside harbour.prg that should be included in fiveh.lib. Anyway, this is a stand alone version that you can add to your PRG:

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>

void hb_storvni( int iValue, int iParam, int iIndex )
{
   hb_storni( iValue, iParam, iIndex );
}

#pragma ENDDUMP
EMG
marca
Posts: 104
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil
Contact:

Re: Alternative Gif Control

Post by marca »

Enrico Maria Giordano wrote:hb_storni() is inside harbour.prg that should be included in fiveh.lib. Anyway, this is a stand alone version that you can add to your PRG:

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>

void hb_storvni( int iValue, int iParam, int iIndex )
{
   hb_storni( iValue, iParam, iIndex );
}

#pragma ENDDUMP
EMG

Com o fonte novo

┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for xHarbour 14.04 - Apr. 2014 xHarbour development power │▄
│ (c) FiveTech, 1993-2014 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
xHarbour 1.2.3 Intl. (SimpLex) (Build 20150518)
Copyright 1999-2015, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'sv_gifs.prg' and generating preprocessed output to 'sv_gifs.ppo'...
Generating C source output to 'sv_gifs.c'...
Done.
Lines 169, Functions/Procedures 7, pCodes 945
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies,
Inc.
sv_gifs.c:
Warning W8022 c:\Language\Borland\include\windows\sdk\GdiplusHeaders.h 636: 'Bit
map::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, In
c.
Error: Unresolved external '_HB_FUN_GDIBMP' referenced from C:\LANGUAGE\FWH\SAMP
LES\SV_GIFS.OBJ
Error: Unable to perform link
* Linking errors *

C:\Language\Fwh\samples>
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
Post Reply