Activex no funciona en Internet Explorer

Activex no funciona en Internet Explorer

Postby karinha » Wed Nov 22, 2017 4:33 pm

http://fivewin.com.br/index.php?/topic/27339-problema-na-busca-do-cnpj-site-da-receita/

Code: Select all  Expand view

#include "FiveWin.ch"

STATIC oWnd, oActivex

FUNCTION Main()

   LOCAL oBar

   DEFINE WINDOW oWnd TITLE "Google Action"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION Receita( oWnd )

   SET MESSAGE OF oWnd TO "Google Action" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

Function Receita( oWnd )

   Local cPortal
   local cEvents := ""

   If !IsInternet()

      Msgalert("Não conectado a internet.", "Aviso!")

      Return nil

   Endif

   MsgWait( "CONECTANDO AO PORTAL DA RECEITA ", ;
            "AGUARDE...                      ", 3.0 )

   DEFINE WINDOW oWnd FROM 0,0 TO 600,800 PIXEL TITLE "Receita.GOV"

   // oActiveX = TActiveX():New( oWnd, "Shell.Explorer.2" )  // nao funciona no IE
   // nao funciona no IE
   @ 0, 0 ACTIVEX oActiveX PROGID "Shell.Explorer.2" OF oWnd

   oWnd:oClient = oActiveX

   // oActiveX:GoHome()
   oActivex:Silent     := .T.
   oActiveX:FullScreen := .T.
   oActiveX:Visible    := .T.
   oActiveX:ToolBar    := .T.
   oActiveX:StatusBar  := .T.
   oActiveX:MenuBar    := .T.
   oActivex:SetFocus()

   oActiveX:Do( "Navigate2", "https://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/Cnpjreva_Solicitacao2.asp" )

   oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ) }

   ACTIVATE WINDOW oWnd CENTER ;
      VALID ( MemoEdit( cEvents ), .t. )

   // VALID( oActiveX:End() )

   // Com ShellExecute funciona perfeito no chrome.

   /*
   cPortal := "https://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/Cnpjreva_Solicitacao2.asp"

   If !IsInternet()

      Msgalert("Não conectado a internet.", "Aviso!")

      Return nil

   Endif

   MsgWait( "CONECTANDO AO PORTAL DA SEFAZ...", ;
            "AGUARDE...                      ", 3.0 )

   // Executa o navegador padrao... Google Chrome nao gosto do IE.
   ShellExecute( GetActiveWindow(), "open", cPortal,,,9 )
   */


Return nil

function EventInfo( event, aParams, pParams, oActiveX )

   local cMsg := "Evento: " + 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
   endif  

return cMsg + CRLF
 


Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Activex no funciona en Internet Explorer

Postby cnavarro » Wed Nov 22, 2017 7:02 pm

Joao, qué raro, yo lo uso habitualmente
Qué version de SO utilizas?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Activex no funciona en Internet Explorer

Postby karinha » Wed Nov 22, 2017 7:34 pm

Buenas master, creo que el problema sea que ahora el site pide um captcha y pide también um "no és robot?"

Y para que aparezca el "no és robot?", solo se si usar un script tipo .Html, mas no tengo certezca también se és esto mismo.

Con activex, el campo "No és Robot" no vién para se digitar el captcha de la página.

Mira se comprendes, porfa:

http://fivewin.com.br/index.php?/topic/27339-problema-na-busca-do-cnpj-site-da-receita/

Como debria aparecer en el internet explorer usando ActiveX:

https://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/cnpjreva_solicitacao2.asp

Master no tengo certezca, mas creo que el código del Script sea este:

[url]view-source:https://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/cnpjreva_solicitacao2.asp[/url]

Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Activex no funciona en Internet Explorer

Postby mastintin » Thu Nov 23, 2017 8:09 am

Recientemente ( un mes mas o menos ) me ha pasado algo similar .
Yo lo usaba con la pagina de Gmail , para ver los correos y ha dejado de funcionar correctamente , se quedaba congelado supongo por que no ejecutaba uno de los códigos internos de la página . mi solución paso por usar oIE := win_oleCreateObject( "InternetExplorer.Application" ) .
Cualquier noticia nueva es bienvenida :-)
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Activex no funciona en Internet Explorer

Postby Giovany Vecchi » Thu Nov 23, 2017 11:35 am

Ja expliquei uma vez aqui no forum.
Nossos programas quando acessa o sistema WEBBROWSER do Windows tem como padrão executar emulando o internet explorer versão 8, mesmo que no computador esteja instalado a versão 11.

Para dizer ao Windows que nossas aplicações queiram usar os recursos de outra versão é só executar a função INTER_APP_WEB_CONFIG(f_cNameProg,f_nVersion_IE)
Ex: Se voce possui a versão 11 do internet explorer e queira acessar os recursos desta versão voce parametriza assim:

INTER_APP_WEB_CONFIG("YourProgram.exe",11001)

Quando houver chamada de Activex de WebBrowser o Windows coloca a disposição os recursos da versão 11 do Internet Explorer.

Qualquer duvida acesse: https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx#browser_emulation

Code: Select all  Expand view
///////////////////////////////////////////////////////////////////////////////
#define  HKEY_LOCAL_MACHINE      2147483650

FUNCTION INTER_APP_WEB_CONFIG(f_cNameProg,f_nVersion_IE)
Local oRegKey, cRegProgGet, lDeleteKey := .f.
 
  Default f_nVersion_IE := 11001

  if IsWow64()
   
    oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
         "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
    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()


  Else

    oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
         "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
    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

RETURN NIL
 
User avatar
Giovany Vecchi
 
Posts: 222
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Activex no funciona en Internet Explorer

Postby karinha » Fri Nov 24, 2017 12:00 pm

Perfect Giovany Vecchi, many thanks!

Code: Select all  Expand view

#include "FiveWin.ch"

#define  HKEY_LOCAL_MACHINE      2147483650

STATIC oWnd, oActivex

FUNCTION Main()

   LOCAL oBar

   /*
   http://fivewin.com.br/index.php?/topic/27339-problema-na-busca-do-cnpj-site-da-receita/

   http://forums.fivetechsupport.com/viewtopic.php?f=6&t=34901
   */

   INTER_APP_WEB_CONFIG("TESTE2.exe",11001)

   DEFINE WINDOW oWnd TITLE "Google Action"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION Receita( oWnd )

   SET MESSAGE OF oWnd TO "Google Action" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

RETURN NIL

Function Receita( oWnd )

   Local cPortal
   local cEvents := ""

   If !IsInternet()

      Msgalert("Não conectado a internet.", "Aviso!")

      Return nil

   Endif

   MsgWait( "CONECTANDO AO PORTAL DA RECEITA ", ;
            "AGUARDE...                      ", 3.0 )

   DEFINE WINDOW oWnd FROM 0,0 TO 600,800 PIXEL TITLE "Receita.GOV"

   // oActiveX = TActiveX():New( oWnd, "Shell.Explorer.2" )  // nao funciona no IE
   // nao funciona no IE
   @ 0, 0 ACTIVEX oActiveX PROGID "Shell.Explorer.2" OF oWnd

   oWnd:oClient = oActiveX

   // oActiveX:GoHome()
   oActivex:Silent     := .T.
   oActiveX:FullScreen := .T.
   oActiveX:Visible    := .T.
   oActiveX:ToolBar    := .T.
   oActiveX:StatusBar  := .T.
   oActiveX:MenuBar    := .T.
   oActivex:SetFocus()

   oActiveX:Do( "Navigate2", "https://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/Cnpjreva_Solicitacao2.asp" )

   oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams, oActiveX ) }

   ACTIVATE WINDOW oWnd CENTER ;
      VALID ( MemoEdit( cEvents ), .t. )

   // VALID( oActiveX:End() )

   // Com ShellExecute funciona perfeito no chrome.

   /*
   cPortal := "https://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/Cnpjreva_Solicitacao2.asp"

   If !IsInternet()

      Msgalert("Não conectado a internet.", "Aviso!")

      Return nil

   Endif

   MsgWait( "CONECTANDO AO PORTAL DA SEFAZ...", ;
            "AGUARDE...                      ", 3.0 )

   // Executa o navegador padrao... Google Chrome nao gosto do IE.
   ShellExecute( GetActiveWindow(), "open", cPortal,,,9 )
   */


Return nil

function EventInfo( event, aParams, pParams, oActiveX )

   local cMsg := "Evento: " + 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
   endif  

return cMsg + CRLF

/*
Parametrize seu programa com a versão do seu navegador atual.

Ex: se seu navegador for iexplorer 11 coloque assim

INTER_APP_WEB_CONFIG("SeuPrograma.exe",11001)
*/


FUNCTION INTER_APP_WEB_CONFIG(f_cNameProg,f_nVersion_IE)

   Local oRegKey, cRegProgGet, lDeleteKey := .f.
 
   Default f_nVersion_IE := 11001

   if IsWow64()
   
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      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()


   Else

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      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

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests