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

* harbour/contrib/gtwvg/gtwvg.c
    ! Fixed to honor parent GT if that is alien.

  * harbour/contrib/gtwvg/wvggui.c
    ! Thorough synchronized hb_gtInfo() slots.
      Every info gives results as expected, the only 
      poiint to remeber is that those values are based on :fontHeight/Width
      set by the user at startup, though the font is never created.
      So MaxCol() will return the ( Windows client area size / fontWidth ).
      At any given moment this value is measured from actual size of the
      window. Though this information is irrelevant in this context
      but still it works.

  * harbour/contrib/gtwvg/wvgsink.c
    ! Fixed few left-over unreleased memory blocks.
      More synchronized code.

    ; TOFIX: With some active-x's, for example, Shell.Explorer.2, 
      object never unreference itself to 0 and hence GlobalAlloc()ated
      memory never gets released. Though I made extensive debugging 
      but do not know where I should look into this matter.     

  * harbour/contrib/gtwvg/wvgwin.c
    + Added few more Win_* functions.

  * harbour/contrib/gtwvg/wvgax.prg
  * harbour/contrib/gtwvg/wvgcrt.prg
  * harbour/contrib/gtwvg/wvgdlg.prg
    ! More synchronizations, method implementations, etc.
      Still a work in progress.

  * harbour/contrib/gtwvg/tests/demowvg.prg
    ! Changed menu prompts to depict correct usage.
    + Added more prompts and deleted unwanted ones.
This commit is contained in:
Pritpal Bedi
2008-11-22 23:54:44 +00:00
parent 6d9e671cb3
commit aa745d2d18
9 changed files with 438 additions and 506 deletions

View File

@@ -8,6 +8,42 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-11-22 15:39 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/gtwvg.c
! Fixed to honor parent GT if that is alien.
* harbour/contrib/gtwvg/wvggui.c
! Thorough synchronized hb_gtInfo() slots.
Every info gives results as expected, the only
poiint to remeber is that those values are based on :fontHeight/Width
set by the user at startup, though the font is never created.
So MaxCol() will return the ( Windows client area size / fontWidth ).
At any given moment this value is measured from actual size of the
window. Though this information is irrelevant in this context
but still it works.
* harbour/contrib/gtwvg/wvgsink.c
! Fixed few left-over unreleased memory blocks.
More synchronized code.
; TOFIX: With some active-x's, for example, Shell.Explorer.2,
object never unreference itself to 0 and hence GlobalAlloc()ated
memory never gets released. Though I made extensive debugging
but do not know where I should look into this matter.
* harbour/contrib/gtwvg/wvgwin.c
+ Added few more Win_* functions.
* harbour/contrib/gtwvg/wvgax.prg
* harbour/contrib/gtwvg/wvgcrt.prg
* harbour/contrib/gtwvg/wvgdlg.prg
! More synchronizations, method implementations, etc.
Still a work in progress.
* harbour/contrib/gtwvg/tests/demowvg.prg
! Changed menu prompts to depict correct usage.
+ Added more prompts and deleted unwanted ones.
2008-11-19 21:49 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* bin/hb-func.sh
! hbw32 -> hbwin

View File

@@ -2023,19 +2023,27 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT )
{
HWND hWnd, hWndParent;
LPTSTR szAppName;
BOOL bByConf;
szAppName = HB_TCHAR_CONVTO( hb_cmdargARGV()[ 0 ] );
bByConf = FALSE;
hWndParent = NULL;
if( pWVT->pPP->bConfigured )
{
PHB_GT pGTp = hb_gt_ItemBase( pWVT->pPP->pParentGT );
PHB_GT pGTp = NULL;
if( pWVT->pPP->pParentGT )
{
pGTp = hb_gt_ItemBase( pWVT->pPP->pParentGT );
}
if( pGTp )
{
PHB_GTWVT pWVTp = HB_GTWVT_GET( pGTp );
hWndParent = pWVTp->hWnd;
if( pWVTp )
{
hWndParent = pWVTp->hWnd;
}
hb_gt_BaseFree( pGTp );
if( hWndParent )
{
RECT rc;
@@ -2060,31 +2068,36 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT )
pWVT->pPP->x = pt.x;
pWVT->pPP->y = pt.y;
bByConf = TRUE;
}
}
}
// This can happen if the pGTp is alien to this GT
// TOFIX:
if( !bByConf )
{
POINT pt;
if( pWVT->pPP->bRowCols )
{
pt.x = ( pWVT->PTEXTSIZE.x * pWVT->pPP->y );
pt.y = ( pWVT->PTEXTSIZE.y * pWVT->pPP->x );
pWVT->ROWS = pWVT->pPP->width;
pWVT->COLS = pWVT->pPP->height;
}
else
{
POINT pt;
if( pWVT->pPP->bRowCols )
{
pt.x = ( pWVT->PTEXTSIZE.x * pWVT->pPP->y );
pt.y = ( pWVT->PTEXTSIZE.y * pWVT->pPP->x );
pWVT->ROWS = pWVT->pPP->width;
pWVT->COLS = pWVT->pPP->height;
}
else
{
pt.x = pWVT->pPP->x;
pt.y = pWVT->pPP->y;
}
pWVT->pPP->x = pt.x;
pWVT->pPP->y = pt.y;
if( pWVT->pPP->y < 0 )
pWVT->CentreWindow = TRUE;
pt.x = pWVT->pPP->x;
pt.y = pWVT->pPP->y;
}
pWVT->pPP->x = pt.x;
pWVT->pPP->y = pt.y;
if( pWVT->pPP->y < 0 )
pWVT->CentreWindow = TRUE;
}
hWnd = CreateWindowEx(
@@ -2117,21 +2130,18 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS );
/* Set icon */
if( pWVT->hIcon )
{
SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) pWVT->hIcon ); /* Set Title Bar Icon */
SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_BIG , ( LPARAM ) pWVT->hIcon ); /* Set Task List Icon */
}
/* Set default window title */
{
PHB_FNAME pFileName = hb_fsFNameSplit( hb_cmdargARGV()[ 0 ] );
hb_gt_wvt_SetWindowTitle( pWVT->hWnd, pFileName->szName );
hb_xfree( pFileName );
}
/* Create "Mark" prompt in SysMenu to allow console type copy operation */
{
HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );
@@ -2166,7 +2176,6 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
iCmdShow = SW_SHOWNORMAL;
}
}
ShowWindow( pWVT->hWnd, iCmdShow );
UpdateWindow( pWVT->hWnd );
}
@@ -2181,7 +2190,6 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
hb_wvt_gtCreateToolTipWindow( pWVT );
}
}
return TRUE;
}
@@ -2506,93 +2514,12 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
/*
switch( pWVT->fontWeight )
{
case FW_THIN:
case FW_EXTRALIGHT:
case FW_LIGHT:
iVal = HB_GTI_FONTW_THIN;
break;
case FW_DONTCARE:
case FW_NORMAL:
case FW_MEDIUM:
iVal = HB_GTI_FONTW_NORMAL;
break;
case FW_SEMIBOLD:
case FW_BOLD:
case FW_EXTRABOLD:
case FW_HEAVY:
iVal = HB_GTI_FONTW_BOLD;
break;
default:
iVal = 0;
break;
}
pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
{
// store font status for next operation on fontsize //
switch( hb_itemGetNI( pInfo->pNewVal ) )
{
case HB_GTI_FONTW_THIN:
pWVT->fontWeight = FW_LIGHT;
break;
case HB_GTI_FONTW_NORMAL:
pWVT->fontWeight = FW_NORMAL;
break;
case HB_GTI_FONTW_BOLD:
pWVT->fontWeight = FW_BOLD;
break;
}
}
break;
*/
case HB_GTI_FONTQUALITY:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontQuality );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
pWVT->fontQuality = hb_itemGetNI( pInfo->pNewVal );
break;
/*
switch( pWVT->fontQuality )
{
case ANTIALIASED_QUALITY:
iVal = HB_GTI_FONTQ_HIGH;
break;
case DEFAULT_QUALITY:
case DRAFT_QUALITY:
iVal = HB_GTI_FONTQ_NORMAL;
break;
case NONANTIALIASED_QUALITY:
case PROOF_QUALITY:
iVal = HB_GTI_FONTQ_DRAFT;
break;
default:
iVal = 0;
break;
}
pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
{
switch( hb_itemGetNI( pInfo->pNewVal ) )
{
case HB_GTI_FONTQ_HIGH:
pWVT->fontQuality = ANTIALIASED_QUALITY;
break;
case HB_GTI_FONTQ_NORMAL:
pWVT->fontQuality = DEFAULT_QUALITY;
break;
case HB_GTI_FONTQ_DRAFT:
pWVT->fontQuality = DRAFT_QUALITY;
break;
}
}
break;
*/
case HB_GTI_SCREENHEIGHT:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y * pWVT->ROWS );
@@ -3826,6 +3753,13 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT )
static void hb_wvt_gtExitGui( PHB_GTWVT pWVT )
{
int i;
HMENU hMenu;
hMenu = GetMenu( pWVT->hWnd );
if( hMenu )
{
DestroyMenu( hMenu );
}
for( i = 0; i < WVT_DLGML_MAX; i++ )
{

View File

@@ -292,6 +292,7 @@ PROCEDURE Main( cDSN )
WvtSetKeys( .f. )
Wvt_SetPopupMenu( hPopup )
Popups( 1, .t. )
pGT_[ 1 ] := NIL
RETURN
@@ -1327,7 +1328,9 @@ FUNCTION CreateMainMenu()
oMenu := WvtMenu():new():create()
oMenu:Caption:= "Wvt*Classes"
oMenu:AddItem( "Dialog One", {|| MyDialogOne() } )
oMenu:AddItem( "Dialog One . New Window . Threaded", {|| MyDialogOne( 1 ) } )
oMenu:AddItem( "Dialog One . Main Window . Primary Thread", {|| MyDialogOne( 2 ) } )
oMenu:AddItem( "-" )
oMenu:AddItem( "Dialog Two", {|| MyDialogTwo() } )
oMenu:AddItem( "-" )
oMenu:AddItem( "Exit" , {|| __keyboard( K_ESC ) } )
@@ -1335,12 +1338,15 @@ FUNCTION CreateMainMenu()
oMenu := wvtMenu():new():create()
oMenu:Caption := "Traditional"
oMenu:AddItem( "Next Gets" , {|| WvtNextGets() } )
oMenu:AddItem( "Gets : Console", {|| WvtConsoleGets() } )
oMenu:AddItem( "Browser" , {|| WvtMyBrowse() } )
oMenu:AddItem( "Partial Screen", {|| WvtPartialScreen() } )
oMenu:AddItem( "Gets . GTWVG . Threaded" , {|| WvtNextGets() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Wvt Lines" , {|| WvtLines() } )
oMenu:AddItem( "Gets . GTWVT . Threaded" , {|| WvtConsoleGets() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Browser . GTWVG . Threaded " , {|| WvtMyBrowse() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Partial Screen . Main Window", {|| WvtPartialScreen() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Wvt Lines . Main Window" , {|| WvtLines() } )
g_oMenuBar:addItem( "",oMenu )
oMenu := wvtMenu():new():create()
@@ -1356,17 +1362,15 @@ FUNCTION CreateMainMenu()
oMenu:AddItem( "Shrink" ,{|| WvtWindowExpand( -1 ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "Minimize",{|| Wvt_Minimize() } )
oMenu:AddItem( "Maximize",{|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } )
g_oMenuBar:addItem( "",oMenu)
oMenu := wvtMenu():new():create()
oMenu:Caption:= "Modeless Dialogs"
oMenu:AddItem( "Dialog First" ,{|| DynDialog_2() } )
oMenu:AddItem( "Dynamic Dialog . Modeless" ,{|| DynDialog_2( 1 ) } )
oMenu:AddItem( "Dynamic Dialog . Modal " ,{|| DynDialog_2( 2 ) } )
oMenu:AddItem( "-")
oMenu:AddItem( "Slide Show" ,{|| DlgSlideShow() } )
oMenu:AddItem( "-")
oMenu:AddItem( "Dialog Scond" ,{|| DynDialog_1() } )
oMenu:AddItem( "-")
oMenu:AddItem( "An Experiment",{|| Experiment_1() } )
oMenu:AddItem( "Slide Show . Modeless" ,{|| DlgSlideShow() } )
g_oMenuBar:addItem( "",oMenu)
oMenu := wvtMenu():new():create()
@@ -1401,24 +1405,21 @@ STATIC FUNCTION ActivateMenu( oMenu )
RETURN ( NIL )
//-------------------------------------------------------------------//
STATIC FUNCTION MyDialogOne()
STATIC FUNCTION MyDialogOne( nMode )
Local bBlock
static n := 0
if hb_mtvm()
n++
if n%2 == 0
if nMode == 2
MyDialogOne_X()
else
bBlock := { |oCrt| ;
hb_gtReload( 'WVG' ) ,;
oCrt := WvgCrt():New( , , { -1,-1 }, { 54,184 }, , .f. ), ;
oCrt:fontName := 'Courier',;
oCrt:fontHeight := 13 ,;
oCrt:fontWidth := 0 ,;
oCrt:Create() ,;
MyDialogOne_X( oCrt ) ;
MyDialogOne_X( oCrt ) ,;
oCrt:destroy() ;
}
hb_threadStart( bBlock )
endif
@@ -1811,73 +1812,6 @@ STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 )
//-------------------------------------------------------------------//
Function DynDialog_1()
Local hDlg, aDlg, nStyle
Static nInfo := 1
nInfo++
nStyle := + WS_CAPTION + WS_SYSMENU ;
+ WS_GROUP + WS_TABSTOP + DS_SETFONT ;
+ WS_THICKFRAME + WS_VISIBLE + WS_POPUP
aDlg := Wvt_MakeDlgTemplate( 1, 2, 15, 40, {0,0,0,0}, ;
ltrim( str( nInfo,10,0 ) ) + " - Modeless Dialog", nStyle )
nStyle := WS_VISIBLE + WS_TABSTOP + ES_AUTOVSCROLL + ES_MULTILINE + ES_WANTRETURN + WS_BORDER + WS_VSCROLL
aDlg := Wvt_AddDlgItem( aDlg, 1, 2, 9, 28, {}, 10, "EDIT" , nStyle, /* cText, nHelpId, nExStyle */ )
nStyle := WS_VISIBLE + SS_ETCHEDHORZ
aDlg := Wvt_AddDlgItem( aDlg, 12, 2, 1, 36, {}, 12, "STATIC", nStyle )
nStyle := WS_VISIBLE + WS_TABSTOP + BS_AUTOCHECKBOX
aDlg := Wvt_AddDlgItem( aDlg, 13, 2, 1, 10, {}, 11, "BUTTON", nStyle, "Is It Checked?" )
hDlg := Wvt_CreateDialog( aDlg, .f., "DynDlgProc_1" )
Return hDlg
//-------------------------------------------------------------------//
Function DynDlgProc_1( hDlg, nMsg, wParam, lParam )
Local cText, lClicked
Switch ( nMsg )
case WM_INITDIALOG
Win_SetDlgItemText( hDlg, 10, "This is multiline text which will be displayed in the edit window!" )
Win_CheckDlgButton( hDlg, 11, .t. )
exit
case WM_DESTROY
// Do whatevert you want to do with cText
// Each box will retrieve its own text.
//
cText := Win_GetDlgItemText( hDlg, 10 )
exit
case WM_TIMER
// Do some processing
exit
case WM_COMMAND
do case
case wParam == 11
lClicked := ( Win_IsDlgButtonChecked( hDlg,11 ) == 1 )
Win_MessageBox( hDlg, "Button " + iif( lClicked, "Clicked", "Unclicked" ), "CheckBoxStatus" )
endcase
exit
end
Return .f.
//-------------------------------------------------------------------//
#define ID_BTN_OK 1
#define ID_MLE 10
#define ID_CHK_SATIS 11
@@ -1900,12 +1834,9 @@ Function DynDlgProc_1( hDlg, nMsg, wParam, lParam )
//-------------------------------------------------------------------//
Function DynDialog_2()
Function DynDialog_2( nInfo )
Local hDlg, aDlg, nStyle, nTimerTicks, cDlgIcon, cDlgProc, lOnTop, hMenu, nProc, bDlgProc
Static nInfo := 0
nInfo++
nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX
aDlg := Wvt_MakeDlgTemplate( 1, 4, 21, 60, {0,0,0,0}, ;
@@ -1977,7 +1908,7 @@ Function DynDialog_2()
cDlgIcon := "v_notes.ico"
nTimerTicks := 1000 // 1 second
if nInfo % 2 == 1
if nInfo == 2
// Modal Dialog
//
//hDlg := Wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() )
@@ -2255,8 +2186,7 @@ Function ExecuteActiveX( nActiveX )
SetColor( 'N/W' )
CLS
#else
oCrt := WvgDialog():init( , , { 30,30 }, { 400,500 }, , .f. )
oCrt := WvgDialog():new( , , { 30,30 }, { 500,550 }, , .f. )
oCrt:closable := .f.
oCrt:create()
#endif
@@ -2294,11 +2224,12 @@ Static Function ExeActiveX( oCrt, nActiveX )
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 6 9' ) } } )
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>"
oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } )
case nActiveX == 2
#define evClick 1
@@ -2310,19 +2241,20 @@ Static Function ExeActiveX( oCrt, nActiveX )
hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' )
oCom:CLSID := 'AnalogClockControl.AnalogClock'
oCom:Id := 5
oCom:mapEvent( evDblClk, {|| DoModalWindow() ,;
oCom:Value := .75632 ,;
oCom:BackColor := RGB( 0,140,210 ),;
oCom:Refresh() ,;
oCom:ShowSecondsHand := .t. ,;
oCom:Hands3D := .t. ,;
oCom:Refresh() } )
oCom:mapEvent( evDblClk, {|| oCom:Value := .75632 ,;
oCom:BackColor := RGB( 0,140,210 ),;
oCom:Refresh() ,;
oCom:ShowSecondsHand := .t. ,;
oCom:Hands3D := .t. ,;
oCom:Refresh() } )
oCom:mapEvent( evBtnUp, {|nBtn,nShift,nX,nY| if( nBtn == 2, lEnd := .t., 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'
oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } )
case nActiveX == 4
hb_gtInfo( HB_GTI_WINTITLE, 'RM Chart [ <F12> Attributes <F11> Next Charts ]' )
@@ -2351,12 +2283,8 @@ Static Function ExeActiveX( oCrt, nActiveX )
endif
do while !( lEnd )
nKey := inkey()
#if 0
if nKey <> 0
hb_toOutDebug( 'nKey = %i : %i ', nKey, HB_K_RESIZE )
endif
#endif
nKey := inkey( 0.1 )
if nKey == HB_K_RESIZE
ResizeMe( oCom )
@@ -2364,6 +2292,9 @@ endif
if nActiveX == 1
oCom:Navigate( 'www.vouch.info' )
elseif nActiveX == 11
//oCom:document( 0 ):InnerHTML := "<html><h1>Stream Test</h1><p>This HTML content in a document.</html>"
elseif nActiveX == 4
oCom:RMCBackColor := 23456142
oCom:RMCStyle := 2
@@ -2536,7 +2467,9 @@ endif
enddo
oCom:Destroy()
oCom := NIL
endif
Return nil
//----------------------------------------------------------------------//
Function ConfigureRMChart( RMChart )
@@ -2605,12 +2538,6 @@ Static Function DoModalWindow()
pGT_[ 3 ] := hb_gtSelect()
#if 0
hb_toOutDebug( "Browser:title = %s", hb_gtInfoEx( pGT_[ 2 ], HB_GTI_WINTITLE ) )
hb_toOutDebug( "Application:title = %s", hb_gtInfoEx( pGT_[ 1 ], HB_GTI_WINTITLE ) )
hb_toOutDebug( "This:title = %s", hb_gtInfoEx( pGT_[ 3 ], HB_GTI_WINTITLE ) )
#endif
// Here goes the Clipper Code
//
SetColor( 'N/W' )
@@ -2621,12 +2548,6 @@ Static Function DoModalWindow()
if nSel == 0 .or. nSel == 1
exit
elseif nSel == 1
#if 0
hb_gtInfoEx( pGT_[ 2 ], HB_GTI_SETPOS_XY, 40, 40 )
hb_gtInfoEx( pGT_[ 2 ], HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED )
#endif
endif
enddo
@@ -2637,23 +2558,3 @@ Static Function DoModalWindow()
Return nil
//----------------------------------------------------------------------//
Function Experiment_1()
hb_threadStart( {|| ExperimentWGU() } )
Return nil
//----------------------------------------------------------------------//
Static Function ExperimentWGU()
Local nKey
hb_gtReload( 'WGU' )
//hb_gtInfo( HB_GTI_RESIZABLE, .f. )
hb_gtInfo( HB_GTI_WINTITLE, 'WGU Dialog Under GT Control' )
do while .t.
nKey := inkey( 0.1 )
if nKey == 27
exit
endif
enddo
Return NIL
//----------------------------------------------------------------------//

View File

@@ -138,7 +138,6 @@ CLASS WvgActiveXControl FROM TOleAuto, WvgWindow
PROTECTED:
METHOD adviseEvents()
METHOD unadviseEvents()
ENDCLASS
@@ -191,18 +190,45 @@ METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLic
//----------------------------------------------------------------------//
METHOD Destroy() CLASS WvgActiveXControl
::UnadviseEvents()
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
BEGIN SEQUENCE
IF hb_IsNumeric( ::hObj ) .and. ::hObj <> 0
//hb_ToOutDebug( '......................Release....................' )
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
ENDIF
IF ::hSink <> 0
HB_AX_ShutDownConnectionPoint( ::hSink )
::hSink := NIL
ENDIF
IF --nRef == 0
// HB_AX_AtlAxWinTerm()
ENDIF
//hb_ToOutDebug( '<< Release >>' )
ENDIF
//::hObj := NIL
ENDSEQUENCE
IF --nRef == 0
HB_AX_AtlAxWinTerm()
ENDIF
RETURN NIL
//----------------------------------------------------------------------//
METHOD adviseEvents() CLASS WvgActiveXControl
LOCAL n, hSink, xRet
xRet := HB_AX_SetupConnectionPoint( ::hObj, @hSink, @n, ::hEvents )
::hSink := hSink
RETURN xRet
//----------------------------------------------------------------------//
METHOD mapEvent( nEvent, bBlock )
if hb_isNumeric( nEvent ) .and. hb_isBlock( bBlock )
::hEvents[ nEvent ] := { bBlock }
endif
RETURN Self
//----------------------------------------------------------------------//
METHOD inheritPresParams() CLASS WvgActiveXControl
Local lSuccess := .t.
@@ -241,28 +267,6 @@ METHOD mouseMove() CLASS WvgActiveXControl
METHOD activate() CLASS WvgActiveXControl
RETURN Self
//----------------------------------------------------------------------//
METHOD adviseEvents() CLASS WvgActiveXControl
LOCAL n
RETURN HB_AX_SetupConnectionPoint( ::hObj, @::hSink, @n, ::hEvents )
//----------------------------------------------------------------------//
METHOD unadviseEvents() CLASS WvgActiveXControl
IF ::hSink <> 0
HB_AX_ShutDownConnectionPoint( ::hSink )
::hSink := 0
ENDIF
RETURN NIL
//----------------------------------------------------------------------//
METHOD mapEvent( nEvent, bBlock )
if hb_isNumeric( nEvent ) .and. hb_isBlock( bBlock )
::hEvents[ nEvent ] := { bBlock }
endif
RETURN Self
//----------------------------------------------------------------------//
// Class AutomationObject
//----------------------------------------------------------------------//
#if 0

View File

@@ -319,7 +319,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr
/* CreateWindow() be forced to execute */
? ' '
::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE )
hb_gtInfo( HB_GTI_RESIZABLE , ::resizable )
@@ -338,7 +337,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr
endif
if ::lModal
hb_gtInfo( HB_GTI_DISABLE, ::pGTp )
//hb_gtInfo( HB_GTI_DISABLE, ::pGTp )
endif
if ::visible

View File

@@ -108,7 +108,13 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi
endif
hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ;
::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .f. } )
::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .F. } )
if ::visible
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL )
else
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_HIDE )
endif
::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE )
@@ -131,7 +137,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi
endif
if ::visible
hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL )
::lHasInputFocus := .t.
endif
@@ -146,5 +151,9 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv
RETURN Self
//----------------------------------------------------------------------//
METHOD destroy() CLASS WvgDialog
::pGT := NIL
::pGTp := NIL
RETURN Self
//----------------------------------------------------------------------//

View File

@@ -1148,6 +1148,11 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT )
NULL ); /* lpParam */
HB_TCHAR_FREE( szAppName );
ShowWindow( pWVT->hWnd, pWVT->pPP->bVisible ? SW_NORMAL : SW_HIDE );
UpdateWindow( pWVT->hWnd );
return hWnd;
}
@@ -1178,9 +1183,6 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
hb_gt_wvt_SetWindowTitle( pWVT->hWnd, pFileName->szName );
hb_xfree( pFileName );
}
ShowWindow( pWVT->hWnd, SW_NORMAL );
UpdateWindow( pWVT->hWnd );
}
return TRUE;
@@ -1214,8 +1216,8 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
HB_GTSELF_RESIZE( pGT, pWVT->ROWS, pWVT->COLS );
HB_GTSELF_SEMICOLD( pGT );
hb_gt_wvt_CreateConsoleWindow( pWVT );
hb_gt_wvt_ProcessMessages( pWVT );
// hb_gt_wvt_CreateConsoleWindow( pWVT );
// hb_gt_wvt_ProcessMessages( pWVT );
}
/* ********************************************************************** */
@@ -1284,121 +1286,116 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_FULLSCREEN:
case HB_GTI_KBDSUPPORT:
case HB_GTI_ISGRAPHIC:
{
pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
break;
}
case HB_GTI_ISUNICODE:
{
#if defined( UNICODE )
pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
#else
pInfo->pResult = hb_itemPutL( pInfo->pResult, FALSE );
#endif
break;
}
case HB_GTI_INPUTFD:
{
pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
( HB_PTRDIFF ) GetStdHandle( STD_INPUT_HANDLE ) );
break;
}
case HB_GTI_OUTPUTFD:
{
pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
( HB_PTRDIFF ) GetStdHandle( STD_OUTPUT_HANDLE ) );
break;
}
case HB_GTI_ERRORFD:
{
pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
( HB_PTRDIFF ) GetStdHandle( STD_ERROR_HANDLE ) );
break;
}
case HB_GTI_SETFONT:
{
#if 0
pInfo->pResult = hb_itemPutL( pInfo->pResult, FALSE );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
{
HFONT hFont = hb_gt_wvt_GetFont( hb_arrayGetCPtr( pInfo->pNewVal, 1 ),
hb_arrayGetNI( pInfo->pNewVal, 2 ),
hb_arrayGetNI( pInfo->pNewVal, 3 ),
hb_arrayGetNI( pInfo->pNewVal, 4 ),
hb_arrayGetNI( pInfo->pNewVal, 5 ),
pWVT->CodePage );
if( hFont )
{
if( hb_gt_wvt_ValidWindowSize( pWVT->hWnd, pWVT->ROWS, pWVT->COLS, hFont, hb_arrayGetNI( pInfo->pNewVal, 3 ) ) )
{
pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
PHB_ITEM pSome;
hb_strncpy( pWVT->fontFace, hb_arrayGetCPtr( pInfo->pNewVal, 1 ), sizeof( pWVT->fontFace ) - 1 );
pWVT->fontHeight = hb_arrayGetNI( pInfo->pNewVal, 2 );
pWVT->fontWidth = hb_arrayGetNI( pInfo->pNewVal, 3 );
pWVT->fontWeight = hb_arrayGetNI( pInfo->pNewVal, 4 );
pWVT->fontQuality = hb_arrayGetNI( pInfo->pNewVal, 5 );
if( pWVT->hWnd )
{
//hb_gt_wvt_ResetWindowSize( pWVT );
//HB_GTSELF_REFRESH( pGT );
}
}
DeleteObject( hFont );
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, 1 );
if( hb_itemType( pSome ) & HB_IT_STRING )
{
hb_strncpy( pWVT->fontFace, hb_itemGetCPtr( pSome ), sizeof( pWVT->fontFace ) - 1 );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, 2 );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->fontHeight = hb_arrayGetNI( pInfo->pNewVal, 2 );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, 3 );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->fontWidth = hb_arrayGetNI( pInfo->pNewVal, 3 );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, 4 );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->fontWeight = hb_arrayGetNI( pInfo->pNewVal, 4 );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, 5 );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->fontQuality = hb_arrayGetNI( pInfo->pNewVal, 5 );
}
}
#endif
break;
}
case HB_GTI_FONTSIZE:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y );
#if 0
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontHeight );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
{
HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, iVal, pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
if( hFont )
{
pWVT->fontHeight = iVal;
#if 0
if( pWVT->hWnd )
{
hb_gt_wvt_ResetWindowSize( pWVT );
HB_GTSELF_REFRESH( pGT );
}
#endif
DeleteObject( hFont );
}
pWVT->fontHeight = iVal;
}
#endif
break;
}
case HB_GTI_FONTWIDTH:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWidth );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
pWVT->fontWidth = hb_itemGetNI( pInfo->pNewVal );
break;
}
case HB_GTI_FONTNAME:
{
pInfo->pResult = hb_itemPutC( pInfo->pResult, pWVT->fontFace );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
hb_strncpy( pWVT->fontFace, hb_itemGetCPtr( pInfo->pNewVal ), sizeof( pWVT->fontFace ) - 1 );
}
break;
}
case HB_GTI_FONTWEIGHT:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWeight );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
pWVT->fontWeight = hb_itemGetNI( pInfo->pNewVal );
break;
}
case HB_GTI_FONTQUALITY:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontQuality );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
pWVT->fontQuality = hb_itemGetNI( pInfo->pNewVal );
break;
}
case HB_GTI_SCREENHEIGHT:
{
RECT rc;
@@ -1406,9 +1403,9 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNI( pInfo->pResult, rc.bottom - rc.top );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
if( iVal > 0 && pWVT->hWnd )
{
// Set windows new height
MoveWindow( pWVT->hWnd, 0, 0, rc.right-rc.left, iVal, TRUE );
}
break;
}
@@ -1419,9 +1416,9 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNI( pInfo->pResult, rc.right - rc.left );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
if( iVal > 0 && pWVT->hWnd )
{
//HB_GTSELF_SETMODE( pGT, pWVT->ROWS, ( USHORT ) ( iVal / pWVT->PTEXTSIZE.x ) );
MoveWindow( pWVT->hWnd, 0, 0, iVal, rc.bottom-rc.top, TRUE );
}
break;
}
@@ -1450,7 +1447,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
hDesk = GetDesktopWindow();
GetClientRect( hDesk, &rDesk );
pInfo->pResult = hb_itemPutNI( pInfo->pResult,
( rDesk.right - rDesk.left ) / pWVT->PTEXTSIZE.x );
( rDesk.right - rDesk.left ) / pWVT->fontWidth );
break;
}
case HB_GTI_DESKTOPROWS:
@@ -1460,10 +1457,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
hDesk = GetDesktopWindow();
GetClientRect( hDesk, &rDesk );
pInfo->pResult = hb_itemPutNI( pInfo->pResult,
( rDesk.bottom - rDesk.top ) / pWVT->PTEXTSIZE.y );
( rDesk.bottom - rDesk.top ) / pWVT->fontHeight );
break;
}
case HB_GTI_WINTITLE:
{
if( pWVT->hWnd )
{
char * szTitle = NULL;
@@ -1475,20 +1473,17 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
hb_gt_wvt_SetWindowTitle( pWVT->hWnd, hb_itemGetCPtr( pInfo->pNewVal ) );
}
break;
}
case HB_GTI_CODEPAGE:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->CodePage );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 && iVal != pWVT->CodePage )
{
pWVT->CodePage = iVal;
#if 0
if( pWVT->hWnd )
hb_gt_wvt_ResetWindowSize( pWVT );
#endif
}
break;
}
case HB_GTI_ICONFILE:
{
if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) )
@@ -1513,7 +1508,6 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRDIFF ) pWVT->hIcon );
break;
}
case HB_GTI_ICONRES:
{
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
@@ -1556,22 +1550,29 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRDIFF ) pWVT->hIcon );
break;
}
case HB_GTI_VIEWMAXWIDTH:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->COLS );
{
RECT rc;
GetClientRect( pWVT->hWnd, &rc );
pInfo->pResult = hb_itemPutNI( pInfo->pResult, rc.right - rc.left / pWVT->fontWidth );
break;
}
case HB_GTI_VIEWMAXHEIGHT:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->ROWS );
{
RECT rc;
GetClientRect( pWVT->hWnd, &rc );
pInfo->pResult = hb_itemPutNI( pInfo->pResult, rc.bottom - rc.top / pWVT->fontHeight );
break;
}
case HB_GTI_KBDSHIFTS:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_w32_getKbdState() );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
hb_gt_w32_setKbdState( hb_itemGetNI( pInfo->pNewVal ) );
break;
}
case HB_GTI_CLIPBOARDDATA:
{
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
hb_gt_w32_setClipboard( pWVT->CodePage == OEM_CHARSET ?
@@ -1597,39 +1598,39 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
}
break;
}
case HB_GTI_CURSORBLINKRATE:
{
pInfo->pResult = hb_itemPutNI( pInfo->pResult, GetCaretBlinkTime() );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
SetCaretBlinkTime( hb_itemGetNI( pInfo->pNewVal ) );
break;
}
case HB_GTI_SCREENSIZE:
{
RECT rc;
GetClientRect( pWVT->hWnd, &rc );
if( !pInfo->pResult )
{
pInfo->pResult = hb_itemNew( NULL );
}
hb_arrayNew( pInfo->pResult, 2 );
hb_arraySetNI( pInfo->pResult, 2, pWVT->PTEXTSIZE.y * pWVT->ROWS );
hb_arraySetNI( pInfo->pResult, 1, pWVT->PTEXTSIZE.x * pWVT->COLS );
#if 0
hb_arraySetNI( pInfo->pResult, 2, rc.bottom - rc.top );
hb_arraySetNI( pInfo->pResult, 1, rc.right - rc.left );
{
int iX, iY;
iY = hb_arrayGetNI( pInfo->pNewVal,2 );
iX = hb_arrayGetNI( pInfo->pNewVal,1 );
if( iY > 0 )
{
BOOL bOldCentre = pWVT->CentreWindow;
pWVT->CentreWindow = pWVT->bMaximized ? TRUE : FALSE;
HB_GTSELF_SETMODE( pGT, ( USHORT ) ( iY / pWVT->PTEXTSIZE.y ), ( USHORT ) ( iX / pWVT->PTEXTSIZE.x ) );
pWVT->CentreWindow = bOldCentre;
MoveWindow( pWVT->hWnd, 0, 0, iX, iY, TRUE );
}
}
#endif
break;
}
case HB_GTI_RESIZABLE:
{
pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bResizable );
if( pInfo->pNewVal )
{
@@ -1662,8 +1663,9 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
}
break;
}
case HB_GTI_CLOSABLE:
{
pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bClosable );
if( pInfo->pNewVal )
{
@@ -1684,9 +1686,10 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
}
break;
}
case HB_GTI_SETPOS_XY:
case HB_GTI_SETPOS_ROWCOL:
{
if( pWVT->hWnd && ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) &&
( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) )
{
@@ -1696,8 +1699,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
if( iType == HB_GTI_SETPOS_ROWCOL )
{
y = hb_itemGetNI( pInfo->pNewVal ) * pWVT->PTEXTSIZE.y;
x = hb_itemGetNI( pInfo->pNewVal2 ) * pWVT->PTEXTSIZE.x;
y = hb_itemGetNI( pInfo->pNewVal ) * pWVT->fontHeight;
x = hb_itemGetNI( pInfo->pNewVal2 ) * pWVT->fontWidth;
}
else
{
@@ -1712,7 +1715,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
SWP_NOSIZE | SWP_NOZORDER ) );
}
break;
}
case HB_GTI_SPEC:
{
int iMessage = hb_itemGetNI( pInfo->pNewVal );
@@ -1731,44 +1734,59 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pWVT->CentreWindow = hb_arrayGetL( pInfo->pNewVal2, 1 );
if( hb_arrayGetL( pInfo->pNewVal2, 2 ) )
{
#if 0
if( pWVT->hWnd )
hb_gt_wvt_ResetWindowSize( pWVT );
#endif
{
RECT rDesk, rApp;
HWND hDesk;
int iLeft, iTop;
hDesk = GetDesktopWindow();
GetClientRect( hDesk, &rDesk );
GetWindowRect( pWVT->hWnd, &rApp );
iLeft = ( ( rDesk.right - rDesk.left ) - ( rApp.right - rApp.left ) ) / 2;
iTop = ( ( rDesk.bottom - rDesk.top ) - ( rApp.bottom - rApp.top ) ) / 2;
MoveWindow( pWVT->hWnd, iLeft, iTop, ( rApp.right - rApp.left ), ( rApp.bottom - rApp.top ), FALSE );
}
}
}
break;
}
case HB_GTS_PROCESSMESSAGES:
{
if( pWVT->hWnd )
hb_gt_wvt_ProcessMessages( pWVT );
break;
}
case HB_GTS_KEYBOARD:
{
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
hb_gt_wvt_AddCharToInputQueue( pWVT, hb_itemGetNI( pInfo->pNewVal2 ) );
break;
}
case HB_GTS_RESETWINDOW:
#if 0
{
if( pWVT->hWnd )
hb_gt_wvt_ResetWindowSize( pWVT );
#endif
UpdateWindow( pWVT->hWnd ); // hb_gt_wvt_ResetWindowSize( pWVT );
break;
}
case HB_GTS_SETTIMER:
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY )
{
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY && pWVT->hWnd )
SetTimer( pWVT->hWnd, hb_arrayGetNI( pInfo->pNewVal2, 1 ), hb_arrayGetNI( pInfo->pNewVal2, 2 ), NULL );
break;
}
case HB_GTS_KILLTIMER:
{
if( pWVT->hWnd )
{
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
KillTimer( pWVT->hWnd, hb_itemGetNI( pInfo->pNewVal2 ) );
}
break;
}
case HB_GTS_SETPOSITION:
{
if( pWVT->hWnd && ( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY ) )
@@ -1785,18 +1803,28 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
}
case HB_GTS_SHOWWINDOW:
{
if( !pWVT->hWnd )
{
hb_gt_wvt_CreateConsoleWindow( pWVT );
hb_gt_wvt_ProcessMessages( pWVT );
}
if( pWVT->hWnd )
{
if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
{
ShowWindow( pWVT->hWnd, hb_itemGetNI( pInfo->pNewVal2 ) );
UpdateWindow( pWVT->hWnd );
}
}
break;
}
case HB_GTS_UPDATEWINDOW:
{
if( pWVT->hWnd )
UpdateWindow( pWVT->hWnd );
break;
}
case HB_GTS_SYSTRAYICON:
{
if( pWVT->hWnd && ( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY ) )
@@ -1923,69 +1951,72 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
}
case HB_GTI_PRESPARAMS:
if ( ! pWVT->hWnd )
{
if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
{
if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
int iParam = hb_arrayLen( pInfo->pNewVal );
if( iParam == HB_GTI_PP_SIZE )
{
int iParam = hb_arrayLen( pInfo->pNewVal );
if( iParam == HB_GTI_PP_SIZE )
PHB_ITEM pSome;
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_EXSTYLE );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
PHB_ITEM pSome;
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_EXSTYLE );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->exStyle = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_STYLE );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->style = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_X );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->x = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_Y );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->y = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WIDTH );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->width = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_HEIGHT );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->height = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT );
if( hb_itemType( pSome ) & HB_IT_POINTER )
{
pWVT->pPP->pParentGT = hb_itemNew( hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT ) );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_VISIBLE );
if( hb_itemType( pSome ) & HB_IT_LOGICAL )
{
pWVT->pPP->bVisible = hb_itemGetL( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_ROWCOLS );
if( hb_itemType( pSome ) & HB_IT_LOGICAL )
{
pWVT->pPP->bRowCols = hb_itemGetL( pSome );
}
/* Flag that caller configured itself */
pWVT->pPP->bConfigured = TRUE;
pWVT->CentreWindow = FALSE;
pWVT->pPP->exStyle = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_STYLE );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->style = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_X );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->x = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_Y );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->y = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WIDTH );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->width = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_HEIGHT );
if( hb_itemType( pSome ) & HB_IT_NUMERIC )
{
pWVT->pPP->height = hb_itemGetNInt( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT );
if( hb_itemType( pSome ) & HB_IT_POINTER )
{
pWVT->pPP->pParentGT = hb_itemNew( hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT ) );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_VISIBLE );
if( hb_itemType( pSome ) & HB_IT_LOGICAL )
{
pWVT->pPP->bVisible = hb_itemGetL( pSome );
}
pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_ROWCOLS );
if( hb_itemType( pSome ) & HB_IT_LOGICAL )
{
pWVT->pPP->bRowCols = hb_itemGetL( pSome );
}
/* Flag that caller configured itself */
pWVT->pPP->bConfigured = TRUE;
pWVT->CentreWindow = FALSE;
}
}
/* Only possible when it is WvgDialog() Window */
if( pWVT->hWnd && pWVT->pPP->bConfigured )
{
MoveWindow( pWVT->hWnd, pWVT->pPP->x, pWVT->pPP->y, pWVT->pPP->width, pWVT->pPP->height, TRUE );
}
break;
}
case HB_GTI_ENABLE:
{
PHB_GT pGTp = hb_gt_ItemBase( pInfo->pNewVal );
@@ -2019,11 +2050,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
}
break;
}
default:
{
return HB_GTSUPER_INFO( pGT, iType, pInfo );
}
}
return TRUE;
}

View File

@@ -117,18 +117,8 @@ HB_EXPORT void hb_oleItemToVariant( VARIANT *pVariant, PHB_ITEM pItem );
HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT *pVariant );
static int s_ev_iid_[ 100 ];
//----------------------------------------------------------------------//
static int ThisThreadId( void )
{
PHB_THREADSTATE pThread;
void HB_EXPORT hb_ToOutDebug( const char * sTraceMsg, ... );
pThread = ( PHB_THREADSTATE ) hb_vmThreadState();
if( pThread )
return( ( int ) pThread->th_no );
else
return( 0 );
}
//----------------------------------------------------------------------//
// these 2 functions are required to send parameters by reference
//
@@ -217,10 +207,9 @@ typedef struct {
DWORD dwEventCookie;
char* parent_on_invoke;
IID device_event_interface_iid;
PHB_ITEM pSelf; // object to handle the events (optional)
EventMap* pEventMap; // event map
int iEventMapLen; // length of the eventMap
PHB_ITEM pSelf; // object to handle the events (optional)
PHB_ITEM pEvents;
int iID_riid;
} MyRealIEventHandler;
//----------------------------------------------------------------------//
@@ -244,8 +233,8 @@ static HRESULT STDMETHODCALLTYPE QueryInterface( IEventHandler *this, REFIID vTa
if ( IsEqualIID( vTableGuid, &IID_IUnknown ) )
{
*ppv = ( IUnknown * ) this;
/* Increment the count of callers who have an outstanding pointer to this object */
//hb_ToOutDebug( ".................................if ( IsEqualIID( vTableGuid, &IID_IUnknown ) )" );
this->lpVtbl->AddRef( this );
return S_OK;
}
@@ -253,16 +242,17 @@ static HRESULT STDMETHODCALLTYPE QueryInterface( IEventHandler *this, REFIID vTa
if ( IsEqualIID( vTableGuid, &IID_IDispatch ) )
{
*ppv = ( IDispatch * ) this;
//hb_ToOutDebug( ".................................if ( IsEqualIID( vTableGuid, &IID_IDispatch ) )" );
this->lpVtbl->AddRef( this );
return S_OK;
}
if ( IsEqualIID( vTableGuid, &( ( ( MyRealIEventHandler * ) this )->device_event_interface_iid ) ) )
{
if( s_ev_iid_[ ThisThreadId() ] == 0 )
if( ++( ( MyRealIEventHandler * ) this )->iID_riid == 1 )
{
s_ev_iid_[ ThisThreadId() ]++;
*ppv = ( IDispatch* ) this;
//hb_ToOutDebug( ".................................if ( IsEqualIID( vTableGuid, &( ( ( MyRealIEventHandler * ) this )->device_event_interface_iid ) ) )" );
this->lpVtbl->AddRef( this );
}
return S_OK;
@@ -285,8 +275,8 @@ static ULONG STDMETHODCALLTYPE AddRef( IEventHandler *this )
// Rather they are defined only above in our MyRealIEventHandler
// struct. So typecast to that in order to access those data members
//hb_ToOutDebug( "AddRef->count=%i", ( ( MyRealIEventHandler * ) this )->count + 1 );
return( ++( ( MyRealIEventHandler * ) this )->count );
}
//----------------------------------------------------------------------//
//
@@ -294,19 +284,25 @@ static ULONG STDMETHODCALLTYPE AddRef( IEventHandler *this )
static ULONG STDMETHODCALLTYPE Release( IEventHandler *this )
{
#if 0
hb_ToOutDebug( "static ULONG STDMETHODCALLTYPE Release( IEventHandler *this )->count = %i",
( ( MyRealIEventHandler * ) this )->count - 1 );
#endif
if ( --( ( MyRealIEventHandler * ) this )->count == 0 )
{
if( ( ( MyRealIEventHandler * ) this)->pSelf )
{
hb_itemRelease( ( ( MyRealIEventHandler * ) this )->pSelf );
}
if( ( ( MyRealIEventHandler * ) this )->pEventMap )
hb_xfree( ( ( MyRealIEventHandler * ) this )->pEventMap );
GlobalFree( this );
return( 0 );
if( ( MyRealIEventHandler * ) this )
{
GlobalFree( ( MyRealIEventHandler * ) this );
}
//hb_ToOutDebug( " ULONG STDMETHODCALLTYPE Release( IEventHandler *this )->this" );
return( (ULONG) 0 );
}
return( ( ( MyRealIEventHandler * ) this )->count );
return( ( ( MyRealIEventHandler * ) this )->count < 0 ? ( ( MyRealIEventHandler * ) this )->count : 0 );
}
//----------------------------------------------------------------------//
//
@@ -363,7 +359,7 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
PHB_ITEM pItemArray[ 32 ]; // max 32 parameters?
PHB_ITEM *pItems;
PHB_ITEM Key;
//hb_ToOutDebug( "event = %i",(int)dispid );
// We implement only a "default" interface
if ( !IsEqualIID( riid, &IID_NULL ) )
{
@@ -430,7 +426,8 @@ static ULONG STDMETHODCALLTYPE Invoke( IEventHandler *this, DISPID dispid, REFII
for( i=iArg; i > 0; i-- )
{
if( ( ( &( params->rgvarg[ iArg-i ] ) )->n1.n2.vt & VT_BYREF ) == VT_BYREF )
//if( ( ( &( params->rgvarg[ iArg-i ] ) )->n1.n2.vt & VT_BYREF ) == VT_BYREF )
if( HB_IS_BYREF( pItemArray[ iArg-i ] ) )
{
hb_oleItemToVariant( &( params->rgvarg[ iArg-i ] ), pItemArray[ iArg-i ] );
@@ -524,7 +521,9 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID
{
thisobj->lpVtbl = ( IEventHandlerVtbl * ) &IEventHandler_Vtbl;
( ( MyRealIEventHandler * ) thisobj )->pSelf = NULL;
( ( MyRealIEventHandler * ) thisobj )->count = 0;
( ( MyRealIEventHandler * ) thisobj )->iID_riid = 0;
hr = thisobj->lpVtbl->QueryInterface( thisobj, &IID_IUnknown, (void**) &pIUnknown);
if (hr == S_OK && pIUnknown)
@@ -538,16 +537,15 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID
do
{
hr = m_pIEnumConnectionPoints->lpVtbl->Next( m_pIEnumConnectionPoints, 1, &m_pIConnectionPoint, NULL );
if( hr == S_OK )
{
hr = m_pIConnectionPoint->lpVtbl->GetConnectionInterface( m_pIConnectionPoint, &rriid );
if ( hr == S_OK )
{
( ( MyRealIEventHandler* ) thisobj )->device_event_interface_iid = rriid;
hr = m_pIConnectionPoint->lpVtbl->Advise( m_pIConnectionPoint, pIUnknown, &dwCookie );
if ( hr == S_OK )
{
( ( MyRealIEventHandler* ) thisobj )->pIConnectionPoint = m_pIConnectionPoint;
@@ -564,15 +562,12 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID
}
}
} while( hr == S_OK );
m_pIEnumConnectionPoints->lpVtbl->Release( m_pIEnumConnectionPoints );
m_pIEnumConnectionPoints = NULL;
}
pIConnectionPointContainerTemp->lpVtbl->Release( pIConnectionPointContainerTemp );
pIConnectionPointContainerTemp = NULL;
}
pIUnknown->lpVtbl->Release( pIUnknown );
pIUnknown = NULL;
}
@@ -583,25 +578,42 @@ static HRESULT SetupConnectionPoint( device_interface* pdevice_interface, REFIID
return hr;
}
//----------------------------------------------------------------------//
static void ShutdownConnectionPoint( MyRealIEventHandler *this )
{
if ( this->pIConnectionPoint )
{
this->dwEventCookie = 0;
this->pIConnectionPoint->lpVtbl->Release( this->pIConnectionPoint );
this->pIConnectionPoint = NULL;
}
}
//----------------------------------------------------------------------//
HB_FUNC( HB_AX_SHUTDOWNCONNECTIONPOINT )
{
MyRealIEventHandler* hSink = ( MyRealIEventHandler * ) hb_parnl( 1 );
ShutdownConnectionPoint( hSink );
hb_itemRelease( hSink->pEvents );
MyRealIEventHandler* hSink = ( MyRealIEventHandler * ) hb_parnint( 1 );
s_ev_iid_[ ThisThreadId() ] = 0;
//hb_ToOutDebug( "---------------------------------------------" );
#if 1
if ( hSink->pIConnectionPoint )
{
hSink->dwEventCookie = 0;
hSink->pIConnectionPoint->lpVtbl->Release( hSink->pIConnectionPoint );
hSink->pIConnectionPoint = NULL;
}
#endif
#if 1
if( hSink->pEvents )
{
hb_itemRelease( hSink->pEvents );
}
#endif
#if 0
if( ( MyRealIEventHandler * ) hSink )
{
GlobalFree( ( MyRealIEventHandler * ) hSink );
}
#endif
//hb_ToOutDebug( "=============================================" );
}
//----------------------------------------------------------------------//
HB_FUNC( HB_AX_RELEASEOBJECT )
{
IDispatch * pDisp = ( IDispatch * ) hb_parnint( 1 );
s_nOleError = pDisp->lpVtbl->Release( pDisp );
}
//---------------------------------------------------------------------------//
HB_FUNC( HB_AX_SETUPCONNECTIONPOINT )
{
HRESULT hr;
@@ -609,10 +621,11 @@ HB_FUNC( HB_AX_SETUPCONNECTIONPOINT )
LPIID riid = ( LPIID ) &IID_IDispatch;
int n;
hr = SetupConnectionPoint( ( device_interface* ) hb_parnint( 1 ), ( REFIID ) riid, ( void** ) &hSink, &n ) ;
hr = SetupConnectionPoint( ( device_interface* ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( REFIID ) riid, ( void** ) &hSink, &n ) ;
hSink->pEvents = hb_itemNew( hb_param( 4, HB_IT_ANY ) );
hb_stornl( ( LONG ) hSink, 2 );
hb_stornint( ( LONG ) hSink, 2 );
hb_storni( n, 3 );
hb_retnl( hr );
}
@@ -762,7 +775,7 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
pUnk->lpVtbl->Release( pUnk );
GetClientRect( hParent, &rc );
MoveWindow( GetDlgItem( hParent, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE );
hb_retnl( ( long ) obj );
hb_retnint( ( long ) obj );
}
else
{
@@ -782,20 +795,11 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind
// return the control handle
if ISBYREF( 11 )
{
hb_stornl( ( long ) hWnd, 11 );
hb_stornint( ( long ) hWnd, 11 );
}
}
//---------------------------------------------------------------------------//
//
// (hOleObject)
//
HB_FUNC( HB_AX_AXRELEASEOBJECT )
{
IDispatch * pDisp = ( IDispatch * ) hb_parnl( 1 );
s_nOleError = pDisp->lpVtbl->Release( pDisp );
}
//---------------------------------------------------------------------------//
//
// terminate activex suport, free the library
//
HB_FUNC( HB_AX_ATLAXWINTERM )

View File

@@ -509,7 +509,14 @@ HB_FUNC( WIN_ISWINDOW )
HB_FUNC( WIN_DESTROYWINDOW )
{
hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
hb_retl( DestroyWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
//-------------------------------------------------------------------//
HB_FUNC( WIN_DESTROYMENU )
{
hb_retl( DestroyMenu( (HMENU) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
//-------------------------------------------------------------------//
@@ -649,3 +656,10 @@ HB_FUNC( WIN_FINDWINDOW )
}
//----------------------------------------------------------------------//
HB_FUNC( WIN_SLEEP )
{
Sleep( hb_parni( 1 ) );
}
//----------------------------------------------------------------------//