Hola,
Alguien usa con exito esta funcion ( ADSRegCallBack() )?
Saludos.
C.
Note This function is capable of utilizing registered callback functions
FUNCTION Main()
...
USE ORIGEN SHARED NEW
cAliasOrigen := Alias()
USE DESTINO SHARED NEW
cAliasDestino := Alias()
AdsRegCallBack( {|nPercent| outputstuff(nPercent)} )
(cAliasOrigen)->( AdsCopyTableContents( cAliasDestino ) )
AdsClrCallBack()
RETURN nil
AdsRegCallBack( { | nPercent | ProgressUpdate( nPercent ) } )
IF ADSExecuteSQLDirect( cCons )
...
IF ADSCreateSQLStatement( ::cAlias, ::nTblType, ::hAds ) //.or. !ADSVerifySQL( cScript )
oMeter := PROGRESSBAR():New( 100, ::cProgressMsg )
ACTIVATE DIALOG oMeter:oDlg NOWAIT ON INIT oMeter:oDlg:center( WndMain() )
::bProgress := { |n| oMeter:nCount++, oMeter:Update( n ) }
Register_CallBack( { | nPercent | EVAL( ::bProgress, nPercent ) } )
TRY
isgood := ADSExecuteSQLDirect( cSql )
CATCH
isgood := .F.
END
Unregister_callback()
...
*-------------------------------------------------------------------------------------------------------
#pragma BEGINDUMP
#include <windows.h>
#include "ace.h"
#include "hbapi.h"
#include "hbvm.h"
#include "hbapiitm.h"
UNSIGNED32 long _stdcall ShowPercentage( UNSIGNED16 usPercentDone , UNSIGNED32 ulCallbackID );
static PHB_ITEM pBlock;
//---------------------------------------------------------------------------//
HB_FUNC( REGISTER_CALLBACK )
{
pBlock = hb_itemParam( 1 );
hb_retni( AdsRegisterCallbackFunction( ShowPercentage , 1 ) );
}
//---------------------------------------------------------------------------//
HB_FUNC( UNREGISTER_CALLBACK )
{
AdsClearCallbackFunction();
if( pBlock )
{
hb_itemRelease( pBlock );
}
}
//---------------------------------------------------------------------------//
UNSIGNED32 long _stdcall ShowPercentage( UNSIGNED16 usPercentDone, UNSIGNED32 ulCallbackID )
//UNSIGNED32 WINAPI ShowPercentage( UNSIGNED16 usPercentDone, UNSIGNED32 ulCallbackID )
{
PHB_ITEM pPercent = hb_itemPutNI( NULL, usPercentDone );
if( pPercent && pBlock)
{
hb_vmEvalBlockV( pBlock, 1, pPercent );
hb_itemRelease( pPercent );
}
return 0;
}
reinaldocrespo wrote:Hey Frances;
I confirm you are right. I would try not to worry as the code works perfectly. I will look into it soon to see if that waring can be, somehow, pacified.
Best regards,
Reinaldo.
UNSIGNED32 long _stdcall ShowPercentage( UNSIGNED16 usPercentDone, UNSIGNED32 ulCallbackID )
{
PHB_ITEM pPercent = hb_itemPutNI( NULL, usPercentDone );
if( pPercent && pBlock)
{
hb_vmEvalBlockV( pBlock, ulCallbackID /*1*/, pPercent );
hb_itemRelease( pPercent );
}
return 0;
}
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: AngelSalom, gmart1, Google [Bot] and 41 guests