Googlemap

Googlemap rasa minigui
This is Screen shoot ,

This coding a google map

*
Walter Formigoni, December of 2007
Copyright 2007 Walter Formigoni
Google Map, Adapted from sample of (Barcelona, Spain) and from Fivewin to Minigui
Added function fprint(), October of 2008. Contribution by Adilson Urso
———————————————
Marcelo Torres, Noviembre de 2006.
TActivex para [x]Harbour Minigui.
Adaptacion del trabajo de:
———————————————
Lira Lira Oscar Joel [oSkAr]
Clase TAxtiveX_FreeWin para Fivewin
Noviembre 8 del 2006
email: oscarlira78@hotmail.com
http://freewin.sytes.net
CopyRight 2006 Todos los Derechos Reservados
———————————————
*/

SET PROCEDURE TO “TAxPrg.prg”

#include “minigui.ch”

#define OLECMDID_PRINT 6
#define OLECMDID_PRINTPREVIEW 7
#define OLECMDEXECOPT_DODEFAULT 0

STATIC oActiveX
STATIC oWActiveX

*—————————————————————————–*
PROCEDURE Main()
*—————————————————————————–*

LOAD WINDOW GOOGLE

GOOGLE.Center()
GOOGLE.Activate()

RETURN

*—————————————————————————–*
Static Procedure fOpenActivex()
*—————————————————————————–*
Local cStreet := PadR( “BROADWAY 500”, 80 )
Local cCity := PadR( “NEW YORK”, 80 )
Local cCountry := PadR( “USA”, 80 )

GOOGLE.TEXT_1.VALUE := cStreet
GOOGLE.TEXT_2.VALUE := cCity
GOOGLE.TEXT_3.VALUE := cCountry

oWActiveX := TActiveX():New( “GOOGLE”, “Shell.Explorer.2” , 0 , 0 ,;
GetProperty( “GOOGLE” , “width” ) – 8 , GetProperty( “GOOGLE” , “height” ) – 150 )
oActiveX := oWActiveX:Load()

SHOW( cStreet, cCity, cCountry )

Return

*—————————————————————————–*
PROCEDURE SEARCH()
*—————————————————————————–*
Local cStreet := GOOGLE.TEXT_1.VALUE
Local cCity := GOOGLE.TEXT_2.VALUE
Local cCountry := GOOGLE.TEXT_3.VALUE

SHOW(cStreet, cCity, cCountry )

RETURN

*—————————————————————————–*
Function Show( cStreet, cCity, cCountry )
*—————————————————————————–*
Local cHtml := MemoRead( “gmap.html” )

cHtml = StrTran( cHtml, “<>”, AllTrim( cStreet ) )
cHtml = StrTran( cHtml, “<>”, AllTrim( cCity ) )
cHtml = StrTran( cHtml, “<>”, AllTrim( cCountry ) )

MemoWrit( “temp.html”, cHtml )

oActiveX:Navigate( CurDrive() + “:\” + CurDir() + “\temp.html” )

RETURN NIL

*—————————————————————————–*
Static Function fCloseActivex()
*—————————————————————————–*

IF VALTYPE(oWActivex) “U” .AND. VALTYPE(oActivex) “U”
oWActiveX:Release()
ENDIF

RETURN NIL

*—————————————————————————–*
Static Procedure fPrint(lPreview)
*—————————————————————————–*

If Valtype(oWActiveX) “U”
If lPreview
oActiveX:ExecWB( OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT )
Else
oActiveX:ExecWB( OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT )
EndIf
EndIf

Return

#include “hbclass.ch”

#ifndef __XHARBOUR__
#xcommand TRY => bError := errorBlock( {|oError| break( oError ) } ) ;;
BEGIN SEQUENCE
#xcommand CATCH [] => errorBlock( bError ) ;;
RECOVER [USING ] ;;
errorBlock( bError )
#endif

CLASS TActiveX
DATA oOle
DATA hWnd
DATA cWindowName
DATA cProgId
DATA nRow
DATA nCol
DATA nWidth
DATA nHeight
DATA nOldWinWidth
DATA nOldWinHeight
DATA bHide INIT .F.
METHOD New( cWindowName, cProgId , nRow , nCol , nWidth , nHeight )
METHOD Load()
METHOD ReSize( nRow , nCol , nWidth , nHeight )
METHOD Hide()
METHOD Show()
METHOD Release()
METHOD Refresh()
METHOD Adjust()
METHOD GetRow()
METHOD GetCol()
METHOD GetWidth()
METHOD GetHeight()
ENDCLASS

METHOD New( cWindowName , cProgId , nRow , nCol , nWidth , nHeight ) CLASS TActiveX
if( empty( nRow ) , nRow := 0 , )
if( empty( nCol ) , nCol := 0 , )
if( empty( nWidth ) , nWidth := GetProperty( cWindowName , “width” ) , )
if( empty( nHeight ) , nHeight := GetProperty( cWindowName , “Height” ) , )
::nRow := nRow
::nCol := nCol
::nWidth := nWidth
::nHeight := nHeight
::cWindowName := cWindowName
::cProgId := cProgId
::nOldWinWidth := GetProperty( cWindowName , “width” )
::nOldWinHeight := GetProperty( cWindowName , “Height” )
Return Self

METHOD Load() CLASS TActiveX
local oError, bError
local nHandle := GetFormHandle(::cWindowName)
local xObjeto
local OCX_Error := 0
AtlAxWinInit()
::hWnd := CreateWindowEx( nHandle, ::cProgId )
MoveWindow( ::hWnd , ::nCol , ::nRow , ::nWidth , ::nHeight , .t. )
xObjeto := AtlAxGetDisp( ::hWnd )
TRY
::oOle := CreateObject( xObjeto )
CATCH
MsgInfo( oError:description )
END
RETURN ::oOle

METHOD ReSize( nRow , nCol , nWidth , nHeight ) CLASS TActiveX
if !::bHide
MoveWindow( ::hWnd , nCol , nRow , nWidth , nHeight , .t. )
endif
::nRow := nRow
::nCol := nCol
::nWidth := nWidth
::nHeight := nHeight
::nOldWinWidth := GetProperty( ::cWindowName , “width” )
::nOldWinHeight := GetProperty( ::cWindowName , “Height” )
RETURN .T.

METHOD Adjust() CLASS TActiveX
Local nAuxRight , nAuxBottom
nAuxRight := ( ::nOldWinWidth – ( ::nWidth + ::nCol ) )
nAuxBottom := ( ::nOldWinHeight – ( ::nHeight + ::nRow ) )
MoveWindow( ::hWnd , ::nCol , ::nRow , GetProperty( ::cWindowName , “width” ) – ::nCol – nAuxRight , GetProperty( ::cWindowName , “height” ) – ::nRow – nAuxBottom , .t. )
::nWidth := GetProperty( ::cWindowName , “width” ) – ::nCol – nAuxRight
::nHeight := GetProperty( ::cWindowName , “height” ) – ::nRow – nAuxBottom
::nOldWinWidth := GetProperty( ::cWindowName , “width” )
::nOldWinHeight := GetProperty( ::cWindowName , “Height” )
RETURN .T.

METHOD GetRow() CLASS TActiveX
RETURN ::nRow

METHOD GetCol() CLASS TActiveX
RETURN ::nCol

METHOD GetWidth() CLASS TActiveX
RETURN ::nWidth

METHOD GetHeight() CLASS TActiveX
RETURN ::nHeight

METHOD Hide() CLASS TActiveX
MoveWindow( ::hWnd , 0 , 0 , 0 , 0 , .t. )
::bHide := .T.
RETURN .T.

METHOD Show() CLASS TActiveX
MoveWindow( ::hWnd , ::nCol , ::nRow , ::nWidth , ::nHeight , .t. )
::bHide := .F.
RETURN .T.

METHOD Release() CLASS TActiveX
DestroyWindow( ::hWnd )
AtlAxWinEnd()
RETURN .T.

METHOD Refresh() CLASS TActiveX
::Hide()
::Show()
RETURN .T.

#pragma BEGINDUMP

#include
#include
#include
#include
#include

typedef HRESULT ( WINAPI *LPAtlAxWinInit ) ( void );
typedef HRESULT ( WINAPI *LPAtlAxGetControl ) ( HWND hwnd, IUnknown** unk );

HMODULE hAtl = NULL;
LPAtlAxWinInit AtlAxWinInit;
LPAtlAxGetControl AtlAxGetControl;

static void _Ax_Init( void )
{
if( ! hAtl )
{
hAtl = LoadLibrary( “Atl.Dll” );
AtlAxWinInit = ( LPAtlAxWinInit ) GetProcAddress( hAtl, “AtlAxWinInit” );
AtlAxGetControl = ( LPAtlAxGetControl ) GetProcAddress( hAtl, “AtlAxGetControl” );
( AtlAxWinInit )();
}
}

HB_FUNC( ATLAXWININIT )
{
_Ax_Init();
}

HB_FUNC( ATLAXWINEND )
{
if( hAtl )
FreeLibrary( hAtl );
}

HB_FUNC( ATLAXGETDISP ) // hWnd -> pDisp
{
IUnknown *pUnk;
IDispatch *pDisp;
_Ax_Init();
AtlAxGetControl( (HWND)hb_parnl( 1 ), &pUnk );
pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, ( void ** ) &pDisp );
hb_retnl( (LONG)pDisp );
}

HB_FUNC_STATIC( CREATEWINDOWEX ) // hWnd, cProgId -> hActiveXWnd
{
HWND hControl;
hControl = CreateWindowEx( 0, “AtlAxWin”, hb_parc( 2 ),
WS_VISIBLE|WS_CHILD, 0, 0, 0, 0, (HWND)hb_parnl( 1 ), 0, 0, NULL );
hb_retnl( (LONG) hControl );
}

#pragma ENDDUMP

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: