#include "FiveWin.ch"
#define SM_CYBORDER 6
#define SM_CYMENU 15
#define SM_CYCAPTION 4
MEMVAR oDlg, a_win, oClActive, oDk, oMen, lImpMap
FUNCTION Main()
LOCAL Path, aGrad, cTitle, oSkinB
SET PATH TO Path := StrCapFirst( cFilePath( GetModuleFileName( GetInstance() ) ) + "C:\COPIA" )
SET _3DLOOK ON
oSkinB = TSkinButton():New()
oSkinB:nClrBorder0_N := RGB( 249, 194, 179 )
oSkinB:nClrBorder1_N := RGB( 181, 61, 29 )
oSkinB:aClrNormal := { { 0.2, RGB( 000, 128, 000 ), RGB( 000, 128, 000 ) }, ;
{ 0.8, RGB( 109, 135, 100 ), RGB( 109, 135, 100 ) } }
SkinButtons( oSkinB )
IF .NOT. lIsDir( "C:\COPIA" )
lMkDir( "C:\COPIA" )
ENDIF
a_win := ScrResolution()
lImpMap := .F.
cTitle := "ActiveX larger then the screen"
aGrad := { { 0.30, CLR_WHITE, CLR_WHITE },{ 0.50, CLR_WHITE, CLR_WHITE } }
DEFINE DIALOG oDlg FROM 0, 0 TO 0, 0 GRADIENT aGrad TITLE cTitle PIXEL ;
STYLE nOR( WS_CAPTION, WS_SYSMENU )
oDlg:lHelpIcon := .F.
ACTIVATE DIALOG oDlg ON INIT( Win_Ini() )
RETURN NIL
FUNCTION Win_Ini()
LOCAL oMenu
MENU oMenu 2007 OF oDlg
MENUITEM "Google map" ACTION( Map_View() )
MENUITEM "Formats"
MENU
MENUITEM "A2" ACTION( Big_Fmt( 1 ) )
SEPARATOR
MENUITEM "A1" ACTION( Big_Fmt( 2 ) )
SEPARATOR
MENUITEM "A0" ACTION( Big_Fmt( 3 ) )
ENDMENU
MENUITEM "Print Map" ACTION( Prt_Map() ) WHEN( lImpMap ) // New
MENUITEM "Exit" ACTION( oDlg:End(), CLOSE_PROGRAM() )
ENDMENU
oDlg:Move( 0, 0, a_win[ 1 ], GetSysMetrics( 17 ) + ;
GetSysMetrics( SM_CYCAPTION ) + GetSysMetrics( SM_CYBORDER ) * 2 )
oClActive := TActiveX():New( oDlg, "Shell.Explorer", ;
2, 2, oDlg:nWidth - 4, GetSysMetrics( 17 ) - 4 )
oClActive:Silent := .T.
RETURN( oMenu )
FUNCTION Map_View()
LOCAL oObj := "oDlg:aControls[1]"
&oObj:Do( "Navigate2", "https://www.google.com/maps/@42.8674796,74.5708881,16z?hl=ru-KG" )
WHILE( .T. )
SYSREFRESH() ; CURSORWAIT()
oDk := &oObj:GetProp( "Document" )
IF ValType( oDk ) = "U" .OR. oDk:ReadyState != "complete"
// WaitMessage()
SysWait( 1 )
ELSE
IF ValType( oDk ) != "U"
lImpMap := .T.
ELSE // no errors.
lImpMap := .F.
ENDIF
EXIT
ENDIF
ENDDO
CURSORARROW()
RETURN NIL
FUNCTION Big_Fmt( fmt ) // print to bitmap-file
LOCAL fl
LOCAL oObj := "oDlg:aControls[1]"
LOCAL dim := {}
LOCAL mas := { { 594, 420 }, { 841, 594 }, { 1189, 841 } }
LOCAL siz := {}
// * fmt - format 1-A2, 2-A1, 3-A0
siz := { getdevicecaps( getDC( &oObj ), 4 ), ; // horzsize
getdevicecaps( getDC( &oObj ), 6 ) } // vertsize
fl := a_win[ 1 ] / siz[ 1 ] // number pix in 1 mm
mas[ fmt, 1 ] *= fl // width ActiveX in pix
mas[ fmt, 2 ] *= fl // height Activex in pix
siz := { mas[ fmt, 1 ] - &oObj:nWidth, ; // the % of increase in width
mas[ fmt, 2 ] - &oObj:nHeight } // the % of increase in height
// ********** new size ActiveX ***********
dim := { &oObj:nTop - ( siz[ 2 ] / 2 ), &oObj:nLeft - ( siz[ 1 ] / 2 ), ;
&oObj:nWidth + siz[ 1 ], &oObj:nHeight + siz[ 2 ] }
// **** change size ActiveX *****
&oObj:Move( dim[ 1 ], dim[ 2 ], dim[ 3 ], dim[ 4 ] )
RETURN NIL
FUNCTION Prt_Map()
LOCAL oObj := "oDlg:aControls[1]"
? oDlg:nWidth, oDlg:nHeight, &oObj:nWidth, &oObj:nHeight
&oObj:Do( "ExecWB", 6, 1 ) // OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER )
// &oObj:Print()
RETURN NIL
// CLOSE ALL
FUNCTION CLOSE_PROGRAM()
lImpMap := .F.
HB_GCALL( .T. )
CLEAR MEMORY
PostQuitMessage( 0 )
RETURN NIL
// END / FIN