shellexec or winexec

shellexec or winexec

Postby Otto » Fri Dec 06, 2019 6:00 am

Hello,
I would need an example of how to use shellexec or winexec to run a program in the program's directory.

Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: shellexec or winexec

Postby Otto » Fri Dec 06, 2019 9:20 am

Hello,
as a workaround I tried with a bat-file.

cd\
cd xwinhotel
call xwinhotel.exe

This is working.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: shellexec or winexec

Postby Natter » Fri Dec 06, 2019 9:49 am

Is that what you mean ?

cPt:=CurDrive()+':\'+CurDir()
SHELLEXECUTE( 0, 0, cPt+"\"+MyFile, 0, 0, 1)
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: shellexec or winexec

Postby MGA » Fri Dec 06, 2019 11:32 am

function MyRun( cComando, nStyle, lWait, lShowResult )

local oShell, nRetorno

IF valtype( nStyle ) != "N"
nStyle := 0
ENDIF

IF ValType( lWait ) != "L"
lWait := .T.
ENDIF

IF ValType( lShowResult ) != "L"
lShowResult := .F.
ENDIF

oShell := CreateObject( "WScript.Shell" )

IF !GetEnv( "OS" ) == "Windows_NT"
cComando += "start " + cComando
ENDIF

TRY
nRetorno := oShell:Run( "%comspec% /c " + cComando, nStyle, lWait )
CATCH
MsgStop("ERRO NO ENVIO DO COMANDO!", "MYRUN")
END

IF lShowResult .and. nRetorno > 0 .and. nRetorno <= 32
MsgInfo( "Erro Win_Run(): " + ltrim( Str( nRetorno ) ), "Win_Run - Error" )
ENDIF

oShell := NIL

Return nRetorno = 0
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: shellexec or winexec

Postby MaxP » Fri Dec 06, 2019 11:40 am

To run a second program in the same directory

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


FUNCTION Main()
        LOCAL   cPathProgr := cFilePath( GetModuleFileName( GetInstance() ) )
       
        WinExec( cPathProgr + "PROGR2.EXE" )
RETURN NIL
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: shellexec or winexec

Postby Otto » Fri Dec 06, 2019 6:35 pm

Hello,
thank you all for your help.
I will test all the solutions on the weekend.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests