Page 1 of 1
Question about WinExec()
Posted: Mon Apr 19, 2021 2:45 pm
by driessen
Hello,
Why isn't this code working?
When I try this command line in the command prompt, it is working just fine.
Someone any idea?
Thanks.
Re: Question about WinExec()
Posted: Mon Apr 19, 2021 3:04 pm
by karinha
Maybe:
Code: Select all | Expand
WinExec("TASKKILL /F /s terminal /u password /im OUTLOOK.EXE",0)
Regards.
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 1:38 am
by hua
Michel,
Maybe can try experimenting with ShellExecute()
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 7:36 am
by driessen
Thanks for your suggestion, but ShellExecute() doesn't do the job either.
So I developed a solution by going arround the problem :
Code: Select all | Expand
IF FILE(nProg1 + "KILLOUT.BAT") ; DELETE FILE(nProg1 + "KILLOUT.BAT") ; ENDIF
aOutFile := FCREATE(nProg1 + "KILLOUT.BAT")
FWRITE(aOutFile,"TASKKILL.EXE /F /IM OUTLOOK.EXE")
FCLOSE(aOutFile)
WinExec(nProg1 + "KILLOUT.BAT",0)
SYSWAIT(1)
IF FILE(nProg1 + "KILLOUT.BAT") ; DELETE FILE(nProg1 + "KILLOUT.BAT") ; ENDIF
And guess what? It works this way.
Thank you.
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 8:20 am
by Antonio Linares
very good!
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 9:03 am
by Enrico Maria Giordano
driessen wrote:Hello,
Why isn't this code working?
When I try this command line in the command prompt, it is working just fine.
Someone any idea?
Thanks.
I tried your sample as is and it worked fine.
EMG
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 12:54 pm
by Euclides
Hi to all.
WinExec("TASKKILL.EXE /IM NOTEPAD.EXE /F",0)
did not work im my computer (W 8.1)
but...
WinExec("CMD /C TASKKILL.EXE /IM NOTEPAD.EXE /F",0)
did the job.
Regards, Euclides
Re: Question about WinExec()
Posted: Tue Apr 20, 2021 4:03 pm
by driessen
Thank you very much for your suggestion.
I'll try it out tomorrow.
After edit : Thank you so much. It works fine now.
Re: Question about WinExec()
Posted: Wed Apr 21, 2021 5:52 am
by Otto
Hello Euclides,
May I ask for your help.
Do you think that I could replace this function with a Winexec().
Code: Select all | Expand
function runIndxprg( nkdnr )
local cText := ""
cText += "cd\" + CRLF
cText += "cd C:\Windows\System32" + CRLF
cText += "REM window-position=y col,x row" + CRLF
cText += "start chrome --new-window --app=https://test.com.space/formular/index.prg?recnr=" + ALLTRIM(STR( nkdnr )) + "--window-position=600,300 --window-size=1500,730"
memowrit("c:\xwinhotel\formular.bat", cText )
waitrun( "c:\xwinhotel\formular.bat", 0 )
return nil
Sincerely
Otto
Re: Question about WinExec()
Posted: Wed Apr 21, 2021 1:21 pm
by Euclides
Hi Otto.
The same way...
Code: Select all | Expand
nkdnr := 10
WinExec("CMD /C start chrome --new-window --app=https://test.com.space/formular/index.prg?recnr=" + ALLTRIM(STR( nkdnr )) + " --window-position=600,300 --window-size=1500,730",0)
It opened the window with the correct size but got DNS_PROBE_FINISHED_NXDOMAIN error.
But...
Code: Select all | Expand
WinExec("CMD /C start chrome --new-window --app=http://fivewin.com.br/index.php?/files/ --window-position=600,300 --window-size=1500,730",0)
Opens the site OK but does not respect the window sposition and size parameters
With your program compiled, got the same DNS_PROBE_FINISHED_NXDOMAIN error.
Regards, Euclides
Re: Question about WinExec()
Posted: Wed Apr 21, 2021 4:36 pm
by Otto
Hello Euclides,
Thanks, it works very well. I run the program in localhost.
I want to make my WINHOTEL extensions in the future with mod harbour since we can access the same databases.
Thanks again. The call is much safer now. No bat-file - which you can change - in between.
Best regards,
Otto
