Converting from xHarbour to Harbour
Posted: 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() )
I try with DLL call of fivewin but dosn't works
Regards MAurizio
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
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
*/