Page 1 of 1

Converting from xHarbour to Harbour

Posted: Mon Sep 22, 2014 10:43 am
by Maurizio
Hello ,
I have a problem with Harbour and DLL call .

I have this function tha work in xHarbour but not in Harbour ( the problem is CallDll() )

Code: Select all

Function LlDefineLayout(nH,nHWin,cTitolo,nTipo,cFile)
 Local cFarProc := GetProcAddress( hDLL,"LlDefineLayout")
 Local nErr := CallDll(cFarProc ,nH ,0 ,cTitolo ,nTipo,cFile )
 Return nErr
I try with DLL call of fivewin but dosn't works

Code: Select all

#include "FiveWin.ch"
#DEFINE LL_OPTION_NEWEXPRESSIONS        0
#DEFINE LL_PROJECT_LABEL                1

Static hDll 

Function Main()
Local oWin

DEFINE WINDOW oWin TITLE "Stampa " FROM 1,1 to 5,5
  Label(oWin)

ACTIVATE WINDOW oWin

return .T.

Function Label(oWin)
 //::nWin      := oWin:hWnd
 LOcal nHandle,nError
 hDll := LoadLibrary("cm32lx.dll" )
 
 if hDll == 0
    MsgInfo( "Non trovo cm32lx.dll" )
    Return nil 
 endif 
 

  nHandle :=  LlJobOpen(1)   // OK 
  
  nError := LlSetOption(nHandle, LL_OPTION_NEWEXPRESSIONS, 1 )   // OK
     
  nError := LlDefineLayout(nHandle , oWin:hWnd , "Title" , LL_PROJECT_LABEL,"Test" )  // ERROR 
  
  Msginfo(nError)
  
  LlJobClose( nHandle )
  FreeLibrary( hDll )   
  
  oWin:End()
Return NIL


//-------------------------------------------------------------------------------------------
DLL32 FUNCTION LlJobOpen( nLanguage AS _INT ) AS _INT ;
      PASCAL FROM "LlJobOpen" ;
      LIB hDll
      
//-------------------------------------------------------------------------------------------
DLL32 FUNCTION LlJobClose( nH AS _INT ) AS _INT ;
      PASCAL FROM "LlJobClose" ;
      LIB hDll
      
      
//-------------------------------------------------------------------------------------------
DLL32 FUNCTION LlSetOption( nH AS _INT ,nMode AS _INT , nValue AS _INT  ) AS _INT ;
      PASCAL FROM "LlSetOption" ;
      LIB hDll

DLL32 FUNCTION LlDefineLayout( nH AS _INT ,nHWin  AS  LONG  ,cTitolo AS  LPSTR ,nTipo AS LONG ,cFile AS  LPSTR ) AS LONG ;
      PASCAL FROM "LlDefineLayout" ;
      LIB hDll

/* THIS WORK WITH XHARBOUR 

Function LlDefineLayout(nH,nHWin,cTitolo,nTipo,cFile)
 Local cFarProc := GetProcAddress( hDLL,"LlDefineLayout")
 Local nErr := CallDll(cFarProc ,nH ,0 ,cTitolo ,nTipo,cFile )
 Return nErr
*/ 
 
Regards MAurizio

Re: Converting from xHarbour to Harbour

Posted: Mon Sep 22, 2014 11:14 am
by Antonio Linares
Maurizio,

Please review FWH\include\dll.ch and there you will see that you have to use:

GetProcAdd() and FWCallDLL()

thanks

Re: Converting from xHarbour to Harbour

Posted: Mon Sep 22, 2014 12:02 pm
by Maurizio
Antonio ,
I try

Code: Select all

DLL32 FUNCTION LlDefineLayout( nH AS LONG ,nHWin  AS  LONG ,cTitolo AS  LPSTR ,nTipo AS LONG ,cFile AS  LPSTR ) AS LONG ;
      PASCAL FROM "LlDefineLayout" ;
      LIB hDll
 
But dosn't work.

The coll is :
the call is

INT LlDefineLayout:(HKOB hjob , HWND hWnd , LPSTR lpszitle , UINT nObjType , LPSTR lpszObjName)



Maurizio

Re: Converting from xHarbour to Harbour

Posted: Thu Jun 20, 2019 10:40 am
by Maurizio
Hello Antonio,
do you have time to return to this problem?

Maurizio

Re: Converting from xHarbour to Harbour

Posted: Thu Jun 20, 2019 3:13 pm
by Antonio Linares
Maurizio,

Please try:

DLL FUNCTION LlDefineLayout ...

instead of:

DLL32 FUNCTION LlDefineLayout ...

If it does not work, then please send me the DLL (wetransfer website) and your PRG example

Re: Converting from xHarbour to Harbour

Posted: Thu Jun 20, 2019 4:49 pm
by Maurizio
Thanks Antonio
I send an email

Maurizio