2009-12-11 17:00 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/wvgwin.c
* harbour/contrib/gtwvg/wvgsink.c
* harbour/contrib/gtwvg/wvgax.prg
* harbour/contrib/gtwvg/wvgdlg.prg
* harbour/contrib/gtwvg/wvgmenub.prg
* harbour/contrib/gtwvg/wvgparts.ch
* harbour/contrib/gtwvg/wvgphdlr.prg
* harbour/contrib/gtwvg/wvgstatc.prg
* harbour/contrib/gtwvg/wvgtoolb.prg
* harbour/contrib/gtwvg/wvgwnd.prg
! Numerous enhancements and fixes, difficult to remember as
most are spread over a long time and where I had no means
to update them. But all are synchronized with changes
effected till date by others.
This commit is contained in:
@@ -8,6 +8,22 @@
|
||||
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2009-12-11 17:00 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/gtwvg/wvgwin.c
|
||||
* harbour/contrib/gtwvg/wvgsink.c
|
||||
* harbour/contrib/gtwvg/wvgax.prg
|
||||
* harbour/contrib/gtwvg/wvgdlg.prg
|
||||
* harbour/contrib/gtwvg/wvgmenub.prg
|
||||
* harbour/contrib/gtwvg/wvgparts.ch
|
||||
* harbour/contrib/gtwvg/wvgphdlr.prg
|
||||
* harbour/contrib/gtwvg/wvgstatc.prg
|
||||
* harbour/contrib/gtwvg/wvgtoolb.prg
|
||||
* harbour/contrib/gtwvg/wvgwnd.prg
|
||||
! Numerous enhancements and fixes, difficult to remember as
|
||||
most are spread over a long time and where I had no means
|
||||
to update them. But all are synchronized with changes
|
||||
effected till date by others.
|
||||
|
||||
2009-02-12 01:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/vm/extend.c
|
||||
* formatting
|
||||
|
||||
@@ -90,6 +90,7 @@ CLASS WvgActiveXControl FROM TOleAuto, WvgWindow
|
||||
DATA visible INIT .T.
|
||||
DATA default INIT .F.
|
||||
DATA cancel INIT .F.
|
||||
DATA hObj
|
||||
|
||||
DATA interface
|
||||
DATA interfaceName
|
||||
@@ -100,6 +101,9 @@ CLASS WvgActiveXControl FROM TOleAuto, WvgWindow
|
||||
DATA hContainer
|
||||
DATA hSink
|
||||
|
||||
|
||||
DATA hhOBJ
|
||||
|
||||
METHOD New()
|
||||
METHOD Create()
|
||||
METHOD Destroy()
|
||||
@@ -141,7 +145,7 @@ METHOD New( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgActiv
|
||||
RETURN Self
|
||||
//----------------------------------------------------------------------//
|
||||
METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLicense ) CLASS WvgActiveXControl
|
||||
LOCAL hx
|
||||
LOCAL hx, pUnk
|
||||
|
||||
::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
|
||||
|
||||
@@ -164,15 +168,28 @@ METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLic
|
||||
|
||||
::nID := ::oParent:GetControlId()
|
||||
|
||||
#if 1
|
||||
::hObj := HB_AX_AtlAxGetControl( "ATLAXWin", ::hContainer, ::CLSID, ::nID, ;
|
||||
::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ::style, ::exStyle, @hx )
|
||||
::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ;
|
||||
::style, ::exStyle, NIL, @hx, @pUnk )
|
||||
#else
|
||||
::hObj := HB_AX_AtlAxCreateControl( "ATLAXWin", ::hContainer, ::CLSID, ::nID, ;
|
||||
::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ;
|
||||
::style, ::exStyle, NIL, @hx, @pUnk )
|
||||
#endif
|
||||
if ::hObj == 0
|
||||
Return NIL
|
||||
endif
|
||||
|
||||
// Required as to AddRef() to self
|
||||
//
|
||||
TOleAuto():New( ::hObj )
|
||||
|
||||
::oParent:addChild( SELF )
|
||||
::hWnd := hx
|
||||
|
||||
HB_AX_AtlSetVerb( ::hWnd, pUnk, -4 )
|
||||
|
||||
IF ::hObj <> 0 .AND. !Empty( ::hEvents )
|
||||
::AdviseEvents()
|
||||
ENDIF
|
||||
|
||||
@@ -81,6 +81,7 @@ CLASS WvgDialog FROM WvgWindow
|
||||
DATA aRect
|
||||
|
||||
DATA drawingArea
|
||||
DATA tasklist INIT .t.
|
||||
|
||||
METHOD init()
|
||||
METHOD create()
|
||||
@@ -99,7 +100,6 @@ CLASS WvgDialog FROM WvgWindow
|
||||
METHOD calcFrameRect() INLINE ::aRect := Win_GetWindowRect( ::hWnd ),;
|
||||
{ ::aRect[ 1 ], ::aRect[ 2 ], ;
|
||||
::aRect[ 3 ]-::aRect[ 1 ], ::aRect[ 4 ]-::aRect[ 2 ] }
|
||||
|
||||
ENDCLASS
|
||||
//----------------------------------------------------------------------//
|
||||
METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDialog
|
||||
@@ -113,7 +113,7 @@ METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDial
|
||||
|
||||
::style := WS_THICKFRAME+WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX;
|
||||
|
||||
::drawingArea := Self
|
||||
//::drawingArea := Self
|
||||
|
||||
RETURN Self
|
||||
//----------------------------------------------------------------------//
|
||||
@@ -134,7 +134,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi
|
||||
|
||||
if ::visible
|
||||
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL )
|
||||
else
|
||||
ELSE
|
||||
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_HIDE )
|
||||
endif
|
||||
|
||||
@@ -162,6 +162,12 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi
|
||||
::lHasInputFocus := .t.
|
||||
endif
|
||||
|
||||
#if 0
|
||||
::drawingArea := WvgStatic():New( self, , {0,0}, {self:currentSize()[1],self:currentSize()[2]}, , .t. )
|
||||
::drawingArea:create()
|
||||
#else
|
||||
::drawingArea := Self
|
||||
#endif
|
||||
hb_gtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| ::notifier( nEvent, ... ) } )
|
||||
|
||||
RETURN Self
|
||||
@@ -225,3 +231,4 @@ METHOD menuBar() CLASS WvgDialog
|
||||
RETURN ::oMenu
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
@@ -582,8 +582,20 @@ METHOD setTitle( cTitle )
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
METHOD popUp() CLASS wvgMenu
|
||||
METHOD popUp( oXbp, aPos, nDefaultItem, nControl ) CLASS wvgMenu
|
||||
LOCAL nCmd, aMenuItem
|
||||
|
||||
RETURN Self
|
||||
HB_SYMBOL_UNUSED( nDefaultItem )
|
||||
HB_SYMBOL_UNUSED( nControl )
|
||||
|
||||
nCmd := Win_TrackPopupMenu( ::hMenu, TPM_LEFTALIGN + TPM_TOPALIGN + TPM_RETURNCMD, aPos[ 1 ], aPos[ 2 ], oXbp:hWnd )
|
||||
|
||||
aMenuItem := ::findMenuItemById( nCmd )
|
||||
IF hb_isArray( aMenuItem ) .and. hb_isBlock( aMenuItem[ 2 ] )
|
||||
Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] )
|
||||
ENDIF
|
||||
|
||||
RETURN 0
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
|
||||
@@ -183,6 +183,8 @@
|
||||
#define WVGSLE_RIGHT 2
|
||||
#define WVGSLE_CENTER 3
|
||||
|
||||
#define WVGMENUBAR_MIS_SEPARATOR 4
|
||||
#define WVGMENUBAR_MIS_BUTTONSEPARATOR 512
|
||||
|
||||
|
||||
#endif // #ifndef _WVG_CH
|
||||
|
||||
@@ -357,12 +357,12 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
CASE xParams[ 1 ] == 1 // enter menu loop
|
||||
CASE xParams[ 1 ] == 1 .and. hb_isObject( ::oMenu ) // enter menu loop
|
||||
IF hb_isBlock( ::oMenu:sl_beginMenu )
|
||||
Eval( ::oMenu:sl_beginMenu, NIL, NIL, Self )
|
||||
ENDIF
|
||||
|
||||
CASE xParams[ 1 ] == 2 // exit menu loop
|
||||
CASE xParams[ 1 ] == 2 .and. hb_isObject( ::oMenu ) // exit menu loop
|
||||
IF hb_isBlock( ::oMenu:sl_endMenu )
|
||||
Eval( ::oMenu:sl_endMenu, NIL, NIL, Self )
|
||||
ENDIF
|
||||
|
||||
@@ -124,6 +124,7 @@ typedef BOOL ( CALLBACK *PATLAXWINTERM )( void );
|
||||
typedef HRESULT ( CALLBACK *PATLAXGETCONTROL )( HWND, IUnknown** );
|
||||
typedef HRESULT ( CALLBACK *PATLAXATTACHCONTROL )( HWND, IUnknown** );
|
||||
typedef HRESULT ( CALLBACK *PATLAXCREATECONTROL )( LPCOLESTR, HWND, IStream*, IUnknown** );
|
||||
typedef HRESULT ( CALLBACK *PATLAXCREATECONTROLEX )( LPCOLESTR, HWND, IStream*, IUnknown**, IUnknown**, REFIID, IUnknown* );
|
||||
//----------------------------------------------------------------------//
|
||||
HB_EXPORT void hb_oleItemToVariant( VARIANT *pVariant, PHB_ITEM pItem );
|
||||
|
||||
@@ -265,7 +266,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
IEventHandler* lpVtbl;
|
||||
DWORD count;
|
||||
int count;
|
||||
IConnectionPoint* pIConnectionPoint; // Ref counted of course.
|
||||
DWORD dwEventCookie;
|
||||
char* parent_on_invoke;
|
||||
@@ -363,9 +364,9 @@ hb_ToOutDebug( "static ULONG STDMETHODCALLTYPE Release( IEventHandler *this )->c
|
||||
GlobalFree( ( MyRealIEventHandler * ) this );
|
||||
}
|
||||
//hb_ToOutDebug( " ULONG STDMETHODCALLTYPE Release( IEventHandler *this )->this" );
|
||||
return( (ULONG) 0 );
|
||||
return( ( ULONG ) 0 );
|
||||
}
|
||||
return( ( ( MyRealIEventHandler * ) this )->count < 0 ? ( ( MyRealIEventHandler * ) this )->count : 0 );
|
||||
return( ( ULONG ) ( ( MyRealIEventHandler * ) this )->count < 0 ? ( ( MyRealIEventHandler * ) this )->count : 0 );
|
||||
}
|
||||
//----------------------------------------------------------------------//
|
||||
//
|
||||
@@ -473,7 +474,7 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
|
||||
for( i = 1; i <= iArg; i++ )
|
||||
{
|
||||
pItem = hb_itemNew( NULL );
|
||||
hb_oleVariantToItem( pItem, &( params->rgvarg[ iArg-i ] ) ); // VARIANT *pVariant )
|
||||
hb_oleVariantToItem( pItem, &( params->rgvarg[ iArg-i ] ) );
|
||||
pItemArray[ i-1 ] = pItem;
|
||||
ulRefMask |= ( 1L << (i-1) ); // set bit i
|
||||
}
|
||||
@@ -782,6 +783,17 @@ HB_FUNC( HB_AX_ATLAXWININIT )
|
||||
hb_retl( bRet );
|
||||
}
|
||||
//---------------------------------------------------------------------------//
|
||||
/*
|
||||
ATLAPI AtlAxCreateControlEx(
|
||||
LPCOLESTR lpszName,
|
||||
HWND hWnd,
|
||||
IStream* pStream,
|
||||
IUnknown** ppUnkContainer,
|
||||
IUnknown** ppUnkControl,
|
||||
REFIID iidSink = IID_NULL,
|
||||
IUnknown* punkSink = NULL
|
||||
);
|
||||
*/
|
||||
HB_FUNC( HB_AX_ATLAXCREATECONTROL )
|
||||
{
|
||||
IUnknown *pUnk;
|
||||
@@ -802,6 +814,11 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL )
|
||||
int Style = ISNIL( 9 ) ? WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS : hb_parni( 9 );
|
||||
int Exstyle = ISNIL( 10 ) ? 0 : hb_parni( 10 );
|
||||
|
||||
//char *lpLic = ISNIL( 11 ) ? NULL : hb_parc( 11 );
|
||||
//REFIID *iidSink = IID_NULL;
|
||||
//IUnknown *pUnk, *pUnkCtrl, pUnkSink;
|
||||
|
||||
|
||||
#if defined( UNICODE ) && defined( GetProcAddress )
|
||||
AtlAxCreateControl = ( PATLAXCREATECONTROL ) GetProcAddressW( hLib, TEXT( "AtlAxCreateControl" ) );
|
||||
#else
|
||||
@@ -811,28 +828,55 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL )
|
||||
{
|
||||
LPTSTR cCaption = HB_TCHAR_CONVTO( Caption );
|
||||
LPTSTR cClass = HB_TCHAR_CONVTO( class );
|
||||
hContainer = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h, hParent, id, GetModuleHandle( NULL ), NULL );
|
||||
#if 0
|
||||
hContainer = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h,
|
||||
hParent, id, GetModuleHandle( NULL ), NULL );
|
||||
#else
|
||||
hContainer = ( HWND ) CreateWindowEx( Exstyle, cClass, TEXT(""), Style, x, y, w, h,
|
||||
hParent, id, GetModuleHandle( NULL ), NULL );
|
||||
#endif
|
||||
HB_TCHAR_FREE( cCaption );
|
||||
HB_TCHAR_FREE( cClass );
|
||||
HB_TCHAR_FREE( cClass );
|
||||
|
||||
if( hContainer )
|
||||
{
|
||||
LPARAM lParam = MAKELPARAM( FALSE, 0 );
|
||||
SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ), lParam );
|
||||
|
||||
uLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, NULL, 0 );
|
||||
wString = ( BSTR ) malloc( uLen * sizeof( WCHAR ) );
|
||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, wString, uLen );
|
||||
|
||||
//( AtlAxCreateControl ) ( wString, hContainer, NULL, &pUnk, &pUnkCtrl, NULL, &pUnkSink );
|
||||
( AtlAxCreateControl ) ( wString, hContainer, NULL, &pUnk );
|
||||
|
||||
free( wString );
|
||||
|
||||
pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, ( void** ) (void*) &obj );
|
||||
pUnk->lpVtbl->Release( pUnk );
|
||||
hb_retnl( ( long ) obj );
|
||||
#if 1
|
||||
if( pUnk )
|
||||
{
|
||||
pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, ( void** ) (void*) &obj );
|
||||
pUnk->lpVtbl->Release( pUnk );
|
||||
hb_retnint( ( long ) obj );
|
||||
|
||||
GetClientRect( hContainer, &rc );
|
||||
MoveWindow( GetDlgItem( hContainer, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE );
|
||||
GetClientRect( hContainer, &rc );
|
||||
MoveWindow( GetDlgItem( hContainer, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE );
|
||||
}
|
||||
#else
|
||||
if( pUnkCtrl )
|
||||
{
|
||||
pUnkCtrl->lpVtbl->QueryInterface( pUnkCtrl, &IID_IDispatch, ( void** ) (void*) &obj );
|
||||
pUnkCtrl->lpVtbl->Release( pUnkCtrl );
|
||||
hb_retnint( ( long ) obj );
|
||||
|
||||
GetClientRect( hContainer, &rc );
|
||||
MoveWindow( GetDlgItem( hContainer, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE );
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
hb_retnint( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -845,12 +889,15 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL )
|
||||
}
|
||||
|
||||
// return the container handle
|
||||
if ISBYREF( 11 )
|
||||
if ISBYREF( 12 )
|
||||
{
|
||||
hb_stornl( ( long ) hContainer, 11 );
|
||||
hb_stornl( ( long ) hContainer, 12 );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------//
|
||||
// ::hObj := HB_AX_AtlAxGetControl( "ATLAXWin", ::hContainer, ::CLSID, ::nID, ;
|
||||
// ::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ::style, ::exStyle, @hx )
|
||||
//
|
||||
HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container window
|
||||
{
|
||||
IUnknown *pUnk = NULL;
|
||||
@@ -868,6 +915,7 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
|
||||
int h = ISNIL( 8 ) ? 0 : hb_parni( 8 );
|
||||
int Style = ISNIL( 9 ) ? WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS : hb_parni( 9 );
|
||||
int Exstyle = ISNIL( 10 ) ? 0 : hb_parni( 10 );
|
||||
char *lpLic = ISNIL( 11 ) ? NULL : hb_parc( 11 );
|
||||
|
||||
#if defined( UNICODE ) && defined( GetProcAddress )
|
||||
AtlAxGetControl = ( PATLAXGETCONTROL ) GetProcAddressW( hLib, TEXT( "AtlAxGetControl" ) );
|
||||
@@ -878,9 +926,18 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
|
||||
{
|
||||
LPTSTR cCaption = HB_TCHAR_CONVTO( Caption );
|
||||
LPTSTR cClass = HB_TCHAR_CONVTO( lpcclass );
|
||||
hWnd = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h, hParent, id, GetModuleHandle( NULL ), NULL );
|
||||
LPTSTR cLic = HB_TCHAR_CONVTO( lpLic );
|
||||
|
||||
if( ISNIL( 11 ) )
|
||||
hWnd = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h, hParent, id,
|
||||
GetModuleHandle( NULL ), NULL );
|
||||
else
|
||||
hWnd = ( HWND ) CreateWindowEx( Exstyle, cClass, cCaption, Style, x, y, w, h, hParent, id,
|
||||
GetModuleHandle( NULL ), NULL /*cLic*/ );
|
||||
|
||||
HB_TCHAR_FREE( cCaption );
|
||||
HB_TCHAR_FREE( cClass );
|
||||
HB_TCHAR_FREE( cLic );
|
||||
|
||||
if( hWnd )
|
||||
{
|
||||
@@ -888,38 +945,74 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
|
||||
( ( UINT ) WM_SETFONT ),
|
||||
( ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ) ),
|
||||
( ( LPARAM ) ( MAKELPARAM( FALSE, 0 ) ) ) );
|
||||
|
||||
( AtlAxGetControl )( hWnd, &pUnk );
|
||||
|
||||
if( pUnk )
|
||||
{
|
||||
pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, ( void** ) (void*) &obj );
|
||||
pUnk->lpVtbl->Release( pUnk );
|
||||
GetClientRect( hParent, &rc );
|
||||
GetClientRect( hWnd, &rc );
|
||||
MoveWindow( GetDlgItem( hParent, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE );
|
||||
hb_retnint( ( long ) obj );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl( 0 );
|
||||
hb_retnint( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl( 0 );
|
||||
hb_retnint( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl( 0 );
|
||||
hb_retnint( 0 );
|
||||
}
|
||||
|
||||
// return the control handle
|
||||
if ISBYREF( 11 )
|
||||
if ISBYREF( 12 )
|
||||
{
|
||||
hb_stornint( ( long ) hWnd, 11 );
|
||||
hb_stornint( ( long ) hWnd, 12 );
|
||||
}
|
||||
if ISBYREF( 13 )
|
||||
{
|
||||
hb_stornint( ( long ) pUnk, 13 );
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
HB_FUNC( HB_AX_ATLSETVERB )
|
||||
{
|
||||
HWND hwnd = ( HWND ) hb_parnint( 1 );
|
||||
|
||||
if( hwnd )
|
||||
{
|
||||
IUnknown *pUnk = ( IUnknown* ) hb_parnint( 2 );
|
||||
|
||||
IOleObject *lpOleObject = NULL;
|
||||
if( SUCCEEDED( pUnk->lpVtbl->QueryInterface( pUnk, &IID_IOleObject, ( void** ) &lpOleObject ) ) );
|
||||
{
|
||||
IOleClientSite* lpOleClientSite;
|
||||
|
||||
pUnk->lpVtbl->Release( pUnk );
|
||||
|
||||
if( SUCCEEDED( lpOleObject->lpVtbl->GetClientSite( lpOleObject, &lpOleClientSite ) ) )
|
||||
{
|
||||
MSG Msg;
|
||||
RECT rct;
|
||||
|
||||
memset( &Msg, 0, sizeof( MSG ) );
|
||||
GetClientRect( hwnd, &rct );
|
||||
|
||||
lpOleObject->lpVtbl->DoVerb( lpOleObject, hb_parni( 3 ), &Msg, lpOleClientSite, 0, hwnd, &rct );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------//
|
||||
//
|
||||
// terminate activex suport, free the library
|
||||
//
|
||||
@@ -947,6 +1040,7 @@ HB_FUNC( HB_AX_ATLAXWINTERM )
|
||||
}
|
||||
hb_retl( bRet );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
// Load Type Info
|
||||
//----------------------------------------------------------------------//
|
||||
@@ -963,8 +1057,12 @@ typedef struct {
|
||||
WORD* m_pParamTypes; // parameter type array
|
||||
} DispInfo;
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
#if 0
|
||||
|
||||
|
||||
//=================================================
|
||||
// BUGGY experimental, untested and unfinished code
|
||||
//=================================================
|
||||
@@ -983,58 +1081,48 @@ int LoadTypeInformation( IDispatch* pDisp ) // pass dispatch interface
|
||||
ITypeInfo* pTypeInfo;
|
||||
TYPEATTR* pTypeAttr;
|
||||
HRESULT hr;
|
||||
int i=0,j;
|
||||
int i,j;
|
||||
unsigned int nCount;
|
||||
int m_nMethodCount;
|
||||
int m_nVarCount;
|
||||
int m_nDispInfoCount;
|
||||
DispInfo* m_pDispInfo;
|
||||
UINT ui;
|
||||
|
||||
char cBuffer[128];
|
||||
char cBuffer[128];
|
||||
|
||||
//pDisp->lpVtbl->GetTypeInfoCount(pDisp, &i ); // i should be 1, otherwise no typeinfo present
|
||||
//wsprintf( cBuffer, "typeinfocount: %i", i );
|
||||
//OutputDebugString( cBuffer);
|
||||
|
||||
|
||||
hb_ToOutDebug( "looking for type info" );
|
||||
hb_ToOutDebug( "---------------- start ------------------" );
|
||||
|
||||
hr = pDisp->lpVtbl->GetTypeInfo( pDisp, 0, LOCALE_SYSTEM_DEFAULT, &pTypeInfo );
|
||||
if(hr != S_OK || pTypeInfo == NULL )
|
||||
if( hr != S_OK || pTypeInfo == NULL )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
hr = pDisp->lpVtbl->GetTypeInfoCount( pDisp, &i );
|
||||
wsprintf( cBuffer, "typeinfocount: %i, returned: %i", i, hr );
|
||||
OutputDebugString( cBuffer);
|
||||
|
||||
OutputDebugString("got type info");
|
||||
hr = pDisp->lpVtbl->GetTypeInfoCount( pDisp, &ui );
|
||||
hb_ToOutDebug( "typeinfocount: %i, returned: %i", ui, hr );
|
||||
|
||||
hr = pTypeInfo->lpVtbl->GetTypeAttr( pTypeInfo, &pTypeAttr );
|
||||
if( hr != S_OK )
|
||||
{
|
||||
pTypeInfo->lpVtbl->Release(pTypeInfo);
|
||||
pTypeInfo->lpVtbl->Release( pTypeInfo );
|
||||
return 0;
|
||||
}
|
||||
|
||||
OutputDebugString("got type attributes");
|
||||
hb_ToOutDebug( "------------ got type attributes -------------" );
|
||||
|
||||
if( pTypeAttr->typekind != TKIND_DISPATCH && pTypeAttr->typekind != TKIND_COCLASS && pTypeAttr->typekind != TKIND_INTERFACE )
|
||||
{
|
||||
|
||||
wsprintf( cBuffer, "typekind: %i", pTypeAttr->typekind );
|
||||
OutputDebugString( cBuffer);
|
||||
|
||||
hb_ToOutDebug( "typekind: %i", pTypeAttr->typekind );
|
||||
|
||||
pTypeInfo->lpVtbl->ReleaseTypeAttr( pTypeInfo, pTypeAttr );
|
||||
pTypeInfo->lpVtbl->Release(pTypeInfo);
|
||||
pTypeInfo->lpVtbl->Release( pTypeInfo );
|
||||
hr = S_FALSE;
|
||||
//return pTypeAttr->typekind; //0;
|
||||
}
|
||||
|
||||
OutputDebugString("got type kind");
|
||||
hb_ToOutDebug( "------------ got type kind -------------" );
|
||||
|
||||
if( pTypeAttr->typekind == TKIND_COCLASS )
|
||||
{
|
||||
@@ -1043,7 +1131,7 @@ hb_ToOutDebug( "looking for type info" );
|
||||
ITypeInfo* pTempInfo;
|
||||
TYPEATTR* pTempAttr = NULL;
|
||||
|
||||
for ( i=0 ; i < pTypeAttr->cImplTypes ; i++)
|
||||
for ( i=0 ; i < pTypeAttr->cImplTypes ; i++ )
|
||||
{
|
||||
if( pTypeInfo->lpVtbl->GetImplTypeFlags( pTypeInfo, i, &nFlags ) == S_OK && ( nFlags & IMPLTYPEFLAG_FDEFAULT ))
|
||||
{
|
||||
@@ -1057,7 +1145,7 @@ hb_ToOutDebug( "looking for type info" );
|
||||
hr = pTempInfo->lpVtbl->GetTypeAttr( pTempInfo, &pTempAttr );
|
||||
if( hr != S_OK )
|
||||
{
|
||||
pTempInfo->lpVtbl->Release(pTempInfo);
|
||||
pTempInfo->lpVtbl->Release( pTempInfo );
|
||||
pTempInfo = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -1083,54 +1171,47 @@ hb_ToOutDebug( "looking for type info" );
|
||||
pTypeAttr = pTempAttr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OutputDebugString("allocating memory");
|
||||
//hb_ToOutDebug( "------------------ allocating memory ---------------" );
|
||||
|
||||
m_nMethodCount = pTypeAttr->cFuncs;
|
||||
m_nVarCount = pTypeAttr->cVars;
|
||||
m_nDispInfoCount = m_nMethodCount+2*m_nVarCount;
|
||||
// allocate <m_nDispInfoCount> structures of DispInfo
|
||||
m_pDispInfo = (DispInfo *) hb_xgrab( sizeof(DispInfo) * m_nDispInfoCount);
|
||||
m_pDispInfo = ( DispInfo * ) hb_xgrab( sizeof( DispInfo ) * m_nDispInfoCount );
|
||||
|
||||
wsprintf( cBuffer, "methods: %i vars: %i DispInfo: %i", m_nMethodCount, m_nVarCount, m_nDispInfoCount );
|
||||
hb_ToOutDebug( cBuffer);
|
||||
hb_ToOutDebug( "methods: %i vars: %i DispInfo: %i", m_nMethodCount, m_nVarCount, m_nDispInfoCount );
|
||||
|
||||
|
||||
hb_ToOutDebug( "looping through methods");
|
||||
hb_ToOutDebug( "--------------- looping through methods ----------------");
|
||||
|
||||
for( i=0; i < m_nMethodCount; i++ )
|
||||
{
|
||||
FUNCDESC* pFuncDesc;
|
||||
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc );
|
||||
hr = pTypeInfo->lpVtbl->GetFuncDesc( pTypeInfo, i, &pFuncDesc );
|
||||
if( hr != S_OK )
|
||||
{
|
||||
pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr);
|
||||
pTypeInfo->lpVtbl->Release(pTypeInfo);
|
||||
pTypeInfo->lpVtbl->ReleaseTypeAttr( pTypeInfo, pTypeAttr );
|
||||
pTypeInfo->lpVtbl->Release( pTypeInfo );
|
||||
//m_nMethodCount = m_nVarCount = m_nDispInfoCount = 0;
|
||||
hb_xfree( m_pDispInfo);
|
||||
hb_xfree( m_pDispInfo );
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_pDispInfo[i].m_dispID = pFuncDesc->memid;
|
||||
|
||||
wsprintf( cBuffer, " id: %i kind: %i", pFuncDesc->memid, pFuncDesc->invkind );
|
||||
hb_ToOutDebug( cBuffer);
|
||||
|
||||
hr = pTypeInfo->lpVtbl->GetNames( pTypeInfo, m_pDispInfo[i].m_dispID ,&m_pDispInfo[i].m_bstrName, 1, &nCount );
|
||||
if( hr != S_OK )
|
||||
{
|
||||
pTypeInfo->lpVtbl->ReleaseFuncDesc( pTypeInfo, pFuncDesc );
|
||||
pTypeInfo->lpVtbl->ReleaseTypeAttr( pTypeInfo, pTypeAttr );
|
||||
pTypeInfo->lpVtbl->Release(pTypeInfo);
|
||||
pTypeInfo->lpVtbl->Release( pTypeInfo );
|
||||
//m_nMethodCount = m_nVarCount = m_nDispInfoCount = 0;
|
||||
// free memory
|
||||
hb_xfree( m_pDispInfo);
|
||||
hb_xfree( m_pDispInfo );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// kind of entry
|
||||
switch(pFuncDesc->invkind)
|
||||
switch( pFuncDesc->invkind )
|
||||
{
|
||||
case INVOKE_PROPERTYGET:
|
||||
m_pDispInfo[i].m_wFlag = DISPATCH_PROPERTYGET;
|
||||
@@ -1150,21 +1231,15 @@ hb_ToOutDebug( "looking for type info" );
|
||||
|
||||
m_pDispInfo[i].m_oVft = pFuncDesc->oVft;
|
||||
m_pDispInfo[i].m_callconv = pFuncDesc->callconv;
|
||||
m_pDispInfo[i].m_pOutput = (VARIANT*) hb_xgrab( sizeof(VARIANT));
|
||||
m_pDispInfo[i].m_pOutput = ( VARIANT* ) hb_xgrab( sizeof( VARIANT ) );
|
||||
|
||||
VariantInit( m_pDispInfo[i].m_pOutput );
|
||||
m_pDispInfo[i].m_vtOutputType = pFuncDesc->elemdescFunc.tdesc.vt;
|
||||
if(m_pDispInfo[i].m_vtOutputType==VT_VOID||m_pDispInfo[i].m_vtOutputType==VT_NULL)
|
||||
if( m_pDispInfo[i].m_vtOutputType==VT_VOID||m_pDispInfo[i].m_vtOutputType==VT_NULL )
|
||||
{
|
||||
m_pDispInfo[i].m_vtOutputType = VT_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
wsprintf( cBuffer, " id: %i kind: %i", pFuncDesc->memid, pFuncDesc->invkind );
|
||||
hb_ToOutDebug( cBuffer);
|
||||
|
||||
|
||||
WideCharToMultiByte( CP_ACP, // code page
|
||||
0, // performance and mapping flags
|
||||
m_pDispInfo[i].m_bstrName, // wide-character string
|
||||
@@ -1175,23 +1250,22 @@ hb_ToOutDebug( "looking for type info" );
|
||||
NULL // set when default char used
|
||||
);
|
||||
|
||||
hb_ToOutDebug( "%s [id: %i kind: %i params: %i]", cBuffer, pFuncDesc->memid, pFuncDesc->invkind, pFuncDesc->cParams );
|
||||
//hb_ToOutDebug( cBuffer ); // name of the function
|
||||
//hb_ToOutDebug( m_pDispInfo[i].m_bstrName );
|
||||
|
||||
|
||||
hb_ToOutDebug( cBuffer);
|
||||
//OutputDebugString( m_pDispInfo[i].m_bstrName);
|
||||
|
||||
hb_ToOutDebug( "looping paremeters");
|
||||
//hb_ToOutDebug( "------------- looping paremeters ---------------");
|
||||
|
||||
// parameters
|
||||
m_pDispInfo[i].m_nParamCount = pFuncDesc->cParams;
|
||||
m_pDispInfo[i].m_pParamTypes = (WORD*) hb_xgrab( sizeof(WORD) * (m_pDispInfo[i].m_nParamCount+1));
|
||||
for( j=0; j<m_pDispInfo[i].m_nParamCount; j++ )
|
||||
{
|
||||
if(pFuncDesc->lprgelemdescParam[j].tdesc.vt==VT_SAFEARRAY)
|
||||
if( pFuncDesc->lprgelemdescParam[j].tdesc.vt==VT_SAFEARRAY )
|
||||
{
|
||||
m_pDispInfo[i].m_pParamTypes[j] = (pFuncDesc->lprgelemdescParam[j].tdesc.lptdesc->vt)|VT_ARRAY;
|
||||
}
|
||||
else if(pFuncDesc->lprgelemdescParam[j].tdesc.vt==VT_PTR)
|
||||
else if( pFuncDesc->lprgelemdescParam[j].tdesc.vt==VT_PTR )
|
||||
{
|
||||
m_pDispInfo[i].m_pParamTypes[j] = (pFuncDesc->lprgelemdescParam[j].tdesc.lptdesc->vt)|VT_BYREF;
|
||||
}
|
||||
@@ -1204,8 +1278,7 @@ hb_ToOutDebug( "looking for type info" );
|
||||
pTypeInfo->lpVtbl->ReleaseFuncDesc( pTypeInfo, pFuncDesc );
|
||||
}
|
||||
|
||||
|
||||
hb_ToOutDebug( "looping through var count");
|
||||
hb_ToOutDebug( "--------------- looping through var count -------------------");
|
||||
|
||||
for( i=m_nMethodCount; i<m_nMethodCount+m_nVarCount; i++ )
|
||||
{
|
||||
@@ -1222,7 +1295,7 @@ hb_ToOutDebug( "looking for type info" );
|
||||
m_pDispInfo[i].m_dispID = pVarDesc->memid;
|
||||
m_pDispInfo[i+m_nVarCount].m_dispID = m_pDispInfo[i].m_dispID;
|
||||
|
||||
hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, m_pDispInfo[i].m_dispID ,&m_pDispInfo[i].m_bstrName,1,&nCount);
|
||||
hr = pTypeInfo->lpVtbl->GetNames( pTypeInfo, m_pDispInfo[i].m_dispID ,&m_pDispInfo[i].m_bstrName,1,&nCount );
|
||||
if( hr != S_OK )
|
||||
{
|
||||
pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
|
||||
@@ -1232,9 +1305,9 @@ hb_ToOutDebug( "looking for type info" );
|
||||
// free memory
|
||||
return 0;
|
||||
}
|
||||
m_pDispInfo[i+m_nVarCount].m_bstrName = SysAllocString(m_pDispInfo[i].m_bstrName);
|
||||
m_pDispInfo[i+m_nVarCount].m_bstrName = SysAllocString( m_pDispInfo[i].m_bstrName );
|
||||
|
||||
switch(pVarDesc->varkind)
|
||||
switch( pVarDesc->varkind )
|
||||
{
|
||||
case VAR_DISPATCH:
|
||||
m_pDispInfo[i].m_wFlag = DISPATCH_PROPERTYGET;
|
||||
@@ -1251,17 +1324,18 @@ hb_ToOutDebug( "looking for type info" );
|
||||
m_pDispInfo[i+m_nVarCount].m_wFlag = 0;
|
||||
break;
|
||||
}
|
||||
m_pDispInfo[i].m_pOutput = (VARIANT*) hb_xgrab(sizeof(VARIANT));// new VARIANT;
|
||||
::VariantInit(m_pDispInfo[i].m_pOutput);
|
||||
m_pDispInfo[i+m_nVarCount].m_pOutput = (VARIANT*) hb_xgrab(sizeof(VARIANT)); // new VARIANT;
|
||||
VariantInit(m_pDispInfo[i+m_nVarCount].m_pOutput);
|
||||
m_pDispInfo[i].m_pOutput = ( VARIANT* ) hb_xgrab( sizeof( VARIANT ) );// new VARIANT;
|
||||
::VariantInit( m_pDispInfo[i].m_pOutput );
|
||||
m_pDispInfo[i+m_nVarCount].m_pOutput = ( VARIANT* ) hb_xgrab( sizeof( VARIANT ) ); // new VARIANT;
|
||||
VariantInit( m_pDispInfo[i+m_nVarCount].m_pOutput );
|
||||
pTypeInfo->lpVtbl->ReleaseVarDesc( pTypeInfo, pVarDesc );
|
||||
}
|
||||
|
||||
hb_ToOutDebug( "end");
|
||||
hb_ToOutDebug( "---------------- end ------------------" );
|
||||
|
||||
pTypeInfo->lpVtbl->ReleaseTypeAttr( pTypeInfo, pTypeAttr );
|
||||
pTypeInfo->lpVtbl->Release( pTypeInfo );
|
||||
|
||||
return m_nDispInfoCount;
|
||||
}
|
||||
//----------------------------------------------------------------------//
|
||||
@@ -1271,6 +1345,75 @@ HB_FUNC( HB_AX_LOADTYPEINFO )
|
||||
}
|
||||
#endif
|
||||
//----------------------------------------------------------------------//
|
||||
#if 0
|
||||
//
|
||||
// AdviseEvents( hObj, IID_* {...-...-.........}, @hSink, hashEvents )
|
||||
//
|
||||
HB_FUNC( HB_AX_ADVISEEVENTS )
|
||||
{
|
||||
IConnectionPointContainer* pCPC = NULL;
|
||||
IConnectionPoint* pCP = NULL;
|
||||
IUnknown* pIUnknown;
|
||||
HRESULT hr;
|
||||
DWORD dwCookie = 0;
|
||||
device_interface* pdevice_interface = ( device_interface* ) hb_parnint( 1 );
|
||||
IID iid;
|
||||
BSTR bstrClassID;
|
||||
register IEventHandler* thisobj;
|
||||
|
||||
bstrClassID = hb_oleAnsiToSysString( hb_parcx( 2 ) );
|
||||
hr = IIDFromString( bstrClassID, ( LPIID ) &iid );
|
||||
SysFreeString( bstrClassID );
|
||||
if ( hr == S_OK )
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 1 >>>>>>>>>>>>" );
|
||||
thisobj = ( IEventHandler * ) GlobalAlloc( GMEM_FIXED, sizeof(MyRealIEventHandler ) );
|
||||
if ( !( thisobj ) )
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 2 >>>>>>>>>>>>" );
|
||||
thisobj->lpVtbl = (IEventHandlerVtbl *) &IEventHandler_Vtbl;
|
||||
((MyRealIEventHandler *) thisobj)->count = 0;
|
||||
|
||||
hr = thisobj->lpVtbl->QueryInterface( thisobj, &IID_IUnknown, (void**) &pIUnknown );
|
||||
if( hr == S_OK )
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 3 >>>>>>>>>>>>");
|
||||
hr = pdevice_interface->lpVtbl->QueryInterface( pdevice_interface, &IID_IConnectionPointContainer, (void**)&pCPC);
|
||||
if( hr == S_OK )
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 4 >>>>>>>>>>>>");
|
||||
hr = pCPC->lpVtbl->FindConnectionPoint( pCPC, (REFIID)&iid, &pCP );
|
||||
if ( hr == S_OK )
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 5 >>>>>>>>>>>>");
|
||||
hr = pCP->lpVtbl->Advise( pCP, pIUnknown, &dwCookie );
|
||||
if ( hr == S_OK )
|
||||
{
|
||||
hb_ToOutDebug( "<<<<<<<<<<<<<<< 6 >>>>>>>>>>>>");
|
||||
((MyRealIEventHandler *) thisobj)->device_event_interface_iid = iid;
|
||||
((MyRealIEventHandler *) thisobj)->pIConnectionPoint = pCP;
|
||||
((MyRealIEventHandler *) thisobj)->dwEventCookie = dwCookie;
|
||||
((MyRealIEventHandler *) thisobj)->pEvents = hb_itemNew( hb_param( 4, HB_IT_ANY ) );
|
||||
|
||||
hb_stornl( (LONG) thisobj, 3 );
|
||||
}
|
||||
}
|
||||
pCPC->lpVtbl->Release( pCPC );
|
||||
pCPC = NULL;
|
||||
}
|
||||
pIUnknown->lpVtbl->Release(pIUnknown);
|
||||
pIUnknown = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
hb_retnl( hr );
|
||||
}
|
||||
#endif
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ CLASS WvgStatic INHERIT WvgWindow
|
||||
DATA options INIT -1//WVGSTATIC_TEXT_LEFT
|
||||
DATA type INIT -1//WVGSTATIC_TYPE_TEXT
|
||||
|
||||
DATA hBitmap
|
||||
|
||||
METHOD new()
|
||||
METHOD create()
|
||||
@@ -169,7 +170,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSt
|
||||
CASE WVGSTATIC_TYPE_BITMAP
|
||||
::style += SS_BITMAP
|
||||
IF ::options == WVGSTATIC_BITMAP_TILED
|
||||
|
||||
::style += SS_CENTERIMAGE
|
||||
ELSEIF ::options == WVGSTATIC_BITMAP_SCALED
|
||||
|
||||
ELSE
|
||||
@@ -286,6 +287,10 @@ METHOD destroy() CLASS WvgStatic
|
||||
hb_ToOutDebug( " %s:destroy()", __objGetClsName() )
|
||||
|
||||
::WvgWindow:destroy()
|
||||
IF ::hBitmap <> nil
|
||||
Win_DeleteObject( ::hBitmap )
|
||||
ENDIF
|
||||
|
||||
#if 0
|
||||
IF len( ::aChildren ) > 0
|
||||
aeval( ::aChildren, {|o| o:destroy() } )
|
||||
@@ -318,6 +323,15 @@ METHOD setCaption( xCaption, cDll )
|
||||
CASE ::type == WVGSTATIC_TYPE_TEXT
|
||||
Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption )
|
||||
|
||||
CASE ::type == WVGSTATIC_TYPE_BITMAP
|
||||
IF ::hBitmap <> nil
|
||||
Win_DeleteObject( ::hBitmap )
|
||||
ENDIF
|
||||
|
||||
::hBitmap := Win_LoadImage( ::caption, 2 )
|
||||
//hb_toOutDebug( "setCaption %s %i %s",::caption, ::hBitmap, IF( file( ::caption ),'Yes','No') )
|
||||
Win_SendMessage( ::hWnd, STM_SETIMAGE, IMAGE_BITMAP, ::hBitmap )
|
||||
|
||||
ENDCASE
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -277,20 +277,31 @@ METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey
|
||||
oBtn:command := 100 + oBtn:index
|
||||
|
||||
cType := valtype( xImage )
|
||||
hBitmap := 0
|
||||
|
||||
DO CASE
|
||||
|
||||
CASE cType == 'C'
|
||||
hBitmap = Wvg_PrepareBitmapFromFile( xImage, ::imageWidth, ::imageHeight, .t., ::hWnd )
|
||||
|
||||
IF hBitmap <> 0
|
||||
oBtn:image := hBitmap
|
||||
Wvg_AddToolbarButton( ::hWnd, oBtn:image, oBtn:caption, oBtn:command, 1 )
|
||||
|
||||
IF ( '.' $ xImage ) .or. ( '/' $ xImage ) .or. ( '\' $ xImage ) .or. ( ':' $ xImage ) .or. file( xImage )
|
||||
hBitmap := Wvg_PrepareBitmapFromFile( xImage, ::imageWidth, ::imageHeight, .t., ::hWnd )
|
||||
ELSE
|
||||
hBitmap := Wvg_PrepareBitmapFromResourceName( xImage, ::imageWidth, ::imageHeight, .t., ::hWnd )
|
||||
ENDIF
|
||||
|
||||
CASE cType == 'N'
|
||||
hBitmap := Wvg_PrepareBitmapFromResourceID( xImage, ::imageWidth, ::imageHeight, .t., ::hWnd )
|
||||
|
||||
ENDCASE
|
||||
|
||||
IF hBitmap <> 0
|
||||
oBtn:image := hBitmap
|
||||
Wvg_AddToolbarButton( ::hWnd, oBtn:image, oBtn:caption, oBtn:command, 1 )
|
||||
|
||||
ELSE
|
||||
Wvg_AddToolbarButton( ::hWnd, , , oBtn:command, 3 )
|
||||
|
||||
ENDIF
|
||||
|
||||
aadd( ::aItems, { oBtn:command, oBtn } )
|
||||
|
||||
RETURN oBtn
|
||||
|
||||
@@ -74,18 +74,16 @@
|
||||
//-------------------------------------------------------------------//
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
#define HB_OS_WIN_USED
|
||||
#define HB_OS_WIN_32_USED
|
||||
|
||||
#include "gtwvg.h"
|
||||
#include "hbwapi.h"
|
||||
#include <windowsx.h>
|
||||
|
||||
#define WIN_STATUSBAR_MAX_PARTS 256
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
//#define wvg_parwparam( n ) ( ( WPARAM ) hb_parnint( n ) )
|
||||
//#define wvg_parlparam( n ) ( ( LPARAM ) hb_parnint( n ) )
|
||||
|
||||
#define wvg_parwparam( n ) ( ( WPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
|
||||
#define wvg_parlparam( n ) ( ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
|
||||
#define wvg_parhandle( n ) ( ( HANDLE ) ( HB_PTRDIFF ) hb_parnint( n ) )
|
||||
@@ -206,12 +204,12 @@ HB_FUNC( WIN_SETBKCOLOR )
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
#if 0
|
||||
HB_FUNC( WIN_SETBKMODE )
|
||||
{
|
||||
hb_retni( ( int ) SetBkMode( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
HB_FUNC( WIN_GETSTOCKOBJECT )
|
||||
@@ -248,12 +246,12 @@ HB_FUNC( WIN_HIWORD )
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
#if 0
|
||||
HB_FUNC( WIN_MULDIV )
|
||||
{
|
||||
hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
HB_FUNC( WIN_GETDIALOGBASEUNITS )
|
||||
@@ -454,12 +452,12 @@ HB_FUNC( WIN_RELEASEDC )
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
#if 0
|
||||
HB_FUNC( WIN_RECTANGLE )
|
||||
{
|
||||
Rectangle( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
//-------------------------------------------------------------------//
|
||||
|
||||
HB_FUNC( WIN_CREATEBRUSH )
|
||||
@@ -658,11 +656,21 @@ HB_FUNC( WIN_TRACKPOPUPMENU )
|
||||
{
|
||||
HMENU hMenu = ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 );
|
||||
UINT uFlags = ISNIL( 2 ) ? TPM_CENTERALIGN | TPM_RETURNCMD : hb_parnl( 2 );
|
||||
HWND hWnd = ISNIL( 3 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 3 );
|
||||
int x = ISNIL( 3 ) ? 0 : hb_parni( 3 );
|
||||
int y = ISNIL( 4 ) ? 0 : hb_parni( 4 );
|
||||
HWND hWnd = ISNIL( 5 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 );
|
||||
|
||||
POINT xy = { 0,0 };
|
||||
|
||||
GetCursorPos( &xy );
|
||||
if( ISNIL( 3 ) )
|
||||
{
|
||||
GetCursorPos( &xy );
|
||||
}
|
||||
else
|
||||
{
|
||||
xy.x = x;
|
||||
xy.y = y;
|
||||
}
|
||||
|
||||
hb_retnl( TrackPopupMenu( hMenu, uFlags, xy.x, xy.y, 0, hWnd, NULL ) );
|
||||
}
|
||||
@@ -736,18 +744,17 @@ HB_FUNC( WIN_SETMENU )
|
||||
BOOL bSet;
|
||||
RECT wi = { 0, 0, 0, 0 };
|
||||
RECT ci = { 0, 0, 0, 0 };
|
||||
USHORT height, width;
|
||||
int height, width;
|
||||
|
||||
bSet = SetMenu( hWnd, ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 2 ) );
|
||||
|
||||
GetWindowRect( hWnd, &wi );
|
||||
GetClientRect( hWnd, &ci );
|
||||
height = ( ci.bottom - ci.top );
|
||||
width = ( ci.right - ci.left );
|
||||
|
||||
height = ( USHORT ) ( ci.bottom - ci.top );
|
||||
width = ( USHORT ) ( ci.right - ci.left );
|
||||
|
||||
width += ( USHORT ) ( wi.right - wi.left - ci.right );
|
||||
height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );
|
||||
width += ( wi.right - wi.left - ci.right );
|
||||
height += ( wi.bottom - wi.top - ci.bottom );
|
||||
|
||||
SetWindowPos( hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );
|
||||
|
||||
@@ -1057,10 +1064,15 @@ static BYTE * PackedDibGetBitsPtr( BITMAPINFO * pPackedDib )
|
||||
static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap,
|
||||
int iExpWidth, int iExpHeight,
|
||||
BOOL bMap3Dcolors,
|
||||
HWND hCtrl )
|
||||
HWND hCtrl,
|
||||
int iMode )
|
||||
{
|
||||
HBITMAP hBitmap = NULL;
|
||||
|
||||
switch( iMode )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if( szBitmapX )
|
||||
{
|
||||
int iWidth, iHeight;
|
||||
@@ -1168,7 +1180,30 @@ static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap,
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* loading from resources */
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR;
|
||||
TCHAR * szBitmap;
|
||||
|
||||
szBitmap = HB_TCHAR_CONVTO( szBitmapX );
|
||||
|
||||
hBitmap = ( HBITMAP ) LoadImage(
|
||||
wvg_hInstance(),
|
||||
( LPCTSTR ) szBitmap,
|
||||
IMAGE_BITMAP,
|
||||
iExpWidth,
|
||||
iExpHeight,
|
||||
uiOptions );
|
||||
HB_TCHAR_FREE( szBitmap );
|
||||
if( hBitmap == NULL )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: /* loading from resourceid */
|
||||
{
|
||||
UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR;
|
||||
char szResname[ MAX_PATH + 1 ];
|
||||
@@ -1187,6 +1222,8 @@ static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap,
|
||||
return NULL;
|
||||
}
|
||||
} /* loading from resources */
|
||||
break;
|
||||
}
|
||||
|
||||
return hBitmap;
|
||||
}
|
||||
@@ -1197,7 +1234,7 @@ HB_FUNC( WVG_PREPAREBITMAPFROMFILE )
|
||||
HBITMAP hBitmap;
|
||||
|
||||
hBitmap = hPrepareBitmap( hb_parc( 1 ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ),
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ) );
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ), 0 );
|
||||
|
||||
hb_retnint( ( HB_PTRDIFF ) hBitmap );
|
||||
}
|
||||
@@ -1209,7 +1246,7 @@ HB_FUNC( WVG_PREPAREBITMAPFROMRESOURCEID )
|
||||
HBITMAP hBitmap;
|
||||
|
||||
hBitmap = hPrepareBitmap( ( char * ) NULL, hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ),
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ) );
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ), 2 );
|
||||
|
||||
hb_retnint( ( HB_PTRDIFF ) hBitmap );
|
||||
}
|
||||
@@ -1221,7 +1258,7 @@ HB_FUNC( WVG_PREPAREBITMAPFROMRESOURCENAME )
|
||||
HBITMAP hBitmap;
|
||||
|
||||
hBitmap = hPrepareBitmap( hb_parc( 1 ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ),
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ) );
|
||||
( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ), 1 );
|
||||
|
||||
hb_retnint( ( HB_PTRDIFF ) hBitmap );
|
||||
}
|
||||
@@ -2056,3 +2093,8 @@ HB_FUNC( WVG_HEIGHTTOPOINTSIZE )
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
HB_FUNC( WVG_SETCURRENTBRUSH )
|
||||
{
|
||||
SetClassLong( wvg_parhwnd( 1 ), GCL_HBRBACKGROUND, ( DWORD ) hb_parnint( 2 ) );
|
||||
}
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
@@ -415,6 +415,10 @@ METHOD setColorBG( nRGB ) CLASS WvgWindow
|
||||
IF hBrush <> 0
|
||||
::clr_BG := nRGB
|
||||
::hBrushBG := hBrush
|
||||
|
||||
IF ::className == 'WVGDIALOG'
|
||||
Wvg_SetCurrentBrush( ::hWnd, ::hBrushBG )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user