ShellExecute no abre en una window

ShellExecute no abre en una window

Postby albeiroval » Wed May 09, 2018 5:46 pm

Hola a todos,

Necesito usar shellexecute para que abra una aplicacion outlook o un archivo html y que lo asigne a una window,
pero lo que hace es abrir la aplicacion o el archivo html en una window nueva.
Estoy usando este codigo

Code: Select all  Expand view

#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_MINIMIZE                 6      
#define SW_SHOWMINNOACTIVE  7      
#define SW_SHOWNA                   8  
#define SW_RESTORE                  9      
#define SW_SHOW                       5    
#define SW_SHOWDEFAULT       10  

//------------------------------------//

Function Main()
    Local oWnd
    Local cTitle := "Main Principal"
    Local cURL   := "mailto:email@domain.com" // cFilePath( GetModuleFilename( GetInstance() ) ) + "btkserver.htm"
       
    DEFINE WINDOW oWnd TITLE cTitle
         
    ACTIVATE WINDOW oWnd;
        MAXIMIZED;
        ON INIT ShellExecute( oWnd:hWnd, "open", cURL,,, SW_RESTORE )

    // ShellExecute( GetActiveWindow(), "open", cURL,,, SW_RESTORE )
       
Return Nil 

 
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ShellExecute no abre en una window

Postby karinha » Wed May 09, 2018 7:24 pm

Simple, como dos y dos son 5. jajajajajajaja.

Code: Select all  Expand view

#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_MINIMIZE             6
#define SW_SHOWMINNOACTIVE      7
#define SW_SHOWNA               8
#define SW_RESTORE              9
#define SW_SHOW                 5
#define SW_SHOWDEFAULT         10

//------------------------------------//

Function Main()
    Local oWnd
    Local cTitle := "Main Principal"
    Local cURL   := "mailto:kapiabafwh@gmail.com"
       
    DEFINE WINDOW oWnd TITLE cTitle
         
    ACTIVATE WINDOW oWnd MAXIMIZED ;
             ON INIT( ShellExecute(GetActiveWindow(),"open",'"'+cURL+'"' ), SW_RESTORE )

    // ON INIT ShellExecute( oWnd:hWnd, "open", cURL,,, SW_RESTORE )
    // ShellExecute( GetActiveWindow(), "open", cURL,,, SW_RESTORE )
       
Return Nil
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ShellExecute no abre en una window

Postby albeiroval » Wed May 09, 2018 10:23 pm

Karinha,

Gracias por responder pero no es lo que necesito, el shellexecute funciona pero no abre la aplicacion en la window
que previamente defino. Requiero usar el navegador Mozilla firefox por que el archivo javascript que necesito correr es incompatible
con iExplorer.

Te voy a poner un ejemplo que abre el buscador de google en un dialogo no modal, asi es como necesito que funcione pero por lo que te comento incompatibilidad de navegador no lo puedo usar.

Te anexo el codigo :
Code: Select all  Expand view

#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  

//------------------------------------//

Function Main()
    Local oWnd
    Local cTitle := "Main Principal"
    Local cURL   := "http://www.google.co.ve"
    // Local cURL   := cFilePath( GetModuleFilename( GetInstance() ) ) + "btkserver.htm"
           
    DEFINE WINDOW oWnd TITLE cTitle
         
    ACTIVATE WINDOW oWnd MAXIMIZED;
                ON INIT DisplayOle( oWnd, cURL )

        // ON INIT DisplayShell( oWnd, cURL )
       
       
Return Nil 

//------------------------------------//

static 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 ShellExecute( GetActiveWindow(), "open", '"' + cURL + '"',, SW_RESTORE )

  // ON INIT( ShellExecute(GetActiveWindow(),"open",'"'+cURL+'"' ), SW_RESTORE )
 
  // ON INIT ShellExecute( oDlg:hWnd, "open", cURL,,, SW_SHOWNORMAL )
 
Return Nil 

//------------------------------------//

static Function DisplayOle( oWnd, cURL )
    Local oDlg
    Local oOle
           
    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;
    ON INIT ( SetParent( oOle:hWnd, oDlg:hWnd ) )  
   
Return Nil 

// FINAL

 
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ShellExecute no abre en una window

Postby mastintin » Thu May 10, 2018 7:30 am

Seguiré este post con interes. Sería interesante disponer de una clase "navegador" que use un motor que no sea el iexplorer por dos motivos.
1.- El activex de iexplorer es Muy viejo y ya no ejecuta el javascript mas moderno ademas de estar descontinuado desde hace ya muchos años. Si quereis ver como no funciona es simple , si teneis cuenta en gmail intentar abrir vuestro correo ....
2.- La opcion de usar objetos com tampoco es valida a medio plazo . iexplorer se a descontinuado y las nuevas opciones abandonan la automatización. Edge ( o como se escriba ) no la usa y esto es un dolor de cabeza para todos.

Un saludo.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: ShellExecute no abre en una window

Postby karinha » Thu May 10, 2018 1:29 pm

Holá, mira se este ejemplo ayuda. Saludos.

Code: Select all  Expand view

#Include "FiveWin.ch"

#Define CLR_MENTA      nRGB( 221, 255, 238 )
#Define CLR_HMENTA     nRGB( 000, 128, 000 )

// Ideia original:
// http://www.pctoledo.com.br/forum/viewto ... =1&t=15482
// Special thanks ao autor do topico: Billy1943.  - 01/10/2014
FUNCTION Google_Rua()

   LOCAL oWnd, oActiveX, oFnt, oFont, nKey := VK_RETURN
   LOCAL cEvents := ""
   LOCAL oMapa, mde_uf, mpara_uf, mde_cid, mpara_cid, mde_rua, mpara_rua
   LOCAL oGet1, oGet2, oGet3, oGet4, oBusca, oSaida
   LOCAL nEnde := "", nCid := "", nPais := ""

   TestWebMapFw( nEnde, nCid, nPais )

RETURN NIL

FUNCTION Testwebmapfw( nEnde, nCid, nPais )

   local oDlg, oActiveX, oFnt, oFont
   local aWhatsNear
   Local cStreet, cCity, cCountry
   Local cStreet2, cCity2
   Local cStreet3, cCity3
   Local cStreet4, cCity4
   Local cStreet5, cCity5
   Local cWhatsNear
   Local nZoomLevel

   default cStreet := "AV PAULISTA, 1313", ;
   cCity      := "SAO PAULO", ;
   cCountry   := "BRASIL", ;
   cStreet2   := SPACE( 80 ), ;
   cCity2     := SPACE( 80 ), ;
   cStreet3   := SPACE( 80 ), ;
   cCity3     := SPACE( 80 ), ;
   cStreet4   := SPACE( 80 ), ;
   cCity4     := SPACE( 80 ), ;
   cStreet5   := SPACE( 80 ), ;
   cCity5     := SPACE( 80 )
   cWhatsNear := ''
   nZoomLevel := 0

   aWhatsNear := { ;
      '', ;
      'Hotel', ;
      'Posto de Gasolina', ;
      'Praça de Alimentação', ;
      'Parque', ;
      'Peças e Acessórios de Carros', ;
      'Peças de Caminhões', ;
      'Ferrovias' ;
      }

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SkinButtons()     // Botoes Coloridos nas novas versoes
   SetGetColorFocus( CLR_MENTA )  // COR NO GET - ADD EM: 15/07/2013
   tGet():lDisColors  := .F.
   tGet():nClrTextDis := CLR_BLUE
   tGet():nClrPaneDis := CLR_HRED   //SOFTYELLOW

   DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 00, -12 BOLD
   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 00, -14 BOLD

   DEFINE DIALOG oDlg RESOURCE "MAP" COLORS CLR_BLACK, CLR_WHITE TRANSPARENT

   oDlg:lHelpIcon := .F.

   REDEFINE GET cStreet ID 200 OF oDlg UPDATE

   REDEFINE GET cCity ID 300 OF oDlg UPDATE

   REDEFINE GET cCountry ID 400 OF oDlg UPDATE

   REDEFINE COMBOBOX cWhatsNear ITEMS aWhatsNear ID 140 OF oDlg UPDATE

   REDEFINE GET cStreet2 ID 202 OF oDlg UPDATE

   REDEFINE GET cCity2   ID 302 OF oDlg UPDATE

   REDEFINE GET cStreet3 ID 203 OF oDlg UPDATE

   REDEFINE GET cCity3   ID 303 OF oDlg UPDATE

   REDEFINE GET cStreet4 ID 204 OF oDlg UPDATE

   REDEFINE GET cCity4   ID 304 OF oDlg UPDATE

   REDEFINE GET cStreet5 ID 205 OF oDlg UPDATE

   REDEFINE GET cCity5   ID 305 OF oDlg UPDATE

   REDEFINE GET nZoomLevel ID 141 OF oDlg UPDATE

   REDEFINE BUTTON ID 1 OF oDlg ;
            ACTION ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,  ;
                             cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,;
                             nZoomLevel)

   REDEFINE BUTTON ID 150 OF oDlg ;
            ACTION ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,  ;
                            cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,;
                            nZoomLevel)

   SET FONT OF oDlg TO oFnt

   ACTIVATE DIALOG oDlg CENTERED

   oFnt:End()
   oFont:End()

RETURN NIL

function ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   // you can format address yourself or just
   // type address string like in google maps
   // using :AddStop() instead of :AddStopSep()
   //
   // oWebMap:AddStop( alltrim( cStreet )+','+;
   //    alltrim( cCity )+' '+alltrim( cCountry ) )
   // or
   // oWebMap:AddStop( 'My Address Info' )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )

   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      ShellExecute( 0, "open", oWebMap:cLink,,, 5 )

      // You can also use this for more control
      /*
      oActiveX := TOleAuto():New("InternetExplorer.Application")
      oActiveX:Visible := .T.
      oActiveX:Toolbar := .T.
      oActiveX:Statusbar :=.T.
      oActiveX:MenuBar := .T.
      oActiveX:Navigate( oWebMap:cLink )
      */


      sysrefresh()

   endif

return nil

function ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )
   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      DEFINE WINDOW oWnd TITLE "Google Map Localização" ;
         FROM 0, 0 TO 600, 800 pixel

      oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
      // oActiveX = TOleAuto():New("InternetExplorer.Application")

      // oActivex:Silent := .T.  // Para Evitar: Erro de Script na Pagina.

      oWnd:oClient = oActiveX // To fill the entire window surface

      // these setprop options do not work?
      oActiveX:SetProp( "Visible", .T. )
      oActiveX:SetProp( "Toolbar", .T. )
      oActiveX:SetProp( "Statusbar", .T. )
      oActiveX:SetProp( "MenuBar", .F. )

      oActiveX:Do( "Navigate", oWebMap:cLink )
      sysrefresh()
      // MsgInfo( oActiveX:GetProp( "StatusBar" ) )

      ACTIVATE WINDOW oWnd

      sysrefresh()
   endif

return nil

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
   endif

return cMsg + CRLF

// #include "FiveWin.ch"

#include "Hbclass.ch"

CREATE CLASS WebMap

   VAR aAddress
   VAR nZoomLevel
   VAR cMapType    // 'MAP' = regular map, 'ROUTE' = route
   VAR oIe
   VAR cLink
   VAR cWhatsNear
   METHOD New
   METHOD AddStop
   METHOD AddStopSep
   METHOD GenLink

END CLASS

METHOD New( xAddress, nZoomLevel )

   if nZoomLevel == nil
      // default to 0 for auto calc size
      ::nZoomLevel := 0
   else
      ::nZoomLevel := nZoomLevel
   endif

   ::cLink := ''
   ::cWhatsNear := ''

   // Initialize address array
   do case
      case xAddress == nil
         ::aAddress := {}
      case valtype( xAddress ) == 'A'
         ::aAddress := xAddress
      otherwise
         ::aAddress := { xAddress }
   endcase

   // if address passed on command line lets auto create link string
   if len( ::aAddress ) > 0
      ::GenLink()
   endif

RETURN( self )

//////////////////////////////////////////
////// Method AddStop
//////////////////////////////////////////
// Purpose - To add a pre-formatted address
//            to ::aAddress
//
METHOD AddStop( cAddress )
   if cAddress != nil
      // convert spaces to +
      aadd( ::aAddress, strtran( trim( cAddress ),' ', '+' ) )
   endif
RETURN nil

//////////////////////////////////////////
////// Method AddStopSep
//////////////////////////////////////////
// Purpose - To add an address to ::aAddress
//           when you have seperate street,
//           city, zip etc that need to be
//           formated into Google Map format
// Note - You can format address yourself or just
//        type address string like in google maps
//        using :AddStop() instead of :AddStopSep()
//
METHOD AddStopSep( cStreet, cCity, cState, cZip, cCountry )
   local cAddr2

   *   default( @cStreet, '' )
   *   default( @cCity, '' )
   *   default( @cState, '' )
   *   default( @cZip, '' )
   *   default( @cCountry, '' )
   DEFAULT cStreet:= ""
   DEFAULT cCity:= ""
   DEFAULT cState:= ""
   DEFAULT cZip:= ""
   DEFAULT cCountry:= ""

   cAddr2 := ltrim( trim( cCity )+' ' )
   cAddr2 += ltrim( trim( cState )+' ' )
   cAddr2 += ltrim( trim( cZip )+' ' )
   cAddr2 += ltrim( trim( cCountry ) )

   if at( ',', cAddr2 ) > 0
      // Remove commas from this portion of address
      cAddr2 := strtran( cAddr2,',', ' ' )
      // Remove extra spaces if any
      cAddr2 := strtran( cAddr2,'  ', ' ' )
   endif

   do case
      case .not. empty( cStreet ) .and. .not. empty( cAddr2 )
         ::AddStop( trim( cStreet)+', '+cAddr2 )
      case empty( cStreet ) .and. .not. empty( cAddr2 )
         ::AddStop( cAddr2 )
      case .not. empty( cStreet ) .and. empty( cAddr2 )
         ::AddStop( trim( cStreet) )
   endcase

RETURN nil

//////////////////////////////////////////
////// Method GenLink
//////////////////////////////////////////
// Purpose - To generate link string that
//           can be passed to Internet Explorer
//           Shell or link string can be emailed
METHOD GenLink()

   local nCounter, nFor

   ::cLink := 'http://maps.google.com/maps?'

   do case
      case len( ::aAddress ) = 0
         // this will just display country map
         ::cMapType := 'MAP'
      case len( ::aAddress ) > 1
         // must be route so update map type
         ::cMapType := 'ROUTE'
      otherwise
         ::cMapType := 'MAP'
   endcase

   for nFor := 1 to len( ::aAddress )
      do case
         case nFor = 1
            if ::cMapType = 'ROUTE'
               ::cLink += 'saddr='+::aAddress[ nFor ]
            else
               // In order to use info near address
               // Must be in map mode and not route mode
               if empty( ::cWhatsNear )
                  ::cLink += 'q='+::aAddress[ nFor ]
               else
                  ::cLink += 'q='+trim(::cWhatsNear)
                  ::cLink += chr(38)+'near='+::aAddress[ nFor ]
               endif
            endif
         case nFor = 2
            ::cLink += chr(38)+'daddr='+::aAddress[ nFor ]
         otherwise
            ::cLink += ',+to:'+::aAddress[ nFor ]
      endcase
   next

   if .not. empty( ::cLink )
      // Extra options.
      // I have commented out some of the ones that are not required
      // ::cLink += chr(38)+'hl=en'
      // ::cLink += chr(38)+'mra=pi'
      // ::cLink += chr(38)+'mrcr=1'
      // ::cLink += chr(38)+'sll=31.244355,-95.99896'
      // ::cLink += chr(38)+'sspn=2.934965,5.108643'
      // ::cLink += chr(38)+'ie=UTF8'
      if ::nZoomLevel > 0
         ::cLink += chr(38)+'z='+ltrim( str( ::nZoomLevel ) )
      endif
      // ::cLink += chr(38)+'om=1'
   endif

RETURN( ::cLink )


// WEBMAP.RC
/*
MAP DIALOG 170, 66, 315, 215
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Google Maps Localização"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 EDITTEXT 200, 8, 17, 302, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 300, 8, 42, 150, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 400, 160, 42, 150, 12, WS_BORDER | WS_TABSTOP
 CONTROL "Near", 140, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 8, 71, 167, 67
 EDITTEXT 141, 189, 71, 22, 12, WS_BORDER | WS_TABSTOP
 DEFPUSHBUTTON "&Mostrar no Navegador", 150, 19, 190, 110, 14
 PUSHBUTTON "Mostrar &Dentro do Sistema", 1, 132, 190, 110, 14
 PUSHBUTTON "&Saida", 2, 245, 190, 50, 14
 EDITTEXT 202, 10, 122, 190, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 302, 209, 122, 100, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 203, 10, 138, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 303, 209, 138, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 204, 10, 155, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 304, 209, 155, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 205, 10, 171, 189, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 305, 209, 171, 100, 12, WS_BORDER | WS_TABSTOP
 LTEXT "Endereço e Número", -1, 8, 6, 190, 8
 LTEXT "Cidade ou CEP", -1, 8, 32, 92, 8
 LTEXT "País", -1, 159, 32, 92, 8
 LTEXT "Extras que estão perto do endereço acima", -1, 8, 60, 170, 8
 LTEXT "Para mais direções digite mais endereços", -1, 8, 96, 190, 8
 LTEXT "Endereço e Número", -1, 10, 111, 189, 9
 LTEXT "Cidade ou CEP", -1, 209, 112, 92, 8
 LTEXT "Nível de Zoom ", -1, 189, 60, 100, 8
 LTEXT "0 ou em branco = Melhor Ajuste", -1, 214, 73, 100, 8
}
*/

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

Re: ShellExecute no abre en una window

Postby mastintin » Thu May 10, 2018 2:17 pm

karinha ..
Code: Select all  Expand view

  ....
    oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
 ....
 


Sigue usando el viejo activex de ie9..
He investigado un poco y para solucionarlo , microsofrt ha sacado el control webview pero solo vale a paretir de win10 versión 1803
https://mspoweruser.com/microsoft-annou ... in32-apps/
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: ShellExecute no abre en una window

Postby karinha » Thu May 10, 2018 2:51 pm

ok Master, a mi me sirve bién.

https://imgur.com/EDslOYI

Image

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

Re: ShellExecute no abre en una window

Postby albeiroval » Fri May 11, 2018 2:54 am

Karinha,

Lo que necesito es NO ABRIR el archivo "html" en el navegador, necesito ABRIRLO desde una ventana WINDOW o un DIALOG.

Como dice el master mastintin, el activeX me da el mismo error con con el archivo javascript

Code: Select all  Expand view

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:Do( "Navigate2", cURL ) )
           
  DeleteObject( oCx )
 
Return Nil
 


Usando este codigo me da error de incompatibildad de navergador con iexpolrer. Ahora si yo abro el archivo ".htm" desde iexplorer lo corre sin problemas, esto es por el ActiveX.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ShellExecute no abre en una window

Postby Carles » Fri May 11, 2018 5:33 am

Albeiroval,

Prueba este trozo q he encontrado...

Code: Select all  Expand view
#include "FiveWin.ch"

FUNCTION VerINet(  cStreet, cCity, cCountry )
   local oDlg, oActiveX
   local cEvents := ''

   DEFAULT cStreet  := "Alt Emproda,53"
   DEFAULT cCity    := "La Mora"
   DEFAULT cCountry := 'Tarragona'


   DEFINE DIALOG oDlg RESOURCE 'mapa' TITLE "Localitzant: " + cStreet
                 oDlg:lHelpIcon := .f.

     REDEFINE ACTIVEX oActiveX ID 800 OF oDlg PROGID "Shell.Explorer"

     oActiveX:bOnEvent = { | event | XecDownload( event ) }

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oActiveX:SetProp( "Silent", .T. ), Show( cStreet, cCity, cCountry, oActiveX ) )      

RETU nil

FUNCTION Show( cStreet, cCity, cCountry, oActiveX )

   local cHtml := MemoRead(  "gmap.htm" )
   LOCAL cNewFile
   
   cHtml = StrTran( cHtml, "<<STREET>>", AllTrim( cStreet ) )
   cHtml = StrTran( cHtml, "<<CITY>>", AllTrim( cCity ) )
   cHtml = StrTran( cHtml, "<<COUNTRY>>", AllTrim( cCountry ) )
   
   cNewFile := pFilaTmp( GetoApp():cDirTmp + '', , 'html' )

   MemoWrit( cNewFile, cHtml )
   
   oActiveX&#058;Do( "Navigate2", cNewFile )
   
return nil

function XecDownload( event )

   local cEvent := cValToChar( event )

   IF Upper( cEvent ) == '
DOCUMENTCOMPLETE'

      GetoApp():SetMessage()

    ELSE

*      GetoApp():SetMessage( cEvent )
*      LogFile( '
log.txt', { time(), cEvent } )

   ENDIF


RETU NIL
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1090
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: ShellExecute no abre en una window

Postby Carlos Mora » Fri May 11, 2018 8:51 am

albeiroval wrote:Como dice el master mastintin, el activeX me da el mismo error con con el archivo javascript
Usando este codigo me da error de incompatibildad de navergador con iexpolrer. Ahora si yo abro el archivo ".htm" desde iexplorer lo corre sin problemas, esto es por el ActiveX.


Cuando dices "si yo abro el archivo '.htm' desde iexplorer" ... ¿puede ser que lo estés abriendo con Edge?
Creo recordar que el ActiveX hace uso del iexplore, cuyo desarrollo ha sido abandonado en favor de Edge, que está basado en una máquina totalmente diferente (y por supuesto mucho más actualizada y adaptada al código moderno de las webs actuales. JavaScript ha estado muy activo en los últimos años (hiperactivo diría yo), y cualquier cosa con un par de años se ha quedado obsoleta.

Adhiero al criterio de Mastintín, creo que hay que pensar en una alternativa como webView. Tambien hay que poner a los clientes en Win10. Microsoft ha estado regalando el upgrade por 2 años para no tener que dar soporte a las versiones viejas de Windows, así es que si deja de dar soporte, creo que esta vez están en su derecho.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: ShellExecute no abre en una window

Postby karinha » Fri May 11, 2018 1:37 pm

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

Re: ShellExecute no abre en una window

Postby albeiroval » Fri May 11, 2018 2:18 pm

carlos mora, corrijo uso es Edge con windows 10, la costumbre de que windows trabajaba con iexplorer jeje.
carles, probando tu codigo falta una funcion 'pFilaTmp', gracias.
karinha, en un rato pruebo tu ejemplo, gracias.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ShellExecute no abre en una window

Postby Carles » Fri May 11, 2018 4:16 pm

albeiroval,

Estoy fuera, pero pFilaTmp() es una funcion para crear ficheros temporales. Puedes usar cualquiera q tengas y para hacer pruebas tan facil como poner 'temporal.html'
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1090
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: ShellExecute no abre en una window

Postby albeiroval » Fri May 11, 2018 11:13 pm

carles, anexo imagen del error

[img]
https://postimg.cc/image/yhdq9w55z/
[/img]
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ShellExecute no abre en una window

Postby albeiroval » Sat May 12, 2018 12:11 am

karinha, usando el ejemplo me da el mismo error

[img]
https://postimg.cc/image/42mcitno7/
[/img]
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 359
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests