Converting from xHarbour to Harbour

Converting from xHarbour to Harbour

Postby Maurizio » Mon Sep 22, 2014 10:43 am

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  Expand view  RUN
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  Expand view  RUN
#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
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: Converting from xHarbour to Harbour

Postby Antonio Linares » Mon Sep 22, 2014 11:14 am

Maurizio,

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

GetProcAdd() and FWCallDLL()

thanks
regards, saludos

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

Re: Converting from xHarbour to Harbour

Postby Maurizio » Mon Sep 22, 2014 12:02 pm

Antonio ,
I try
Code: Select all  Expand view  RUN
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
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: Converting from xHarbour to Harbour

Postby Maurizio » Thu Jun 20, 2019 10:40 am

Hello Antonio,
do you have time to return to this problem?

Maurizio
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: Converting from xHarbour to Harbour

Postby Antonio Linares » Thu Jun 20, 2019 3:13 pm

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
regards, saludos

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

Re: Converting from xHarbour to Harbour

Postby Maurizio » Thu Jun 20, 2019 4:49 pm

Thanks Antonio
I send an email

Maurizio
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests