HB_FUNC( CALLEDBACK )
{
if( ISCHAR( 1 ) )
{
DllFuncToCall( (UNSIGNED8*) hb_parcx( 1 ) );
//either you call DllFuncToCall or they are calling your calledback func?
//we write some c code here to manage parameters. I think that's all you
//really need to do.
}
hb_retnl( TRUE );
}
#pragma BEGINDUMP
// Declare Sub WCAPRegisterReceive Lib "wcap.dll" _ (ByVal lpRcvProcedure As Long)
#include <windows.h>
void _export RcvProcedure( char * szXML, LONG lSize )
{
MessageBox( 0, "It is working", szXML, 0 );
}
HB_FUNC( REGISTER )
{
WCAPRegisterReceive( ( LONG ) RcvProcedure );
}
#pragma ENDDUMP
c:\>c:\bcc582\bin\impdef.exe wcap.def wcap.dll
Borland Impdef Version 3.0.22 Copyright (c) 1991, 2000 Inprise Corporation
c:\>
LIBRARY WCAP.DLL
EXPORTS
WCAPConnect @10 ; WCAPConnect
WCAPConnectAS @9 ; WCAPConnectAS
WCAPConnected @8 ; WCAPConnected
WCAPDebugEnable @3 ; WCAPDebugEnable
WCAPDebugEnabled @2 ; WCAPDebugEnabled
WCAPDebugWrite @1 ; WCAPDebugWrite
WCAPDisconnect @7 ; WCAPDisconnect
WCAPRegisterReceive @6 ; WCAPRegisterReceive
WCAPSend @5 ; WCAPSend
WCAPStartServer @4 ; WCAPStartServer
c:\>c:\vc98\bin\lib.exe /def:wcap.def /out:wcap.lib
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
LIB : warning LNK4068: /MACHINE not specified; defaulting to IX86
Creating library wcap.lib and object wcap.exp
c:\>
#INCLUDE "Fivewin.CH"
#pragma BEGINDUMP
// Declare Sub WCAPRegisterReceive Lib "wcap.dll" _ (ByVal lpRcvProcedure As Long)
#include <windows.h>
void _export RcvProcedure( char * szXML, LONG lSize )
{
MessageBox( 0, "It is working", szXML, 0 );
}
HB_FUNC( REGISTER )
{
WCAPRegisterReceive( ( LONG ) RcvProcedure );
}
#pragma ENDDUMP
FUNCTION main // wpac
LOCAL pFunc := HB_FuncPtr( "CalledBack" )
//PRIVATE wcap := LoadLibrary( "wcap.dll" )
PRIVATE cXMLDoc := ""
// Register the procedure
Register( )
// Connect to the server
WCAPConnectAs( 'localhost', 17943, 1 )
dog2 := WCAPConnected()
IF dog2
MsgInfo( "Looks OK" )
ELSE
MsgInfo( dog2 )
ENDIF
// Receive Hello
MsgInfo( cXMLDoc )
WCAPDisconnect( )
FreeLibrary( wcap )
QUIT
RETURN NIL
FUNCTION CalledBack( PC )
cXMLDoc := PC
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 66 guests