error on compilation c++

error on compilation c++

Postby Silvio.Falconi » Tue Jan 09, 2018 10:02 pm

Until now I insert the code of ICON_EXEREAD on gdiplus.cpp and I can compile it

but now I wish not recompile the gdiplus.cpp file and I wish insert the code of ICON_EXEREAD into my test.prg

I try and I have this error

Code: Select all  Expand view
Progetto: test, Ambiente: bcc7Harbor:
[1]:Harbour.Exe source\test.prg  /m /n0 /gc1 /es2 /a /iC:\Work\fwh\include /iC:\work\HARBOUR\Include /jI18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\HARBOUR\include /oObj\test.c
Harbour 3.2.0dev (r1703231115)
Copyright (c) 1999-2016, http://harbour-project.org/
Compiling 'source\test.prg'...
Lines 4978, Functions/Procedures 4
Generating C source output to 'Obj\test.c'... Done.
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\Work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\HARBOUR\Include  -nObj Obj\test.c
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies, Inc.
Obj\test.c:
Error E2140 source\\test.prg 114: Declaration is not allowed here in function HB_FUN_ICON_EXEREAD
Error E2140 source\\test.prg 115: Declaration is not allowed here in function HB_FUN_ICON_EXEREAD
Error E2496 source\\test.prg 115: Invalid call to uuidof(struct type | variable) in function HB_FUN_ICON_EXEREAD
Error E2451 source\\test.prg 118: Undefined symbol 'GetIcon' in function HB_FUN_ICON_EXEREAD
*** 4 errors in Compile ***



any solution ?
I use Harbour
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: error on compilation c++

Postby Antonio Linares » Wed Jan 10, 2018 7:48 am

Silvio,

Please post here the complete code of test.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error on compilation c++

Postby Silvio.Falconi » Wed Jan 10, 2018 7:58 am

Manuel sad me I cannot publish it on forum because is c++ source code
How resolve?

Code: Select all  Expand view
#include "fivewin.ch"
#include "constant.ch"


//#include ".\include\allegati.ch"




Function  TEST()
   Local aFiles:={}
   Local nNumeroFiles:= 0


             cFolderAllegati:=".\doc\"
             cRecord:="
0014"

            aFiles:= Cerca_Allegati(cFolderAllegati,cRecord,13)

            nNumeroFiles:=len(aFiles)

            If   nNumeroFiles >0
                IF nNumeroFiles >1
                   Msginfo(i18n("
Ho trovato ") +alltrim(str(nNumeroFiles,3))+i18n(" documenti nella cartella"))
                else
                  Msginfo(i18n("
Ho trovato ") +alltrim(str(nNumeroFiles,3))+i18n(" documento nella cartella") )
               Endif
            Else
                Msginfo(i18n("
Non ho trovato nessun documento nella cartella"))
           endif

          //  Allegati(cFolderAllegati,cRecord,aFiles)

            RETURN NIL


//-----------------------------------------------------------------------------------------------------------------------//

Function Cerca_Allegati(cCartella,cRecord,num)
   Local aDocumenti:={}
   Local aDir
   Local cFileDoc:="
"
   Local cString:="
"
   local afiles:=  {}


     // controllo se c'è la cartella allegati  altrimenti la creo
      IF !lIsDir(cCartella)
               Crea_Folder(cCartella)
            Endif

      // prendo tutti i file della cartella
      aDir :=Directory(cCartella+"
*.*" )

      // quanti caratteri ha il crecord + il simbolo "
--" ?
      nNumeroCaratteri:= Len(crecord+"
--") +1

      FOR i := 1 TO LEN( aDir )
           cString := aDir[i,1]
            IF left(cString,num)=cRecord
               aadd( aDocumenti, {SubStr( cstring,  nNumeroCaratteri ),aDir[i,2],aDir[i,3]})
            endif
        NEXT


   aDocumenti      := aSort(aDocumenti,,,{|x,y| UPPER(x[1]) < UPPER(y[1])})
   nNumeroAllegati :=  Len( aDocumenti )

   return  aDocumenti
//-----------------------------------------------------------------------------------------------------------//




//--------------------------------------------------------------------------//


#pragma BEGINDUMP

    #include <windows.h>
    #include <hbapi.h>
    #include <hbvm.h>
    #include <hbapiitm.h>
    #include <hbstack.h>

 #include <commctrl.h>
#include <commoncontrols.h>

//STDAPI SHGetImageList(int iImageList, REFIID riid, void **ppvObj);

HB_FUNC( ICON_EXEREAD )
{
 HICON hico ;
 SHFILEINFO sfi = { 0 };
 LPCTSTR pName = ( LPCTSTR ) hb_parc( 1 ) ;

 SHGetFileInfo(  pName , -1, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX  );

 HIMAGELIST* imageList;
 HRESULT hResult = SHGetImageList( hb_parni( 2 ) , __uuidof(IImageList), (void**)&imageList );

 if(hResult == S_OK) {
   ((IImageList*)imageList)->GetIcon(sfi.iIcon,ILD_NORMAL|ILD_TRANSPARENT , &hico);
  }

 #ifndef _WIN64
    hb_retnl( ( LONG )  hico );
 #else
    hb_retnll( ( LONGLONG ) hico );
 #endif

}

#pragma ENDDUMP


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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: error on compilation c++

Postby karinha » Wed Jan 10, 2018 11:45 am

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7813
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: error on compilation c++

Postby mastintin » Wed Jan 10, 2018 12:02 pm

for bcc7 in prg file ....

Code: Select all  Expand view

//------------------------------------------------------------------------------

#pragma BEGINDUMP

    #include <windows.h>
    #include <hbapi.h>
    #include <hbvm.h>
    #include <hbapiitm.h>
    #include <hbstack.h>

 #include <commctrl.h>
#include <commoncontrols.h>

static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};

HB_FUNC( ICON_EXEREAD )
{

 HICON hico ;
// HIMAGELIST* imageList;
 IImageList *imageList ;
 HRESULT hResult ;
 SHFILEINFO sfi = { 0 };
 LPCTSTR pName = ( LPCTSTR ) hb_parc( 1 ) ;

 SHGetFileInfo(  pName , -1, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX  );


// hResult = SHGetImageList( hb_parni( 2 ) , IID_IImageList, (void**)&imageList );
 hResult = SHGetImageList( hb_parni( 2 ) , &iID_IImageList, (void**)&imageList );

//  hResult = SHGetImageList( hb_parni( 2 ) , __uuidof(IImageList), (void**)&imageList );

 if(hResult == S_OK) {


       hico = ImageList_GetIcon( ( HIMAGELIST ) imageList ,sfi.iIcon, ILD_NORMAL|ILD_TRANSPARENT ) ;


      // imageList->GetIcon(sfi.iIcon,ILD_NORMAL|ILD_TRANSPARENT , &hico);

 //  ((IImageList*)imageList)->GetIcon(sfi.iIcon,ILD_NORMAL|ILD_TRANSPARENT , &hico);
  }

 #ifndef _WIN64
    hb_retnl( ( LONG )  hico );
 #else
    hb_retnll( ( LONGLONG ) hico );
 #endif

}

#pragma ENDDUMP


 


for vc en prg file


Code: Select all  Expand view



#pragma BEGINDUMP

    #include <windows.h>
    #include <hbapi.h>
    #include <hbvm.h>
    #include <hbapiitm.h>
    #include <hbstack.h>

 #include <commctrl.h>
#include <commoncontrols.h>


static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};


HB_FUNC( ICON_EXEREAD )
{

 HICON hico ;
// HIMAGELIST* imageList;
 IImageList *imageList ;
 HRESULT hResult ;
 SHFILEINFO sfi = { 0 };
 LPCTSTR pName = ( LPCTSTR ) hb_parc( 1 ) ;

 SHGetFileInfo(  pName , -1, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX  );


 hResult = SHGetImageList( hb_parni( 2 ) ,iID_IImageList, (void**)&imageList );

 if(hResult == S_OK) {

     hico = ImageList_GetIcon( ( HIMAGELIST ) imageList ,sfi.iIcon, ILD_NORMAL|ILD_TRANSPARENT ) ;

  }

 #ifndef _WIN64
    hb_retnl( ( LONG )  hico );
 #else
    hb_retnll( ( LONGLONG ) hico );
 #endif

}
#pragma ENDDUMP


 


only diference in : iID_IImageList from &iID_IImageList
???
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: error on compilation c++

Postby Silvio.Falconi » Wed Jan 10, 2018 12:16 pm

Manuel Now is compiled and run ok ...thanks
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests