#include "fivewin.ch"
//------------------------------------//
#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_MAXIMIZE 3
#define SW_SHOWMAXIMIZED 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_SHOWDEFAULT 10
//------------------------------------//
STATIC lWoking
//------------------------------------//
FUNCTION Main()
LOCAL oWnd
LOCAL oBar
LOCAL cTitle := "Main Principal"
LOCAL cURL := "https://www.google.com.br/maps/@-23.5460768,-46.5596029,15z"
// No funciona
// Local cURL := cFilePath( GetModuleFilename( GetInstance() ) ) + "btkserver.htm"
// local cUrl := MemoRead( "btkserver.htm" )
MemoWrit( "temp.html", cUrl )
lWoking := .F.
DEFINE WINDOW oWnd TITLE cTitle
DEFINE BUTTONBAR oBar OF oWnd 2010 SIZE 70, 70
DEFINE BUTTON OF oBar;
CENTER;
PROMPT "Mapa";
ACTION VerMapa( oWnd, cURL )
// ACTION ( DisplayShell( oWnd, cURL ), lWoking := .T. )
// DisplayOle( oWnd, cURL )
ACTIVATE WINDOW oWnd;
MAXIMIZED
// ON INIT DisplayOle( oWnd, cURL )
RETURN Nil
//------------------------------------//
STATIC FUNCTION VerMapa( oWnd, cURL )
LOCAL oCx
LOCAL oDlg
IF !IsInternet()
MsgAlert( "Compruebe la conexión a Internet.", "Atención" )
RETURN Nil
ENDIF
DEFINE DIALOG oDlg OF oWnd FROM 10, 10 TO 70, 200 TITLE "Test To Google Map"
oCx := TActiveX():New( oDlg, "Shell.Explorer" )
ACTIVATE DIALOG oDlg;
ON INIT ( oDlg:oClient := oCx, ;
oDlg:Resize(), ;
oCx:Silent := .T., oCx:Do( "Navigate2", cURL ) )
// oCx:Do( "Navigate2", CurDrive() + ":\" + CurDir() + "\temp.html" ) )
DeleteObject( oCx )
RETURN Nil
//------------------------------------//
FUNCTION DisplayShell( oWnd, cURL )
LOCAL oDlg
DEFINE DIALOG oDlg OF oWnd FROM 10, 10 TO 70, 200 TITLE "Test To Google Map"
ACTIVATE DIALOG oDlg CENTER ;
NOMODAL;
ON INIT ShellExecuteA( GetActiveWindow(), "open", '"' + cURL + '"', , SW_SHOW )
// ON INIT ShellExecute( oDlg:hWnd, "open", cURL,,, SW_SHOWNORMAL )
RETURN Nil
//------------------------------------//
FUNCTION DisplayOle( oWnd, cURL )
LOCAL oDlg
LOCAL oOle
IF lWoking
MsgStop( 'VerMapa Activo' )
RETURN Nil
endif
DEFINE DIALOG oDlg OF oWnd FROM 10, 10 TO 70, 200 TITLE "Test To Google Map"
oOle := CreateObject( "InternetExplorer.Application" )
oOle:Silent := .T.
oOle:Visible := .T.
oOle:ToolBar := .F.
oOle:StatusBar := .T.
oOle:MenuBar := .F.
oOle:FullScreen := .T.
oOle:Navigate( cURL )
ACTIVATE DIALOG oDlg CENTER ;
NOMODAL;
VALID if( MsgYesNo( "Salir ?" ), ( lWoking := .F. , .T. ), .F. );
ON INIT ( SetParent( oOle:hWnd, oDlg:hWnd ) )
RETURN Nil
//------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( SHELLEXECUTEA )
{
hb_retnl( ( LONG ) ShellExecuteA( ( HWND ) hb_parnl( 1 ),
hb_parc( 2 ),
hb_parc( 3 ),
hb_parc( 4 ),
hb_parc( 5 ),
hb_parnl( 6 ) ) );
}
#pragma ENDDUMP
// FINAL
Local cURL := cFilePath( GetModuleFilename( GetInstance() ) ) + "btkserver.htm"
Function CreaOleExplorer( cUrl , nAXWidth , nAXHeight )
local oIE
local nBorde := 8
local nBarra := 23
DEFAULT cUrl := "https://mail.google.com/mail/u/0/#inbox"
DEFAULT nAXWidth := 410
DEFAULT nAXHeight := 280
IF ( oIE := win_oleCreateObject( "InternetExplorer.Application" ) ) == NIL
MsgInfo( "Internet explorer no encuentrado " + CRLF + win_oleErrorText() )
Return .f.
EndIf
WITH OBJECT oIE
:__hSink := __axRegisterHandler( oIE:__hObj, {| ... | QOut( ... ) } )
:ToolBar := .F.
:StatusBar := .F.
:MenuBar := .F.
:Top := - ( nBarra + nBorde )
:Left := - nBorde
:Height := ( nAXHeight * 2 ) + nBarra + ( nBorde * 2 )
:Width := ( nAXWidth * 2 ) + ( nBorde * 2 )
// :FullScreen := .t.
// :Resizable := .t.
:Navigate2( cUrl )
DO WHILE :ReadyState != 4
hb_idleSleep( 0 )
ENDDO
:Visible := .T.
End WITH
Return oIE
FUNCTION VerWebo( cUrl, cBtn1, cBtn2 , cTitle )
local oWnd, oActX
local oBtn1, oBtn2, oSay, oWeb
local oFontDlg
local nWidth := 960 //860
local nHeight := 660
local nAXWidth := ( nWidth / 2 ) - 20 // 410
local nAXHeight := ( nHeight / 2 ) - 40 // 280
local lExiste := .f.
local OIE
local nVar
// INTER_APP_WEB_CONFIG( AppName() )
OIE := CreaOleExplorer( cUrl, nAXWidth, nAXHeight )
If Empty( oIE )
Return .f.
endif
DEFAULT cBtn1 := "&Existe"
DEFAULT cBtn2 := "&No Existe"
DEFAULT cTitle := "Revision pedido"
DEFINE FONT oFontDlg NAME 'Verdana' BOLD SIZE 0,-14
DEFINE DIALOG oWnd TITLE cTitle ;
FROM 0, 0 TO nHeight, nWidth PIXEL
@ 4, 10 SAY oWeb PROMPT "" SIZE nAXWidth, nAXHeight PIXEL OF oWnd
@ nAXHeight + 6, ( nAXWidth / 2 ) - 80 SAY "Compruebe si existe el pedido" ;
SIZE 240, 12 PIXEL OF oWnd FONT oFontDlg
@ nAXHeight + 24, ( nAXWidth / 2 ) - 60 BUTTON oBtn1 PROMPT cBtn1 SIZE 40, 12 PIXEL OF oWnd ;
ACTION ( lExiste := .T., oWnd:End() )
@ nAXHeight+ 24, ( nAXWidth/ 2 ) + 20 BUTTON oBtn2 PROMPT cBtn2 SIZE 40, 12 PIXEL OF oWnd ;
ACTION ( oWnd:End() )
ACTIVATE DIALOG oWnd CENTER ;
ON INIT ( SetParent( OIE:hWnd, oWeb:hWnd ) )
oIE:Quit()
oIE := ""
winexec( "taskkill /F /IM iexplore.exe", 0 )
RETURN lExiste
#define HKEY_LOCAL_MACHINE 2147483650
FUNCTION INTER_APP_WEB_CONFIG( f_cNameProg,f_nVersion_IE)
Local oRegKey, cRegProgGet, lDeleteKey := .f.
local cValue
Default f_nVersion_IE := 11001
if IsWow64()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
cValue := oRegKey:Get( f_cNameProg, 0 )
If cValue != f_nVersion_IE
msginfo( "debe ejecutar la aplicación con permisos de administrador" )
oRegKey:Set(f_cNameProg,f_nVersion_IE,4)
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_AJAX_CONNECTIONEVENTS" )
oRegKey:Set(f_cNameProg,0,4) // Padrão 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ZONE_ELEVATION" )
oRegKey:Set(f_cNameProg,0,4) // Padrão 1
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY" )
oRegKey:Set(f_cNameProg,1,4) // Padrão 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
oRegKey:Set(f_cNameProg,1,4)
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
oRegKey:Set(f_cNameProg,1,4)
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG" )
oRegKey:Set(f_cNameProg,1,4) // Padrao 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" )
oRegKey:Set(f_cNameProg,1,4) // Padrao 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_NINPUT_LEGACYMODE" )
oRegKey:Set(f_cNameProg,0,4) // Padrao 1
oRegKey:Close()
endif
Else
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
If oRegKey:Get( f_cNameProg, 0 ) != f_nVersion_IE
msginfo( "debe ejecutar la aplicación con permisos de administrador" )
oRegKey:Set(f_cNameProg,f_nVersion_IE,4)
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
cRegProgGet := oRegKey:GetBinary(f_cNameProg)
//? cRegProgGet
If Empty(cRegProgGet)
oRegKey:Set(f_cNameProg,1,4)
EndIf
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
oRegKey:Set(f_cNameProg,1,4)
oRegKey:Close()
Endif
EndIf
RETURN NIL
// C:\FWH..\SAMPLES\GMAPD.PRG Modificado: 15/05/2018.
#include "FiveWin.ch"
FUNCTION Main()
LOCAL oDlg, oActiveX
LOCAL cStreet := PadR( "BROADWAY 500", 80 )
LOCAL cCity := PadR( "NEW YORK CITY", 80 )
LOCAL cCountry := PadR( "USA", 80 )
INTER_APP_WEB_CONFIG( "GMAPD.exe", 11001 ) // IE 11001
DEFINE DIALOG oDlg RESOURCE "MAP"
REDEFINE ACTIVEX oActiveX ID 100 OF oDlg PROGID "Shell.Explorer"
REDEFINE GET cStreet ID 200 OF oDlg
REDEFINE GET cCity ID 300 OF oDlg
REDEFINE GET cCountry ID 400 OF oDlg
REDEFINE BUTTON ID 1 OF oDlg ACTION Show( cStreet, cCity, cCountry, oActiveX )
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT Show( cStreet, cCity, cCountry, oActiveX )
RETURN nil
FUNCTION Show( cStreet, cCity, cCountry, oActiveX )
LOCAL cHtml := MemoRead( "gmap.html" )
// LOCAL cHtml := MemoRead( "btkserver.htm" )
cHtml = StrTran( cHtml, "<<STREET>>", AllTrim( cStreet ) )
cHtml = StrTran( cHtml, "<<CITY>>", AllTrim( cCity ) )
cHtml = StrTran( cHtml, "<<COUNTRY>>", AllTrim( cCountry ) )
MemoWrit( "temp.html", cHtml )
oActiveX:Silent := .T.
#ifdef __XHARBOUR__
oActiveX:Do( "Navigate2", CurDrive() + ":\" + CurDir() + "\temp.html" )
#else
oActiveX:Do( "Navigate2", hb_CurDrive() + ":\" + CurDir() + "\temp.html" )
#endif
RETURN nil
#define HKEY_LOCAL_MACHINE 2147483650
// VERSION INTERNET EXPLORER: 11001
FUNCTION INTER_APP_WEB_CONFIG( f_cNameProg, f_nVersion_IE )
LOCAL oRegKey, cRegProgGet, lDeleteKey := .F.
LOCAL cValue
DEFAULT f_nVersion_IE := 11001
IF IsWow64()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
cValue := oRegKey:Get( f_cNameProg, 0 )
IF cValue != f_nVersion_IE
msginfo( "debe ejecutar la aplicación con permisos de administrador" )
oRegKey:Set( f_cNameProg, f_nVersion_IE, 4 )
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_AJAX_CONNECTIONEVENTS" )
oRegKey:Set( f_cNameProg, 0, 4 ) // Padrão 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ZONE_ELEVATION" )
oRegKey:Set( f_cNameProg, 0, 4 ) // Padrão 1
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY" )
oRegKey:Set( f_cNameProg, 1, 4 ) // Padrão 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
oRegKey:Set( f_cNameProg, 1, 4 )
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
oRegKey:Set( f_cNameProg, 1, 4 )
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG" )
oRegKey:Set( f_cNameProg, 1, 4 ) // Padrao 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" )
oRegKey:Set( f_cNameProg, 1, 4 ) // Padrao 0
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_NINPUT_LEGACYMODE" )
oRegKey:Set( f_cNameProg, 0, 4 ) // Padrao 1
oRegKey:Close()
ENDIF
ELSE
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
IF oRegKey:Get( f_cNameProg, 0 ) != f_nVersion_IE
// msginfo( "debe ejecutar la aplicación con permisos de administrador" )
oRegKey:Set( f_cNameProg, f_nVersion_IE, 4 )
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
cRegProgGet := oRegKey:GetBinary( f_cNameProg )
//? cRegProgGet
IF Empty( cRegProgGet )
oRegKey:Set( f_cNameProg, 1, 4 )
ENDIF
oRegKey:Close()
oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, ;
"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
oRegKey:Set( f_cNameProg, 1, 4 )
oRegKey:Close()
ENDIF
ENDIF
RETURN NIL
// FIN
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 45 guests