// Ideia original:// http://www.pctoledo.com.br/forum/viewto ... =1&t=15482// Special thanks ao autor do topico: Billy1943.#Include "FiveWin.ch"#Include "Directry.ch"STATIC lSaida := .F., lLigaBotao := .F.
FUNCTION Google_Rua
() LOCAL oWnd, oActiveX, oFnt, oFont, nKey := VK_RETURN
LOCAL cEvents :=
"", cCookieUser
LOCAL oMapa, mde_uf, mpara_uf, mde_cid, mpara_cid, mde_rua, mpara_rua
LOCAL oGet1, oGet2, oGet3, oGet4, oBusca, oSaida, oDlg, msearch
/*
mpara_uf := "SP" // uf
mpara_cid := "SAO PAULO"//cidade
mpara_rua := "RUA ROCHA"//rua
*/ mpara_uf := space
(2) mpara_cid := space
(40) // PINDAMONHANGABA mpara_rua := space
(50) SetGetColorFocus
() SkinButtons
() DEFINE FONT oFnt
NAME "Ms Sans Serif" SIZE 0,
14 BOLD
//UnderLine DEFINE FONT oFont
NAME "Ms Sans Serif" SIZE 0,
-14 BOLD
//UnderLine DEFINE DIALOG oDlg
TITLE "Buscar Rua no Google Maps" ;
FROM 0,
0 TO 304,
480 PIXEL COLORS CLR_BLACK, CLR_WHITE TRANSPARENT
oDlg:
lHelpIcon := .F.
Set
( _SET_INSERT, ! Set
( _SET_INSERT
) ) //@ 11, 01 say "PROCURAR :" @
1,
2 SAY "PROCURAR A RUA:" OF oDlg
UPDATE FONT oFont ;
COLORS CLR_HRED, CLR_WHITE
//@ 13, 01 say "Estado ..:" get mpara_uf picture "@!" @
2,
2 SAY "Estado ..:" OF oDlg
UPDATE FONT oFnt ;
COLORS CLR_HBLUE, CLR_WHITE
@
30,
50 GET oGet1
VAR mpara_uf
OF oDlg
PIXEL SIZE 25,
12 PICTURE "@!" ;
CENTER UPDATE FONT oFnt COLORS CLR_BLACK, CLR_WHITE ;
VALID VALIDA_GET1
( mpara_uf
) //@ 14, 01 say "Cidade ..:" get mpara_cid picture "@!" @
3,
2 SAY "Cidade ..:" OF oDlg
UPDATE FONT oFnt ;
COLORS CLR_HBLUE, CLR_WHITE
@
45,
50 GET oGet2
VAR mpara_cid
OF oDlg
PIXEL SIZE 175,
12 PICTURE "@!" ;
UPDATE FONT oFnt COLORS CLR_BLACK, CLR_WHITE ;
VALID VALIDA_GET2
( mpara_cid
) //@ 15, 01 say "Endere‡o :" get mpara_rua picture "@!" @
4,
2 SAY OemToAnsi
( "Endere‡o:" ) OF oDlg
UPDATE FONT oFnt ;
COLORS CLR_HBLUE, CLR_WHITE
@
65,
50 GET oGet3
VAR mpara_rua
OF oDlg
PIXEL SIZE 185,
12 PICTURE "@!" ;
UPDATE FONT oFnt COLORS CLR_BLACK, CLR_WHITE ;
VALID VALIDA_BOTAO
( mpara_rua, oBusca
) @
7.00,
13 BUTTON oBusca
PROMPT "&Buscar" OF oDlg ;
WHEN( lLigaBotao
) ;
ACTION ( lSaida := .T., nKey := VK_RETURN, oDlg:
End() ) CANCEL
oBusca:
cToolTip :=
"Pesquisar a Rua no Google Maps" @
7.00,
21 BUTTON oSaida
PROMPT "&Saida" OF oDlg ;
ACTION ( lSaida := .T., nKey := VK_ESCAPE, oDlg:
End() ) CANCEL
oSaida:
cToolTip :=
"Saida - Exit - Cancelar" SET
FONT OF oBusca
TO oFont
SET
FONT OF oSaida
TO oFont
//read ACTIVATE DIALOG oDlg
CENTERED ;
VALID( lSaida
) oFnt:
End() oFont:
End() Set
( _SET_INSERT, ! Set
( _SET_INSERT
) ) DO CASE CASE nKey == VK_ESCAPE .OR. GETKEYSTATE
( VK_ESCAPE
) lSaida := .F.
lLigaBotao := .F.
RETURN NIL ENDCASE // By Billy1943 - Forum PC Toledo. Ideia Original. Agradecimentos. mpara_uf := alltrim
( mpara_uf
) mpara_cid := alltrim
( mpara_cid
) mpara_rua := alltrim
( mpara_rua
) msearch := mpara_rua +
" " + mpara_cid +
" " + mpara_uf
DEFINE WINDOW oWnd
TITLE "FiveWin ActiveX Support" oActiveX = TActiveX
():
New( oWnd,
"Shell.Explorer" ) oActivex&#
058;Silent := .T.
// Para Evitar: Erro de Script na Pagina. oWnd:
oClient = oActiveX
// To fill the entire window surface // funciona assim quebra se clicar na imagem /*
oActiveX:Navigate( "https://google.com.br/search?q=" + ;
ALLTRIM( msearch ) + "&oq=" + ;
ALLTRIM( msearch ) + "&aqs=chrome" )
*/ // Erro de Script na Pagina? // https://www.google.com.br/maps/place // gerando erro de navegador antigo. ????? //oActiveX:Navigate( "https://www.google.com.br/maps/place/" + msearch ) oActiveX&#
058;Navigate
( "https://www.google.com.br/maps/place/" + ALLTRIM
(msearch
) ) //oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ) } ACTIVATE WINDOW oWnd
MAXIMIZED /* ; // Nao quero editar nada.
VALID ( MemoEdit( cEvents ), .t. ) */RETURN NILFUNCTION VALIDA_GET1
( cmpara_uf
) IF GETASYNCKEY
( VK_UP
) // Para nao perder o foco do dialgo RETURN( .F.
) ENDIF IF EMPTY
( cmpara_uf
) MsgInfo( OemToAnsi
( "OPERA€ÇO INVµLIDA! " )+CRLF+ ;
OemToAnsi
( "DIGITIE O NOME DA UF... " )+CRLF+ ;
OemToAnsi
( "TECLE <ENTER> PARA CONTINUAR..." ), ;
OemToAnsi
( "OPERA€ÇO INVµLIDA! " ) ) lLigaBotao := .F.
RETURN( .F.
) ENDIFRETURN( .T.
)FUNCTION VALIDA_GET2
( cmpara_cid
) IF EMPTY
( cmpara_cid
) MsgInfo( OemToAnsi
( "OPERA€ÇO INVµLIDA! " )+CRLF+ ;
OemToAnsi
( "DIGITIE O NOME DA CIDADE... " )+CRLF+ ;
OemToAnsi
( "TECLE <ENTER> PARA CONTINUAR..." ), ;
OemToAnsi
( "OPERA€ÇO INVµLIDA! " ) ) lLigaBotao := .F.
RETURN( .F.
) ENDIFRETURN( .T.
)FUNCTION VALIDA_BOTAO
( cmpara_rua, oBusca
) IF EMPTY
( cmpara_rua
) MsgInfo( OemToAnsi
( "OPERA€ÇO INVµLIDA! " )+CRLF+ ;
OemToAnsi
( "DIGITIE O NOME DA RUA... " )+CRLF+ ;
OemToAnsi
( "TECLE <ENTER> PARA CONTINUAR..." ), ;
OemToAnsi
( "OPERA€ÇO INVµLIDA! " ) ) lLigaBotao := .F.
RETURN( .F.
) ENDIF // TUDO NORMAL, VAI BUSCAR NO GOOGLE lLigaBotao := .T.
oBusca:
Enable() oBusca:
Refresh()RETURN( .T.
)FUNCTION EventInfo
( event, aParams, pParams, oActiveX
) local cMsg :=
"Event: " + cValToChar
( event
) + CRLF
local n
cMsg +=
"Params: " + CRLF
for n =
1 to Len
( aParams
) cMsg += cValToChar
( aParams
[ n
] ) + CRLF
next if event ==
"BeforeNavigate2" // MsgInfo( aParams[ 2 ] ) // SetEventParam( pParams, 7, .t. ) // Comment this to allow navigation endifRETURN cMsg + CRLF
// END OF PROGRAM