diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bc1ca6d392..51cec1b10e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,60 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-27 12:59 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + % -undef/-D Harbour options will be reduced in cross-compilation + scenarios. If a __PLATFORM__* value appears as both -undef and + -D it will be omitted. This results in smaller command line, + plus works around this warning: + 'Warning W0001 Redefinition or duplicate definition of #define __PLATFORM__WINDOWS' + when using the embedded compiler (doesn't seem to happen with + external compiler). + + Added autodetection for mingw64 and mingwarm compilers. It should + now be enough to use -arch=wce on the command line to initiate a + WinCE cross-build if the compiler is setup in the path or using + the embedded installation. So it's recommended to use -arch=wce + instead of -arch=mingwarm from now on. For mingw64 builds, no + extra switch is needed, if in the PATH, it will be autodetected. + ! Added Harbour command to Harbour command line shown in case of + error. + + * contrib/gtwvg/wvgcuig.c + ! Fixed one GCC warning. I'm not sure if this is a correct one, + my only goal was to make the warning disappear and to define + a previously undefined case. + ; TOFIX: This warning still remains, and indicates unsafe code: + wvgsink.c:516: warning: dereferencing pointer 'hSink.33' does break strict-aliasing rules + + * contrib/gtwvg/tests/demoxbp.prg + * contrib/gtwvg/tests/demowvg.prg + ! Fixed hard-wired paths, so that now some more samples + work regardless of Harbour installation dir. + ; NOTE: Never use hard-wired absolute paths inside any Harbour + component. We now have hb_DirBase(), please make use of it. + ; NOTE: For me most of the samples still don't work, AX toolbar icons + don't appear, and most of the AX samples fail with an unclosable + window. + + * contrib/hbwin/axcore.c + * contrib/gtwvg/wvgsink.c + * Moved recently added extra AX functions to GTWVG. + * Kept optimized, hbwin version of HB_AX_ATLCREATEWINDOW(). + * Others renamed and commented: + WIN_AXGETUNKNOWN() -> WVG_AXGETUNKNOWN() + WIN_AXSETVERB -> WVG_AXDOVERB() + ! HB_AX_ATLSETVERB() now accepts HWND pointers, too. + ! HB_AX_ATLAXGETCONTROL() now accepts HWND pointers, too. + ; TOFIX: GTWVG uses HB_AX_* prefix to denote AX function, while + these should be named WVG_AX*(). + ; TODO: Probably the full content, or at least the universally + useful portion of wvgsink.c should eventually go to hbwin, + but all these functions need further cleanups, + and they also have to be renamed. I don't know what we + should stay compatible with so it's difficult to make + any moves. Some test code showing the usefulness of + these function would be probably help. + 2009-05-27 05:34 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/harbour.spec * harbour/mpkg_tgz.sh diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 4be005fc32..2272a58804 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -2743,8 +2743,8 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) oCom:mapEvent( evBtnUp, {|nBtn| if( nBtn == 2, oCom:oParent:sendMessage( WM_CLOSE,0,0 ), NIL ) } ) case nActiveX == 3 - hb_gtInfo( HB_GTI_WINTITLE, 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' ) - oCom:CLSID := 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' + hb_gtInfo( HB_GTI_WINTITLE, 'file://' + hb_DirBase() + 'myharu.pdf' ) + oCom:CLSID := 'file://' + hb_DirBase() + 'myharu.pdf' oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) case nActiveX == 4 @@ -2774,7 +2774,7 @@ Static Function ExeActiveX( nActiveX, oCom, xParam ) // if nActiveX == 1 oCom:AddressBar := .t. - hb_gtInfo( HB_GTI_WINTITLE, IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) + hb_gtInfo( HB_GTI_WINTITLE, IIF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) oCom:Navigate( IF( empty( xParam ), 'http://www.harbour.vouch.info', xParam ) ) elseif nActiveX == 4 @@ -2783,7 +2783,7 @@ Static Function ExeActiveX( nActiveX, oCom, xParam ) oCom:Draw2Clipboard() elseif nActiveX == 5 - oCom:loadMultiPage( 'c:\myharu.pdf', 2 ) + oCom:loadMultiPage( hb_DirBase() + 'myharu.pdf', 2 ) oCom:addGradientBorder( 10, RGB( 12,20,233 ), RGB( 100,255,20 ), 0 ) oCom:drawText( 10,10,'Vouch' ) //oCom:emboss( 3,0 ) @@ -3389,15 +3389,15 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) oTBar:create() - oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) - oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) + oTBar:addItem( "New" , hb_DirBase() + 'v_new.bmp' ) + oTBar:addItem( "Select" , hb_DirBase() + 'v_selct1.bmp' ) oTBar:addItem( ) - oTBar:addItem( "FontDlg" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) - oTBar:addItem( "Tools" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) - oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) + oTBar:addItem( "FontDlg" , hb_DirBase() + 'v_calend.bmp' ) + oTBar:addItem( "Tools" , hb_DirBase() + 'v_lock.bmp' ) + oTBar:addItem( "Index" , hb_DirBase() + 'v_index.bmp' ) oTBar:addItem( ) - oTBar:addItem( "Show" , 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) - oTBar:addItem( "Hide" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) + oTBar:addItem( "Show" , hb_DirBase() + 'v_clclt.bmp' ) + oTBar:addItem( "Hide" , hb_DirBase() + 'v_notes1.bmp' ) RETURN oTBar //----------------------------------------------------------------------// @@ -3798,15 +3798,15 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) oTBar:create() - oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) - oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) + oTBar:addItem( "New" , hb_DirBase() + 'v_new.bmp' ) + oTBar:addItem( "Select" , hb_DirBase() + 'v_selct1.bmp' ) oTBar:addItem( ) - oTBar:addItem( "FontDlg" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) - oTBar:addItem( "Tools" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) - oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) + oTBar:addItem( "FontDlg" , hb_DirBase() + 'v_calend.bmp' ) + oTBar:addItem( "Tools" , hb_DirBase() + 'v_lock.bmp' ) + oTBar:addItem( "Index" , hb_DirBase() + 'v_index.bmp' ) oTBar:addItem( ) - oTBar:addItem( "Show" , 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) - oTBar:addItem( "Hide" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) + oTBar:addItem( "Show" , hb_DirBase() + 'v_clclt.bmp' ) + oTBar:addItem( "Hide" , hb_DirBase() + 'v_notes1.bmp' ) RETURN oTBar diff --git a/harbour/contrib/gtwvg/tests/demoxbp.prg b/harbour/contrib/gtwvg/tests/demoxbp.prg index eedb572298..0030448b9f 100644 --- a/harbour/contrib/gtwvg/tests/demoxbp.prg +++ b/harbour/contrib/gtwvg/tests/demoxbp.prg @@ -355,15 +355,15 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) oTBar:create() - oTBar:addItem( "New" , 'c:\harbour\contrib\gtwvg\tests\v_new.bmp' ) - oTBar:addItem( "Select" , 'c:\harbour\contrib\gtwvg\tests\v_selct1.bmp' ) + oTBar:addItem( "New" , hb_DirBase() + 'v_new.bmp' ) + oTBar:addItem( "Select" , hb_DirBase() + 'v_selct1.bmp' ) oTBar:addItem( ) - oTBar:addItem( "FontDlg" , 'c:\harbour\contrib\gtwvg\tests\v_calend.bmp' ) - oTBar:addItem( "Tools" , 'c:\harbour\contrib\gtwvg\tests\v_lock.bmp' ) - oTBar:addItem( "Index" , 'c:\harbour\contrib\gtwvg\tests\v_index.bmp' ) + oTBar:addItem( "FontDlg" , hb_DirBase() + 'v_calend.bmp' ) + oTBar:addItem( "Tools" , hb_DirBase() + 'v_lock.bmp' ) + oTBar:addItem( "Index" , hb_DirBase() + 'v_index.bmp' ) oTBar:addItem( ) - oTBar:addItem( "Show" , 'c:\harbour\contrib\gtwvg\tests\v_clclt.bmp' ) - oTBar:addItem( "Hide" , 'c:\harbour\contrib\gtwvg\tests\v_notes1.bmp' ) + oTBar:addItem( "Show" , hb_DirBase() + 'v_clclt.bmp' ) + oTBar:addItem( "Hide" , hb_DirBase() + 'v_notes1.bmp' ) RETURN oTBar diff --git a/harbour/contrib/gtwvg/wvgcuig.c b/harbour/contrib/gtwvg/wvgcuig.c index ea1802f87b..b23fa458cf 100644 --- a/harbour/contrib/gtwvg/wvgcuig.c +++ b/harbour/contrib/gtwvg/wvgcuig.c @@ -1551,7 +1551,7 @@ static void hb_wvg_GridHorz( PHB_GTWVT pWVT, PHB_ITEM pArray, RECT *uRect ) void hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ) { PHB_GOBJS gObj = pWVT->gObjs; - int iTop, iLeft, iBottom, iRight; + int iTop = 0, iLeft = 0, iBottom = 0, iRight = 0; int iObjType; while( gObj ) @@ -1763,4 +1763,3 @@ void hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ) } } /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/gtwvg/wvgsink.c b/harbour/contrib/gtwvg/wvgsink.c index 0574497b94..de6553e819 100644 --- a/harbour/contrib/gtwvg/wvgsink.c +++ b/harbour/contrib/gtwvg/wvgsink.c @@ -656,7 +656,7 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) /* HWND hWnd = handle of control container wind PATLAXGETCONTROL AtlAxGetControl; HWND hWnd = NULL; char *lpcclass = hb_parcx( 1 ); - HWND hParent = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 2 ); + HWND hParent = ( ISPOINTER( 2 ) ? ( HWND ) hb_parptr( 2 ) : ( HWND )( HB_PTRDIFF ) hb_parnint( 2 ) ); char *Caption = hb_parcx( 3 ); HMENU id = HB_ISNUM( 4 ) ? ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 4 ) : ( HMENU ) ( HB_PTRDIFF ) -1 ; int x = HB_ISNUM( 5 ) ? hb_parni( 5 ) : 0; @@ -698,29 +698,24 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) /* HWND hWnd = handle of control container wind /*----------------------------------------------------------------------*/ -HB_FUNC( HB_AX_ATLCREATEWINDOW ) /* HWND hWnd = handle of control container window */ +HB_FUNC( HB_AX_ATLCREATEWINDOW ) /* ( hWndContainer, CLSID, menuID=0, x, y, w, h, style, exstyle ) --> pWnd */ { - HWND hWnd; - char *lpcclass = hb_parcx( 1 ); - HWND hParent = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 2 ); - char *Caption = hb_parcx( 3 ); - HMENU id = HB_ISNUM( 4 ) ? ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 4 ) : ( HMENU ) ( HB_PTRDIFF ) -1 ; - int x = HB_ISNUM( 5 ) ? hb_parni( 5 ) : 0; - int y = HB_ISNUM( 6 ) ? hb_parni( 6 ) : 0; - int w = HB_ISNUM( 7 ) ? hb_parni( 7 ) : 0; - int h = HB_ISNUM( 8 ) ? hb_parni( 8 ) : 0; - int Style = HB_ISNUM( 9 ) ? hb_parni( 9 ) : WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - int Exstyle = HB_ISNUM( 10 ) ? hb_parni( 10 ) : 0; + LPTSTR cCaption = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); - LPTSTR cClass = HB_TCHAR_CONVTO( lpcclass ); - LPTSTR cCaption = HB_TCHAR_CONVTO( Caption ); + hb_retptr( ( void * ) ( HB_PTRDIFF ) CreateWindowEx( HB_ISNUM( 9 ) /* Exstyle */, + TEXT( "ATLAXWin" ), + cCaption, + HB_ISNUM( 8 ) ? hb_parni( 8 ) : WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS /* Style */, + hb_parni( 4 ) /* x */, + hb_parni( 5 ) /* y */, + hb_parni( 6 ) /* w */, + hb_parni( 7 ) /* h */, + ( HWND ) hb_parptr( 1 ) /* hParent */, + HB_ISPOINTER( 3 ) ? ( HMENU ) hb_parptr( 3 ) : ( HMENU ) ( HB_PTRDIFF ) -1 /* id */, + GetModuleHandle( NULL ), + NULL ) ); - hWnd = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h, hParent, id, - GetModuleHandle( NULL ), NULL ); HB_TCHAR_FREE( cCaption ); - HB_TCHAR_FREE( cClass ); - - hb_retnint( ( HB_PTRDIFF ) hWnd ); } /*----------------------------------------------------------------------*/ @@ -776,7 +771,7 @@ HB_FUNC( HB_AX_ATLGETUNKNOWN ) /* HWND hWnd = handle of control container window HB_FUNC( HB_AX_ATLSETVERB ) { - HWND hwnd = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ); + HWND hwnd = ( ISPOINTER( 1 ) ? ( HWND ) hb_parptr( 1 ) : ( HWND )( HB_PTRDIFF ) hb_parnint( 1 ) ); if( hwnd ) { @@ -804,3 +799,133 @@ HB_FUNC( HB_AX_ATLSETVERB ) } /*----------------------------------------------------------------------*/ + +#if 0 + +HB_FUNC( WVG_AXGETUNKNOWN ) /* ( hWnd ) --> pUnk */ +{ + IUnknown* pUnk = NULL; + HRESULT lOleError; + + if( ! s_pAtlAxGetControl ) + { + hb_oleSetError( S_OK ); + hb_errRT_BASE_SubstR( EG_UNSUPPORTED, 3012, "ActiveX not initialized", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + return; + } + + lOleError = ( *s_pAtlAxGetControl )( ( HWND ) hb_parptr( 1 ), &pUnk ); + + hb_oleSetError( lOleError ); + + if( lOleError == S_OK ) + hb_retptr( pUnk ); + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + +HB_FUNC( WVG_AXDOVERB ) /* ( hWndAx, iVerb ) --> hResult */ +{ + HWND hWnd = ( HWND ) hb_parptr( 1 ); + IUnknown* pUnk = NULL; + HRESULT lOleError; + + if( ! s_pAtlAxGetControl ) + { + hb_oleSetError( S_OK ); + hb_errRT_BASE_SubstR( EG_UNSUPPORTED, 3012, "ActiveX not initialized", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + return; + } + + lOleError = ( *s_pAtlAxGetControl )( hWnd, &pUnk ); + + if( lOleError == S_OK ) + { + IOleObject *lpOleObject = NULL; + + lOleError = HB_VTBL( pUnk )->QueryInterface( HB_THIS_( pUnk ) HB_ID_REF( IID_IOleObject ), ( void** ) ( void* ) &lpOleObject ); + if( lOleError == S_OK ) + { + IOleClientSite* lpOleClientSite; + + lOleError = HB_VTBL( lpOleObject )->GetClientSite( HB_THIS_( lpOleObject ) &lpOleClientSite ); + if( lOleError == S_OK ) + { + MSG Msg; + RECT rct; + + memset( &Msg, 0, sizeof( MSG ) ); + GetClientRect( hWnd, &rct ); + HB_VTBL( lpOleObject )->DoVerb( HB_THIS_( lpOleObject ) hb_parni( 2 ), &Msg, lpOleClientSite, 0, hWnd, &rct ); + } + } + } + + hb_oleSetError( lOleError ); + + hb_retni( ( int ) lOleError ); +} + +HB_FUNC( __XAXREGISTERHANDLER ) /* ( pDisp, bHandler ) --> pSink */ +{ + IDispatch * pDisp = hb_oleParam( 1 ); + + if( pDisp ) + { + PHB_ITEM pItemBlock = hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ); + + if( pItemBlock ) + { + IConnectionPointContainer* pCPC = NULL; + IEnumConnectionPoints* pEnumCPs = NULL; + IConnectionPoint* pCP = NULL; + HRESULT lOleError; + IID rriid; + + lOleError = HB_VTBL( pDisp )->QueryInterface( HB_THIS_( pDisp ) HB_ID_REF( IID_IConnectionPointContainer ), ( void** ) ( void* ) &pCPC ); + if( lOleError == S_OK && pCPC ) + { + lOleError = HB_VTBL( pCPC )->EnumConnectionPoints( HB_THIS_( pCPC ) &pEnumCPs ); + if( lOleError == S_OK && pEnumCPs ) + { + HRESULT hr = S_OK; + do + { + lOleError = HB_VTBL( pEnumCPs )->Next( HB_THIS_( pEnumCPs ) 1, &pCP, NULL ); + if( lOleError == S_OK ) + { + lOleError = HB_VTBL( pCP )->GetConnectionInterface( HB_THIS_( pCP ) &rriid ); + if( lOleError == S_OK ) + { + DWORD dwCookie = 0; + ISink * pSink = ( ISink* ) hb_gcAlloc( sizeof( ISink ), hb_sink_destructor ); /* TODO: GlobalAlloc GMEM_FIXED ??? */ + pSink->lpVtbl = ( IDispatchVtbl * ) &ISink_Vtbl; + pSink->count = 0; /* We do not need to increment it here, Advise will do it auto */ + pSink->pItemHandler = hb_itemNew( pItemBlock ); + + lOleError = HB_VTBL( pCP )->Advise( HB_THIS_( pCP ) ( IUnknown* ) pSink, &dwCookie ); + + pSink->pConnectionPoint = pCP; + pSink->dwCookie = dwCookie; + hb_retptrGC( pSink ); + hr = 1; + } + else + lOleError = S_OK; + } + } while( hr == S_OK ); + HB_VTBL( pEnumCPs )->Release( HB_THIS( pEnumCPs ) ); + } + HB_VTBL( pCPC )->Release( HB_THIS( pCPC ) ); + } + + hb_oleSetError( lOleError ); + if( lOleError != S_OK ) + hb_errRT_BASE_SubstR( EG_ARG, 3012, "Failed to obtain connection point", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } +} + +#endif diff --git a/harbour/contrib/hbwin/axcore.c b/harbour/contrib/hbwin/axcore.c index f545761d86..a4bdf11527 100644 --- a/harbour/contrib/hbwin/axcore.c +++ b/harbour/contrib/hbwin/axcore.c @@ -146,95 +146,6 @@ HB_FUNC( __AXGETCONTROL ) /* ( hWnd ) --> pDisp */ hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -HB_FUNC( WIN_AXATLGETCONTROL ) -{ - HB_FUNC_EXEC( __AXGETCONTROL ); -} - -HB_FUNC( WIN_AXCREATEWINDOW ) /* ( hWndContainer, CLSID, menuID=0, x, y, w, h, style, exstyle ) --> pWnd */ -{ - LPTSTR cCaption = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); - - hb_retptr( ( void * ) ( HB_PTRDIFF ) CreateWindowEx( HB_ISNUM( 9 ) /* Exstyle */, - TEXT( "ATLAXWin" ), - cCaption, - HB_ISNUM( 8 ) ? hb_parni( 8 ) : WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS /* Style */, - hb_parni( 4 ) /* x */, - hb_parni( 5 ) /* y */, - hb_parni( 6 ) /* w */, - hb_parni( 7 ) /* h */, - ( HWND ) hb_parptr( 1 ) /* hParent */, - HB_ISPOINTER( 3 ) ? ( HMENU ) hb_parptr( 3 ) : ( HMENU ) ( HB_PTRDIFF ) -1 /* id */, - GetModuleHandle( NULL ), - NULL ) ); - - HB_TCHAR_FREE( cCaption ); -} - -HB_FUNC( WIN_AXGETUNKNOWN ) /* ( hWnd ) --> pUnk */ -{ - IUnknown* pUnk = NULL; - HRESULT lOleError; - - if( ! s_pAtlAxGetControl ) - { - hb_oleSetError( S_OK ); - hb_errRT_BASE_SubstR( EG_UNSUPPORTED, 3012, "ActiveX not initialized", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - return; - } - - lOleError = ( *s_pAtlAxGetControl )( ( HWND ) hb_parptr( 1 ), &pUnk ); - - hb_oleSetError( lOleError ); - - if( lOleError == S_OK ) - hb_retptr( pUnk ); - else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); -} - -HB_FUNC( WIN_AXSETVERB ) /* ( hWndAx, iVerb ) --> hResult */ -{ - HWND hWnd = ( HWND ) hb_parptr( 1 ); - IUnknown* pUnk = NULL; - HRESULT lOleError; - - if( ! s_pAtlAxGetControl ) - { - hb_oleSetError( S_OK ); - hb_errRT_BASE_SubstR( EG_UNSUPPORTED, 3012, "ActiveX not initialized", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - return; - } - - lOleError = ( *s_pAtlAxGetControl )( hWnd, &pUnk ); - - if( lOleError == S_OK ) - { - IOleObject *lpOleObject = NULL; - - lOleError = HB_VTBL( pUnk )->QueryInterface( HB_THIS_( pUnk ) HB_ID_REF( IID_IOleObject ), ( void** ) ( void* ) &lpOleObject ); - if( lOleError == S_OK ) - { - IOleClientSite* lpOleClientSite; - - lOleError = HB_VTBL( lpOleObject )->GetClientSite( HB_THIS_( lpOleObject ) &lpOleClientSite ); - if( lOleError == S_OK ) - { - MSG Msg; - RECT rct; - - memset( &Msg, 0, sizeof( MSG ) ); - GetClientRect( hWnd, &rct ); - HB_VTBL( lpOleObject )->DoVerb( HB_THIS_( lpOleObject ) hb_parni( 2 ), &Msg, lpOleClientSite, 0, hWnd, &rct ); - } - } - } - - hb_oleSetError( lOleError ); - - hb_retni( ( int ) lOleError ); -} - HB_FUNC( WIN_AXRELEASEOBJECT ) { IDispatch * pDisp = hb_oleParam( 1 ); @@ -443,65 +354,3 @@ HB_FUNC( __AXREGISTERHANDLER ) /* ( pDisp, bHandler ) --> pSink */ hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } } - -HB_FUNC( __XAXREGISTERHANDLER ) /* ( pDisp, bHandler ) --> pSink */ -{ - IDispatch * pDisp = hb_oleParam( 1 ); - - if( pDisp ) - { - PHB_ITEM pItemBlock = hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ); - - if( pItemBlock ) - { - IConnectionPointContainer* pCPC = NULL; - IEnumConnectionPoints* pEnumCPs = NULL; - IConnectionPoint* pCP = NULL; - HRESULT lOleError; - IID rriid; - - lOleError = HB_VTBL( pDisp )->QueryInterface( HB_THIS_( pDisp ) HB_ID_REF( IID_IConnectionPointContainer ), ( void** ) ( void* ) &pCPC ); - if( lOleError == S_OK && pCPC ) - { - lOleError = HB_VTBL( pCPC )->EnumConnectionPoints( HB_THIS_( pCPC ) &pEnumCPs ); - if( lOleError == S_OK && pEnumCPs ) - { - HRESULT hr = S_OK; - do - { - lOleError = HB_VTBL( pEnumCPs )->Next( HB_THIS_( pEnumCPs ) 1, &pCP, NULL ); - if( lOleError == S_OK ) - { - lOleError = HB_VTBL( pCP )->GetConnectionInterface( HB_THIS_( pCP ) &rriid ); - if( lOleError == S_OK ) - { - DWORD dwCookie = 0; - ISink * pSink = ( ISink* ) hb_gcAlloc( sizeof( ISink ), hb_sink_destructor ); /* TODO: GlobalAlloc GMEM_FIXED ??? */ - pSink->lpVtbl = ( IDispatchVtbl * ) &ISink_Vtbl; - pSink->count = 0; /* We do not need to increment it here, Advise will do it auto */ - pSink->pItemHandler = hb_itemNew( pItemBlock ); - - lOleError = HB_VTBL( pCP )->Advise( HB_THIS_( pCP ) ( IUnknown* ) pSink, &dwCookie ); - - pSink->pConnectionPoint = pCP; - pSink->dwCookie = dwCookie; - hb_retptrGC( pSink ); - hr = 1; - } - else - lOleError = S_OK; - } - } while( hr == S_OK ); - HB_VTBL( pEnumCPs )->Release( HB_THIS( pEnumCPs ) ); - } - HB_VTBL( pCPC )->Release( HB_THIS( pCPC ) ); - } - - hb_oleSetError( lOleError ); - if( lOleError != S_OK ) - hb_errRT_BASE_SubstR( EG_ARG, 3012, "Failed to obtain connection point", HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - } - else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - } -} diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 52f37b631e..c9d666136d 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -150,6 +150,7 @@ REQUEST hbmk_KEYW #define _COMPDET_bBlock 1 #define _COMPDET_cCOMP 2 +#define _COMPDET_cCCPREFIX 3 /* optional */ #define _COMPDETE_bBlock 1 #define _COMPDETE_cARCH 2 @@ -848,7 +849,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) { {|| iif( ( tmp1 := FindInPath( "icl" ) ) != NIL .AND. "itanium" $ Lower( tmp1 ), tmp1, NIL ) }, "iccia64" },; { {|| FindInPath( "icl" ) }, "icc" },; { {|| FindInPath( "cygstart" ) }, "cygwin" },; - { {|| FindInPath( "xcc" ) }, "xcc" } } + { {|| FindInPath( "xcc" ) }, "xcc" },; + { {|| FindInPath( "x86_64-pc-mingw32-gcc" ) }, "mingw64", "x86_64-pc-mingw32-" } } aCOMPSUP := { "mingw", "msvc", "bcc", "owatcom", "icc", "pocc", "xcc", "cygwin",; "mingw64", "msvc64", "msvcia64", "iccia64", "pocc64" } s_aLIBHBGT := { "gtwin", "gtwvt", "gtgui" } @@ -867,7 +869,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) CASE hbmk[ _HBMK_cARCH ] == "wce" aCOMPDET := { { {|| FindInPath( hbmk[ _HBMK_cCCPREFIX ] + "gcc" ) }, "mingwarm" },; { {|| FindInPath( "cl" ) }, "msvcarm" },; - { {|| FindInPath( "pocc" ) }, "poccarm" } } + { {|| FindInPath( "pocc" ) }, "poccarm" },; + { {|| FindInPath( "arm-wince-mingw32ce-gcc" ) }, "mingwarm", "arm-wince-mingw32ce-" } } aCOMPSUP := { "mingwarm", "msvcarm", "poccarm" } s_aLIBHBGT := { "gtwvt", "gtgui" } hbmk[ _HBMK_cGTDEFAULT ] := "gtwvt" @@ -987,6 +990,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) FOR tmp := 1 TO Len( aCOMPDET ) IF ! Empty( cPath_CompC := Eval( aCOMPDET[ tmp ][ _COMPDET_bBlock ] ) ) hbmk[ _HBMK_cCOMP ] := aCOMPDET[ tmp ][ _COMPDET_cCOMP ] + IF Len( aCOMPDET[ tmp ] ) >= _COMPDET_cCCPREFIX + hbmk[ _HBMK_cCCPREFIX ] := aCOMPDET[ tmp ][ _COMPDET_cCCPREFIX ] + ENDIF EXIT ENDIF NEXT @@ -2838,7 +2844,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) ELSE IF ( tmp := hb_compile( "", aCommand ) ) != 0 hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Running Harbour compiler. %1$s" ), hb_ntos( tmp ) ) ) - OutErr( ArrayToList( aCommand ) + hb_osNewLine() ) + OutErr( DirAddPathSep( PathSepToSelf( s_cHB_BIN_INSTALL ) ) + cBin_CompPRG + cBinExt +; + " " + ArrayToList( aCommand ) + hb_osNewLine() ) IF s_lBEEP DoBeep( hbmk, .F. ) ENDIF @@ -4980,77 +4987,99 @@ STATIC FUNCTION commandResult( hbmk, cCommand, nResult ) RETURN cResult STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG ) + LOCAL aUnd + LOCAL aDef + LOCAL cMacro + LOCAL nPos IF !( hbmk[ _HBMK_cARCH ] == hb_Version( HB_VERSION_BUILD_ARCH ) ) .OR. ; hbmk[ _HBMK_cARCH ] == "wce" + aUnd := {} + aDef := {} + #if defined( __PLATFORM__WINDOWS ) - AAdd( aOPTPRG, "-undef:__PLATFORM__WINDOWS" ) + AAdd( aUnd, "__PLATFORM__WINDOWS" ) IF hbmk[ _HBMK_lXHB ] - AAdd( aOPTPRG, "-undef:__PLATFORM__Windows" ) + AAdd( aUnd, "__PLATFORM__Windows" ) ENDIF #if defined( __PLATFORM__WINCE ) - AAdd( aOPTPRG, "-undef:__PLATFORM__WINCE" ) + AAdd( aUnd, "__PLATFORM__WINCE" ) #endif #elif defined( __PLATFORM__DOS ) - AAdd( aOPTPRG, "-undef:__PLATFORM__DOS" ) + AAdd( aUnd, "__PLATFORM__DOS" ) #elif defined( __PLATFORM__OS2 ) - AAdd( aOPTPRG, "-undef:__PLATFORM__OS2" ) + AAdd( aUnd, "__PLATFORM__OS2" ) #elif defined( __PLATFORM__LINUX ) IF hbmk[ _HBMK_lXHB ] - AAdd( aOPTPRG, "-undef:__PLATFORM__Linux" ) + AAdd( aUnd, "__PLATFORM__Linux" ) ENDIF - AAdd( aOPTPRG, "-undef:__PLATFORM__LINUX" ) - AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + AAdd( aUnd, "__PLATFORM__LINUX" ) + AAdd( aUnd, "__PLATFORM__UNIX" ) #elif defined( __PLATFORM__DARWIN ) - AAdd( aOPTPRG, "-undef:__PLATFORM__DARWIN" ) - AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + AAdd( aUnd, "__PLATFORM__DARWIN" ) + AAdd( aUnd, "__PLATFORM__UNIX" ) #elif defined( __PLATFORM__BSD ) - AAdd( aOPTPRG, "-undef:__PLATFORM__BSD" ) - AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + AAdd( aUnd, "__PLATFORM__BSD" ) + AAdd( aUnd, "__PLATFORM__UNIX" ) #elif defined( __PLATFORM__SUNOS ) - AAdd( aOPTPRG, "-undef:__PLATFORM__SUNOS" ) - AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + AAdd( aUnd, "__PLATFORM__SUNOS" ) + AAdd( aUnd, "__PLATFORM__UNIX" ) #elif defined( __PLATFORM__HPUX ) - AAdd( aOPTPRG, "-undef:__PLATFORM__HPUX" ) - AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + AAdd( aUnd, "__PLATFORM__HPUX" ) + AAdd( aUnd, "__PLATFORM__UNIX" ) #endif DO CASE CASE hbmk[ _HBMK_cARCH ] == "wce" - AAdd( aOPTPRG, "-D__PLATFORM__WINDOWS" ) - AAdd( aOPTPRG, "-D__PLATFORM__WINCE" ) + AAdd( aDef, "__PLATFORM__WINDOWS" ) + AAdd( aDef, "__PLATFORM__WINCE" ) IF hbmk[ _HBMK_lXHB ] - AAdd( aOPTPRG, "-D__PLATFORM__Windows" ) + AAdd( aDef, "__PLATFORM__Windows" ) ENDIF CASE hbmk[ _HBMK_cARCH ] == "win" - AAdd( aOPTPRG, "-D__PLATFORM__WINDOWS" ) + AAdd( aDef, "__PLATFORM__WINDOWS" ) IF hbmk[ _HBMK_lXHB ] - AAdd( aOPTPRG, "-D__PLATFORM__Windows" ) + AAdd( aDef, "__PLATFORM__Windows" ) ENDIF CASE hbmk[ _HBMK_cARCH ] == "dos" - AAdd( aOPTPRG, "-D__PLATFORM__DOS" ) + AAdd( aDef, "__PLATFORM__DOS" ) CASE hbmk[ _HBMK_cARCH ] == "os2" - AAdd( aOPTPRG, "-D__PLATFORM__OS2" ) + AAdd( aDef, "__PLATFORM__OS2" ) CASE hbmk[ _HBMK_cARCH ] == "linux" - AAdd( aOPTPRG, "-D__PLATFORM__LINUX" ) - AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + AAdd( aDef, "__PLATFORM__LINUX" ) + AAdd( aDef, "__PLATFORM__UNIX" ) IF hbmk[ _HBMK_lXHB ] - AAdd( aOPTPRG, "-D__PLATFORM__Linux" ) + AAdd( aDef, "__PLATFORM__Linux" ) ENDIF CASE hbmk[ _HBMK_cARCH ] == "darwin" - AAdd( aOPTPRG, "-D__PLATFORM__DARWIN" ) - AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + AAdd( aDef, "__PLATFORM__DARWIN" ) + AAdd( aDef, "__PLATFORM__UNIX" ) CASE hbmk[ _HBMK_cARCH ] == "bsd" - AAdd( aOPTPRG, "-D__PLATFORM__BDS" ) - AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + AAdd( aDef, "__PLATFORM__BDS" ) + AAdd( aDef, "__PLATFORM__UNIX" ) CASE hbmk[ _HBMK_cARCH ] == "sunos" - AAdd( aOPTPRG, "-D__PLATFORM__SUNOS" ) - AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + AAdd( aDef, "__PLATFORM__SUNOS" ) + AAdd( aDef, "__PLATFORM__UNIX" ) CASE hbmk[ _HBMK_cARCH ] == "hpux" - AAdd( aOPTPRG, "-D__PLATFORM__HPUX" ) - AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + AAdd( aDef, "__PLATFORM__HPUX" ) + AAdd( aDef, "__PLATFORM__UNIX" ) ENDCASE + + /* Delete macros present in both lists */ + FOR EACH cMacro IN aUnd DESCEND + IF ( nPos := AScan( aDef, {| tmp | tmp == cMacro } ) ) > 0 + hb_ADel( aUnd, cMacro:__enumIndex(), .T. ) + hb_ADel( aDef, nPos, .T. ) + ENDIF + NEXT + + FOR EACH cMacro IN aUnd + AAdd( aOPTPRG, "-undef:" + cMacro ) + NEXT + FOR EACH cMacro IN aDef + AAdd( aOPTPRG, "-D" + cMacro ) + NEXT ENDIF RETURN