Shellexecute question

Shellexecute question

Postby Richard Chidiak » Wed Jan 04, 2012 8:32 am

Good morning

I want to execute a php file on my server in silent mode , i do not want the php file to show the navigator's window active

I have tried several combinations of shellexecute but with no success

any idea ?

SHELLEXECUTE(0,"open","http://www.logicielspro.com/logmaj.php",,,1) // putting 0 or 8 instead of 1 has no effect !!!

thanks for your help,

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Shellexecute question

Postby ADutheil » Wed Jan 04, 2012 10:30 am

A workaround might be to open a new window in a non visible area of the screen and run the command in it:

#include "fivewin.ch"

FUNCTION Main
LOCAL oWnd

DEFINE WINDOW oWnd TITLE "Test"
SET MESSAGE OF oWnd TO "Suporte: a.dutheil@pobox.com" CLOCK DATE KEYBOARD NOINSET 2007
ACTIVATE WINDOW oWnd ON INIT ( oWnd:oMsgBar:ClockOn(), oWnd:oMsgBar:DateOn(), Test() ) ;
VALID if( MsgYesNo( "Confirma saída", "Atenção" ), .t., .f. )
RETURN ( NIL )


FUNCTION Test
LOCAL oActX := NIL
LOCAL oDlg := NIL

DEFINE DIALOG oDlg FROM 10, 230 TO 80, 280
@ 1,1 ACTIVEX oActX OF oDlg PROGID "Shell.Explorer"
ACTIVATE DIALOG oDlg ON INIT ( oActX:Do( "Navigate2", "http://www.logicielspro.com/logmaj.php" ) ) NOWAIT
RETURN ( NIL )
Last edited by ADutheil on Wed Jan 04, 2012 11:45 am, edited 1 time in total.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Shellexecute question

Postby Richard Chidiak » Wed Jan 04, 2012 11:13 am

Thanks for replying

the problem is not the window in itself but closing automatically the window without having the user doing it

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Shellexecute question

Postby Antonio Linares » Wed Jan 04, 2012 11:30 am

Richard,

Please try this function with the same parameters that you are using (SW_HIDE = 0)
Code: Select all  Expand view

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

HB_FUNC( SHELLEXECUTE )
{
   hb_retnl( ( HB_LONG ) ShellExecute( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ) ) );
}

#pragma ENDDUMP
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Shellexecute question

Postby Richard Chidiak » Wed Jan 04, 2012 11:41 am

Antonio

Same result

The windows is shown

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Shellexecute question

Postby Richard Chidiak » Wed Jan 04, 2012 11:54 am

Antonio

The last parameter (sw_HIDE) has no effect whatever the value is, i understand you try to override the standard function , i even tried to call direct from the api but same result ....the window is always opened (new window)

DLL32 FUNCTION SHELLEXEC3( hWnd AS LONG, cOperation AS LPSTR, cFile AS ;
LPSTR, cParameters AS LPSTR, cDirectory AS LPSTR, nShowCmd AS LONG ) AS LONG;
PASCAL FROM "ShellExecuteA" LIB "shell32.dll"
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Shellexecute question

Postby ADutheil » Wed Jan 04, 2012 12:18 pm

Adding a timer the dialog pop and hide by itself:

#include "fivewin.ch"

FUNCTION Main
LOCAL oWnd

DEFINE WINDOW oWnd TITLE "Test"
SET MESSAGE OF oWnd TO "Suporte: a.dutheil@pobox.com" CLOCK DATE KEYBOARD NOINSET 2007
ACTIVATE WINDOW oWnd ON INIT ( oWnd:oMsgBar:ClockOn(), oWnd:oMsgBar:DateOn(), Test( oWnd ) ) ;
VALID if( MsgYesNo( "Confirma saída", "Atenção" ), .t., .f. )
RETURN ( NIL )


FUNCTION Test( oWnd )
LOCAL oActX := NIL
LOCAL oDlg := NIL


//DEFINE DIALOG oDlg FROM 10, 230 TO 80, 280 // to hide the dialog
DEFINE DIALOG oDlg FROM 10, 30 TO 40, 80
@ 1,1 ACTIVEX oActX OF oDlg PROGID "Shell.Explorer"
ACTIVATE DIALOG oDlg ON INIT ( Timer( oDlg, oWnd ), oActX:Do( "Navigate2", "http://www.logicielspro.com/logmaj.php" ) ) NOWAIT
RETURN ( NIL )

FUNCTION Timer( oDlg, oWnd )
LOCAL oTime := NIL

DEFINE TIMER oTime INTERVAL 1000 ACTION if( Action( oDlg ), ( oTime:End(), oDlg:End() ), ) OF oWnd
ACTIVATE TIMER oTime

RETURN ( NIL )

FUNCTION Action( oDlg )
waitseconds( 1 )
RETURN ( .T. )
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Shellexecute question

Postby Richard Chidiak » Wed Jan 04, 2012 2:18 pm

André

Thanks

This is another solution that works as expected, no window is opened, php is executed as wanted

curl := "http://www.logicielspro.com/logmaj/logmaj.php"

local oIE := CREATEOBJECT( "InternetExplorer.Application" )
WITH OBJECT oIE
:Visible := .F.
:ToolBar := .F.
:StatusBar := .F.
:MenuBar := .F.
:Invoke( "Navigate", cUrl )
END WITH


Antonio , i am still puzzled why shellexecute is not responding correctly , so much easier to use

Thanks for all help,

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Shellexecute question

Postby frose » Wed Jan 04, 2012 2:27 pm

Richard,

found the same behaviour, ShellExecute respecively the target app ignores these parameters.

In my console app I'm using nircmd (http://www.nirsoft.net/utils/nircmd2.html#using), for a FiveWin-App you can use GetTasks(), look here:
viewtopic.php?f=3&t=21957
viewtopic.php?f=3&t=21070
viewtopic.php?f=3&t=20472
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Rick Lipkin and 87 guests