shellexec or winexec

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

shellexec or winexec

Post by Otto »

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

********************************************************************
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: shellexec or winexec

Post by Otto »

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

********************************************************************
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: shellexec or winexec

Post by Natter »

Is that what you mean ?

cPt:=CurDrive()+':\'+CurDir()
SHELLEXECUTE( 0, 0, cPt+"\"+MyFile, 0, 0, 1)
MGA
Posts: 1219
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Re: shellexec or winexec

Post by MGA »

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

FWH17.04
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: shellexec or winexec

Post by MaxP »

To run a second program in the same directory

Code: Select all

#include "FiveWin.ch"


FUNCTION Main()
        LOCAL   cPathProgr := cFilePath( GetModuleFileName( GetInstance() ) )
        
        WinExec( cPathProgr + "PROGR2.EXE" )
RETURN NIL
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: shellexec or winexec

Post by Otto »

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

********************************************************************
Post Reply