diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8fef085745..6bd35edc6d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,15 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-21 17:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + + contrib/hbwin/tests/testax.prg + + Added self-contained AX example created by Alex Strickland. + (plus some formatting and warning fix) + + * contrib/hbwin/axfunc.prg + + Added parameter to WIN_AxGetControl(). + Please review it. + 2009-10-21 13:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/hbini.prg ! fixed stripping last character when the last line in ini file diff --git a/harbour/contrib/hbwin/axfunc.prg b/harbour/contrib/hbwin/axfunc.prg index 0e53ecc772..007c7d3606 100644 --- a/harbour/contrib/hbwin/axfunc.prg +++ b/harbour/contrib/hbwin/axfunc.prg @@ -50,12 +50,12 @@ * */ -FUNCTION WIN_AxGetControl( hWnd, bHandler ) +FUNCTION WIN_AxGetControl( hWnd, bHandler, cID ) LOCAL oAx := WIN_OleAuto() oAx:__hObj := __AxGetControl( hWnd ) IF bHandler != NIL - oAx:__hSink := __AxRegisterHandler( oAx:__hObj, bHandler ) + oAx:__hSink := __AxRegisterHandler( oAx:__hObj, bHandler, cID ) ENDIF RETURN oAx diff --git a/harbour/contrib/hbwin/tests/testax.prg b/harbour/contrib/hbwin/tests/testax.prg new file mode 100644 index 0000000000..81b9d92d77 --- /dev/null +++ b/harbour/contrib/hbwin/tests/testax.prg @@ -0,0 +1,53 @@ +/* + * $Id$ + */ + +#include "hbgtinfo.ch" +#include "hbclass.ch" + +REQUEST HB_GT_WVT_DEFAULT + +#define WS_CHILD 1073741824 +#define WS_VISIBLE 268435456 +#define WS_CLIPCHILDREN 33554432 + +PROCEDURE Main() + LOCAL oMSCAL + + WAIT "Make sure we are 'Active Window'" + oMSCAL := HActiveX():Init( WAPI_GetActiveWindow(), "MSCAL.Calendar", 0, 0, 300, 300 ) + WAIT "Press any key to exit" + oMSCAL:Close() + RETURN + +CLASS HActiveX + DATA oOLE + METHOD Init + METHOD Event + ERROR HANDLER OnError +// DESTRUCTOR Close + METHOD Close +ENDCLASS + +METHOD Init( hWnd, cProgId, nTop, nLeft, nWidth, nHeight, cID ) CLASS HActiveX + LOCAL nStyle := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + win_AxInit() + hWnd := WAPI_CreateWindowEX( 0, "AtlAxWin", cProgId, nStyle, nLeft, nTop, nWidth, nHeight, hWnd, 0 ) + ::oOLE := WIN_AxGetControl( hWnd, { | event, ... | ::Event( event, ... ) }, cID ) + RETURN self + +PROCEDURE Event( ... ) CLASS HActiveX + LOCAL cEvents := "" + LOCAL aEvents := { ... } + aEval( aEvents, { | xEvent | cEvents += HB_ValToStr( xEvent ) + ", " } ) + wapi_OutputDebugString( cEvents ) + RETURN + +METHOD OnError() CLASS HActiveX + RETURN HB_ExecFromArray( ::oOLE, __GetMessage(), HB_AParams() ) + +METHOD Close() CLASS HActiveX + wapi_OutputDebugString( "Close" ) + ::oOLE := NIL + wapi_OutputDebugString( "After Close" ) + RETURN NIL