2008-11-15 08:17 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtwvg/gtwvg.c
  * harbour/contrib/gtwvg/gtwvg.h
    + BOOL bDeferPaint; member.
  * harbour/contrib/gtwvg/hbgtwvg.ch
    + #define HB_GTI_DEFERPAINT
      Implemented hb_gtInfo( HB_GTI_DEFERPAINT, FALSE | TRUE )
      For consoles hosting ActiveX controls need not be painted text buffer.
      :TOFIX To extend this protocol for resizing buffer too
   
  * harbour/contrib/gtwvg/wvgsink.c
    ! More unicode compliant.
    ! Fixed some errors in -DUNICODE builds, not all.
    ! strcat() => hb_strncat() : Viktor please check.

  * harbour/contrib/gtwvg/tests/demowvg.prg
    + Added more Active-X controls.
This commit is contained in:
Pritpal Bedi
2008-11-15 16:30:12 +00:00
parent 720ab17282
commit 3ea0411813
6 changed files with 102 additions and 32 deletions

View File

@@ -8,6 +8,24 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-11-15 08:17 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/gtwvg.c
* harbour/contrib/gtwvg/gtwvg.h
+ BOOL bDeferPaint; member.
* harbour/contrib/gtwvg/hbgtwvg.ch
+ #define HB_GTI_DEFERPAINT
Implemented hb_gtInfo( HB_GTI_DEFERPAINT, FALSE | TRUE )
For consoles hosting ActiveX controls need not be painted text buffer.
:TOFIX To extend this protocol for resizing buffer too
* harbour/contrib/gtwvg/wvgsink.c
! More unicode compliant.
! Fixed some errors in -DUNICODE builds, not all.
! strcat() => hb_strncat() : Viktor please check.
* harbour/contrib/gtwvg/tests/demowvg.prg
+ Added more Active-X controls.
2008-11-14 20:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/gtwvg.c
* harbour/contrib/gtwvg/wvgsink.c

View File

@@ -1657,8 +1657,18 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
RECT updateRect;
if( GetUpdateRect( hWnd, &updateRect, FALSE ) )
hb_gt_wvt_PaintText( pWVT, updateRect );
{
if( !pWVT->bDeferPaint )
{
//hb_ToOutDebug( "LLLLLLLLLLLLLLLLLLL hWnd=%i", hWnd );
hb_gt_wvt_PaintText( pWVT, updateRect );
}
else
{
//hb_ToOutDebug( "................... hWnd=%i", hWnd );
return DefWindowProc( hWnd, message, wParam, lParam );
}
}
return 0;
}
@@ -3173,12 +3183,12 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
case HB_GTS_WS_MINIMIZED:
ShowWindow( pWVT->hWnd, SW_MINIMIZE );
SendNotifyMessage( pWVT->hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
break;
case HB_GTS_WS_MAXIMIZED:
if( pWVT->bResizable )
ShowWindow( pWVT->hWnd, SW_MAXIMIZE );
SendNotifyMessage( pWVT->hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
else
ShowWindow( pWVT->hWnd, SW_RESTORE );
break;
@@ -3314,6 +3324,14 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
break;
}
case HB_GTI_DEFERPAINT:
{
if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL )
{
pWVT->bDeferPaint = hb_itemGetL( pInfo->pNewVal );
}
break;
}
default:
return HB_GTSUPER_INFO( pGT, iType, pInfo );
}
@@ -3730,6 +3748,7 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT )
int iIndex;
pWVT->bResizing = FALSE;
pWVT->bDeferPaint = FALSE;
pWVT->penWhite = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 255,255,255 ) );
pWVT->penBlack = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) );

View File

@@ -417,9 +417,11 @@ typedef struct
PHB_ITEM pcbFuncModal[ WVT_DLGMD_MAX ]; // codeblock for WndProc
int iTypeModal[ WVT_DLGMD_MAX ]; // Type of Function Pointers - Function 1, Block 2, Method 3
PHB_GUIDATA pGUI; // GUI Data Structure
PHB_GUIDATA pGUI; // GUI Data Structure
PHB_GT_PARAMS pPP; // Presentation Parameters
PHB_GT_PARAMS pPP; // Presentation Parameters
BOOL bDeferPaint; // To create pure Windows dialogs
} HB_GTWVT, * PHB_GTWVT;

View File

@@ -65,6 +65,7 @@
#define HB_GTI_ENABLE 73
#define HB_GTI_DISABLE 74
#define HB_GTI_SETFOCUS 75
#define HB_GTI_DEFERPAINT 76
/* Presentation Parameters | HB_GTI_PRESPARAMS */
#define HB_GTI_PP_EXSTYLE 1

View File

@@ -1378,11 +1378,19 @@ FUNCTION CreateMainMenu()
oMenu:AddItem( "Slide Show" ,{|| DlgSlideShow() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Dialog Scond" ,{|| DynDialog_1() } )
oMenu:AddItem( "-")
oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } )
oMenu:AddItem( "ActiveX - Internet Explorer", {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } )
oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } )
g_oMenuBar:addItem( "",oMenu)
oMenu := wvtMenu():new():create()
oMenu:Caption:= "Active-X Controls"
oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "ActiveX - Internet Explorer", {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "ActiveX - Explorer . DHTML" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 11 ) } ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "ActiveX - Excel" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 4 ) } ) } )
g_oMenuBar:addItem( "",oMenu)
RETURN g_oMenuBar
@@ -2248,11 +2256,13 @@ Function ExecuteActiveX( nActiveX )
#define evBtnUp 5
Static Function ExeActiveX( oCrt, nActiveX )
Local oCOM, nKey
Local oCOM, nKey, cDhtml
Local cServer
Local cNavigate
Local lEnd := .f.
hb_gtInfo( HB_GTI_DEFERPAINT, .T. )
//hb_toOutDebug( 'oCrt:hwnd=%i', Wvt_GetWindowHandle() )
DEFAULT nActiveX TO 2
oCOM := WvgActiveXControl():New( oCrt, , { 0,0 }, { 200,200 }, , .t. )
@@ -2260,15 +2270,17 @@ Static Function ExeActiveX( oCrt, nActiveX )
do case
case nActiveX == 1
hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'http://www.harbour.vouch.info'+' ]' )
oCOM:CLSID := 'Shell.Explorer.2'
oCOM:mapEvent( 269, { {|| QOut( ' E X P L O R E R - 2 9 2' ) } } )
oCOM:mapEvent( 269, { {|| QOut( ' E X P L O R E R - 2 6 9' ) } } )
case nActiveX == 11
hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'MSHTML Demo'+' ]' )
oCom:CLSID := "MSHTML:" + "<html><h1>Stream Test</h1><p>This HTML content is being loaded from a stream.</html>"
case nActiveX == 2
hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' )
oCOM:CLSID := 'AnalogClockControl.AnalogClock'
oCOM:Id := 5
oCOM:Id := 5
oCOM:mapEvent( evDblClk, {|| DoModalWindow() ,;
oCOM:Value := .75632 ,;
oCOM:BackColor := RGB( 0,140,210 ),;
@@ -2281,18 +2293,25 @@ Static Function ExeActiveX( oCrt, nActiveX )
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'
case nActiveX == 4
hb_gtInfo( HB_GTI_WINTITLE, 'Frontpage.Application' )
//oCom:CLSID := 'Frontpage.Application'
oCom:CLSID := 'Excel.Application'
oCom:visible := .t.
endcase
oCOM:create()
// After :CREATE() Messages
//
if nActiveX == 1
// After CREATE Messages
//
oCOM:AddressBar := .t.
oCOM:Navigate( 'http://www.harbour.vouch.info' )
elseif nActiveX == 4
oCom:visible := .t.
oCom:Display()
endif
do while !( lEnd )
@@ -2304,6 +2323,9 @@ Static Function ExeActiveX( oCrt, nActiveX )
elseif nKey == K_LBUTTONDOWN
//hb_ToOutDebug( "Key is passed to the window procedure also!" )
elseif nKey == K_F12
oCom:Navigate( 'www.vouch.info' )
endif
if nKey == 27

View File

@@ -357,15 +357,12 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
{
int iArg;
int i;
// int iEvPos ; // = -1;
// int iEvEnum;
ULONG ulRefMask = 0;
ULONG ulPos;
PHB_ITEM pItem;
// PHB_DYNS pSymbol;
PHB_ITEM pItemArray[ 32 ]; // max 32 parameters?
PHB_ITEM *pItems;
PHB_ITEM Key = hb_itemNew( NULL );
PHB_ITEM Key;
// We implement only a "default" interface
if ( !IsEqualIID( riid, &IID_NULL ) )
@@ -378,7 +375,7 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
HB_SYMBOL_UNUSED( pexcepinfo );
HB_SYMBOL_UNUSED( puArgErr );
Key = hb_itemNew( NULL );
if ( hb_hashScan( ( ( MyRealIEventHandler * ) this )->pEvents, hb_itemPutNL( Key, dispid ), &ulPos ) )
{
PHB_ITEM pArray = hb_hashGetValueAt( ( ( MyRealIEventHandler * ) this )->pEvents, ulPos );
@@ -419,7 +416,7 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
pItem = hb_itemNew( NULL );
hb_oleVariantToItem( pItem, &( params->rgvarg[ iArg-i ] ) ); // VARIANT *pVariant )
pItemArray[ i-1 ] = pItem;
ulRefMask |= ( 1L << (i-1) ); // set bit i
ulRefMask |= ( 1L << (i-1) ); // set bit i
}
if( iArg )
@@ -435,6 +432,9 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
{
if( ( ( &( params->rgvarg[ iArg-i ] ) )->n1.n2.vt & VT_BYREF ) == VT_BYREF )
{
hb_oleItemToVariant( &( params->rgvarg[ iArg-i ] ), pItemArray[ iArg-i ] );
#if 0
switch( ( &( params->rgvarg[ iArg-i ] ) )->n1.n2.vt )
{
case VT_I2|VT_BYREF:
@@ -456,6 +456,7 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
*( ( &( params->rgvarg[ iArg-i ] ) )->n1.n2.n3.pdate ) = ( DATE ) ( double ) ( hb_itemGetDL( pItemArray[i-1] )-2415019 );
break;
}
#endif
}
}
@@ -510,10 +511,7 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID
HRESULT hr;
IID rriid;
register IEventHandler* thisobj;
// DWORD m_Points;
DWORD dwCookie = 0;
// ITypeLib* pITypeLib;
// DISPID dispid;
HB_SYMBOL_UNUSED( riid );
HB_SYMBOL_UNUSED( pn );
@@ -630,7 +628,7 @@ HB_FUNC( HB_AX_ATLAXWININIT )
if( !hLib )
{
GetSystemDirectory( szLibName, MAX_PATH );
strcat( szLibName, "\\atl.dll" );
hb_strncat( szLibName, "\\atl.dll", MAX_PATH -1 );
hLib = LoadLibrary( ( LPCSTR ) szLibName );
if( hLib )
@@ -682,15 +680,20 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL )
AtlAxCreateControl = ( PATLAXCREATECONTROL ) GetProcAddress( hLib, "AtlAxCreateControl" );
if ( AtlAxCreateControl )
{
hContainer = ( HWND ) CreateWindowEx( Exstyle, class, Caption, Style, x, y, w, h, hParent, id, GetModuleHandle( NULL ), NULL );
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 );
HB_TCHAR_FREE( cCaption );
HB_TCHAR_FREE( cClass );
if( hContainer )
{
SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ), ( LPARAM ) ( MAKELPARAM( FALSE, 0 ) ) );
uLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, NULL, 0 );
wString = (BSTR) malloc( uLen * sizeof(WCHAR));
wString = ( BSTR ) malloc( uLen * sizeof( WCHAR ) );
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen( Caption )+1, wString, uLen );
( AtlAxCreateControl ) ( wString, hContainer,NULL, &pUnk );
( AtlAxCreateControl ) ( wString, hContainer, NULL, &pUnk );
free( wString );
@@ -739,7 +742,12 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
AtlAxGetControl = ( PATLAXGETCONTROL ) GetProcAddress( hLib, "AtlAxGetControl" );
if( AtlAxGetControl )
{
hWnd = ( HWND ) CreateWindowEx( Exstyle, lpcclass, Caption, Style, x, y, w, h, hParent, id, GetModuleHandle( NULL ), NULL );
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 );
HB_TCHAR_FREE( cCaption );
HB_TCHAR_FREE( cClass );
if( hWnd )
{
SendMessage( hWnd,