Usa:
DLL FUNCTION ...
en vez de
DLL32 FUNCTION ...
void CALLBACK CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
MessageBox( 0, "ok", "ok", 0 );
}
void CALLBACK CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
MessageBox( 0, "ok", "ok", 0 );
}
HB_FUNC( CALLBACKFUNCTION )
{
LONG pbx ;
DWORD cmms ;
DWORD par ;
CallBackFunction(pbx,cmms,par );
}
#ifndef _DEVLINK_H_
#define _DEVLINK_H_
typedef char TEXT;
#define DEVLINK_SUCCESS 0
#define DEVLINK_UNSPECIFIEDFAIL 1
#define DEVLINK_LICENCENOTFOUND 2
#define DEVLINK_COMMS_OPERATIONAL 0
#define DEVLINK_COMMS_NORESPONSE 1
#define DEVLINK_COMMS_REJECTED 2
#define DEVLINK_COMMS_MISSEDPACKETS 3
#ifdef __cplusplus
extern "C"
{
#endif
typedef void (CALLBACK * DLCALLLOGEVENT)(
DWORD pbxh,
TEXT * info
);
typedef void (CALLBACK * DLCOMMSEVENT)(
DWORD pbxh,
DWORD comms_state,
DWORD parm1
);
LONG PASCAL DLOpen( DWORD pbxh
, TEXT * pbx_address
, TEXT * pbx_password
, TEXT * reserved1
, TEXT * reserved2
, DLCOMMSEVENT cb
);
LONG PASCAL DLClose( DWORD pbxh );
LONG PASCAL DLRegisterType2CallDeltas( DWORD pbxh, DLCALLLOGEVENT cb );
#ifdef __cplusplus
};
#endif
#endif // _DEVLINK_H_
function main()
DLOpen(1,'255.255.255.255','PWD',nil,nil, CallBackFunction() )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
#include "devlink.h"
void CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
MessageBox( 0, "ok", "ok", 0 );
}
HB_FUNC( CALLBACKFUNCTION )
{
hb_retnl( ( LONG ) CallBackFunction );
}
HB_FUNC( DLOPEN )
{
DLOpen( hb_parnl( 1 ), ( char * ) hb_parc( 2 ), ( char * ) hb_parc( 3 ), ( char * ) hb_parc( 4 ), ( char * ) hb_parc( 5 ), ( DLCOMMSEVENT ) CallBackFunction ) ;
}
HB_FUNC( DLCLOSE )
{
DLClose( hb_parnl( 1 ) ) ;
}
#pragma ENDDUMP
function main()
MsgInfo( CallBackFunction() ) // La llamada devuelve ->4200388 , si comento el messagebox , la llamada a este msgInfo me devuelve el mismo valor -> 4200388
MsgInfo( DLOpen(1,'255.255.255.255','PWD',nil,nil, CallBackFunction() ) // la llamada a la funcion devuelve nil
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
#include "devlink.h"
void CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
MessageBox( 0, "ok", "ok", 0 );
}
HB_FUNC( CALLBACKFUNCTION )
{
hb_retnl( ( LONG ) CallBackFunction );
}
HB_FUNC( DLOPEN )
{
DLOpen( hb_parnl( 1 ), ( char * ) hb_parc( 2 ), ( char * ) hb_parc( 3 ), ( char * ) hb_parc( 4 ), ( char * ) hb_parc( 5 ), ( DLCOMMSEVENT ) CallBackFunction ) ;
}
HB_FUNC( DLCLOSE )
{
DLClose( hb_parnl( 1 ) ) ;
}
#pragma ENDDUMP
HB_FUNC( CALLBACKFUNCTION )
{
LONG pbxh;
DWORD comms_state;
DWORD parm1;
CallBackFunction( pbxh, comms_state, parm1 );
}
Function main()
DLOpen(1,cIp , cPass ,nil,nil, CallBackFunction() )
return nil
DLL function DLOpen( pbxh AS DWORD , ;
pbx_address AS LPSTR,;
pbx_password AS LPSTR,;
reserved1 AS LPSTR,;
reserved2 AS LPSTR,;
cb AS LONG ) AS LONG FROM "DLOpen" lib "devLink.dll"
#pragma BEGINDUMP
#include <Windows.h>
#include <hbapi.h>
void CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
MessageBox( 0, "ok", "ok", 0 );
}
HB_FUNC( CALLBACKFUNCTION )
{
hb_retnl( ( LONG ) CallBackFunction );
}
#pragma ENDDUMP
function CommsEvent( nPbxh, nComms_state, nParm1 )
MsgInfo( nPbhx )
MsgInfo( nComms_state )
MsgInfo( nParm1 )
return nil
#pragma BEGINDUMP
#include <Windows.h>
#include <hbapi.h>
#include <hbvm.h>
void CallBackFunction( LONG pbxh, DWORD comms_state, DWORD parm1 )
{
hb_vmPushSymbol( hb_dynsymGetSymbol( "COMMSEVENT" ) );
hb_vmPushNil();
hb_vmPushLong( pbhx );
hb_vmPushLong( comms_state );
hb_vmPushLong( parm1 );
hb_vmFunction( 3 ); // 3 parámetros
}
HB_FUNC( CALLBACKFUNCTION )
{
hb_retnl( ( LONG ) CallBackFunction );
}
#pragma ENDDUMP
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 62 guests