Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #8186 > unrolled thread
| Started by | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| First post | 2015-06-11 12:04 +0200 |
| Last post | 2015-06-26 10:35 -0400 |
| Articles | 16 — 6 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-11 12:04 +0200
Re: ShellExecute works one time and then only again after re-entering the program "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> - 2015-06-11 18:00 +0200
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-11 22:58 +0200
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-18 17:02 +0200
Re: ShellExecute works one time and then only again after re-entering the program Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2015-06-11 23:37 +0200
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-18 17:00 +0200
Re: ShellExecute works one time and then only again after re-entering the program sherlocksoftware@gmail.com - 2015-06-19 04:17 -0700
Re: ShellExecute works one time and then only again after re-entering the program "Jamal Assaf" <someone@example.com> - 2015-06-19 15:14 -0400
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-22 08:54 +0200
Re: ShellExecute works one time and then only again after re-entering the program "Jamal Assaf" <someone@example.com> - 2015-06-23 11:53 -0400
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-24 17:01 +0200
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-25 20:31 +0200
Re: ShellExecute works one time and then only again after re-entering the program Steve E <steven_emmett@yahoo.co.uk> - 2015-06-25 23:22 -0700
Re: ShellExecute works one time and then only again after re-entering the program D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-06-26 10:18 +0200
Re: ShellExecute works one time and then only again after re-entering the program Steve E <steven_emmett@yahoo.co.uk> - 2015-06-26 03:06 -0700
Re: ShellExecute works one time and then only again after re-entering the program "Jamal Assaf" <someone@example.com> - 2015-06-26 10:35 -0400
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-11 12:04 +0200 |
| Subject | ShellExecute works one time and then only again after re-entering the program |
| Message-ID | <ihminadbcjcefec7tnuqbcblqtjs7q63p9@4ax.com> |
From time to time I encounter ShellExecute problems with isoaled
cases. For one client, ShellExecute starting a Vulcan executable works
one time (it starts the exe as we can see from the log from that exe).
The second time the users runs that code the Vulcan exe appears not to
start and also some logging activity further in that routine from the
VO program stops (these are some unconditional entries which then
stopped appearing, using FWriteText).
Only after re-entering the VO program it works again, one time.
The call is:
ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,
NULL,SW_SHOWNORMAL)
It looks like this happens for one user only but I have not yet found
out what is different for that user.
Anyone who has an idea?
Dick
[toc] | [next] | [standalone]
| From | "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> |
|---|---|
| Date | 2015-06-11 18:00 +0200 |
| Message-ID | <8giex.122126$fA.81682@fe51.am1> |
| In reply to | #8186 |
METHOD RunSafe(sPath,sFile,sOptions) CLASS MC_Universe
LOCAL SEInfo AS _WinShellExecuteInfo
LOCAL hProc AS PTR
LOCAL lpExitCode AS DWORD
LOCAL lRunning AS LOGIC
lpExitCode := 0
SEInfo :=MemAlloc(_SIZEOF(_winSHELLEXECUTEINFO))
SEInfo.cbSize :=_SIZEOF(_winSHELLEXECUTEINFO)
SEInfo.fMask :=SEE_MASK_NOCLOSEPROCESS + SEE_MASK_FLAG_NO_UI
SEInfo.Hwnd :=NULL_PTR
SEInfo.lpVerb :=PSZ(_CAST,"open")
SEInfo.lpFile :=PSZ(_CAST, sFile)
SEInfo.lpParameters :=PSZ(_CAST, sOptions)
SEInfo.lpDirectory :=String2Psz(sPath)
SEInfo.nShow :=SW_HIDE
SEInfo.hInstApp :=NULL_PTR
SEInfo.lpClass :=NULL_PSZ
IF ShellExecuteEx(SEInfo) // File executed correctly
hProc:=SEInfo.hProcess
GetExitCodeProcess(hProc,@lpExitCode)
lRunning:=(lpExitCode=STILL_ACTIVE)
DO WHILE lRunning // Wait until finishes
GetExitCodeProcess( hProc, @lpExitCode )
lRunning:=(lpExitCode=STILL_ACTIVE)
ENDDO
CloseHandle(SEInfo.hProcess)
MemFree(SEInfo)
// File was executed and the execution finished
ELSE
// An error occured (use GetLastError() to see what happened)
MemFree(SEInfo)
ENDIF
RETURN lpExitCode
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-11 22:58 +0200 |
| Message-ID | <lgtjna57qc665kchgdagflkg1osh4214h9@4ax.com> |
| In reply to | #8189 |
On Thu, 11 Jun 2015 18:00:09 +0200, "Marc Verkade [MITCon]" <marc@mitNOSPAMconDELETE.nl> wrote: >METHOD RunSafe(sPath,sFile,sOptions) CLASS MC_Universe Thanks Marc; I found this method in an earlier post in this NG and it appeared to be already in my code. However, I added the following note: NOTE This doesn't seem to work (at least with sOptions empty). Not sure what I tried but maybe I just couldn't find the right options. Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-18 17:02 +0200 |
| Message-ID | <d9n5oaloqj5rbqko840urislolmg91u7ni@4ax.com> |
| In reply to | #8190 |
On Thu, 11 Jun 2015 22:58:47 +0200, D.J.W. van Kooten <vankooten@removethis.ic2.com> wrote: >On Thu, 11 Jun 2015 18:00:09 +0200, "Marc Verkade [MITCon]" ><marc@mitNOSPAMconDELETE.nl> wrote: > >>METHOD RunSafe(sPath,sFile,sOptions) CLASS MC_Universe > Hello Marc, FYI: Indeed this method doesn't work. If I pass a valid path + exectuable name, (and no paramaters) the line IF ShellExecuteEx(SEInfo) // File executed correctly returns true but the program is never called or executed. Dick
[toc] | [prev] | [next] | [standalone]
| From | Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> |
|---|---|
| Date | 2015-06-11 23:37 +0200 |
| Message-ID | <gqvjnapmhgn0q6nrppajm0n7496fm6hg10@4ax.com> |
| In reply to | #8186 |
Dick,
i use Spawn class by Normand Mongeau, almost 20 years old code <g>, to
launch whatever, and it always worked for me. If you want to have a
look, drop me a pn
Karl
>From time to time I encounter ShellExecute problems with isoaled
>cases. For one client, ShellExecute starting a Vulcan executable works
>one time (it starts the exe as we can see from the log from that exe).
>The second time the users runs that code the Vulcan exe appears not to
>start and also some logging activity further in that routine from the
>VO program stops (these are some unconditional entries which then
>stopped appearing, using FWriteText).
>
>Only after re-entering the VO program it works again, one time.
>
>The call is:
>
>ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,
>NULL,SW_SHOWNORMAL)
>
>It looks like this happens for one user only but I have not yet found
>out what is different for that user.
>
>Anyone who has an idea?
>
>Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-18 17:00 +0200 |
| Message-ID | <sum5oa1n52giqsokbbp5rmp5nj3h2kphed@4ax.com> |
| In reply to | #8191 |
On Thu, 11 Jun 2015 23:37:44 +0200, Karl Faller
<mail_withoutthat_@_drei-f_andthat_.de> wrote:
Hello Karl,
>i use Spawn class by Normand Mongeau, almost 20 years old code <g>, to
>launch whatever, and it always worked for me. If you want to have a
>look, drop me a pn
>
Thank you Karl, I will check one more thing before I do that:
currently I have this code:
hReturn:=ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanPrg.exe"),NULL,
NULL,SW_SHOWNORMAL)
nRet:=INT(@hReturn)
IF nRet<=32
IF nRet=2
ErrorBox{,Vt(MSG_FILENOTFOUND,"File
not found")+" : "+cPath+"IC2WebExchangeWCF.exe"}:Show()
ENDIF
RETURN nRet
ELSE
RETURN 32
ENDIF
There are multiple return messages in
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
and I found that it returned 2 (ERROR_FILE_NOT_FOUND I guess) if I
renamed MyVulcanPrg.exe to be unfindable.
I log the return value; let's see if this now logs if just calling the
Vulcan program fails, or if there's more wrong. I'l llet you know.
Dick
[toc] | [prev] | [next] | [standalone]
| From | sherlocksoftware@gmail.com |
|---|---|
| Date | 2015-06-19 04:17 -0700 |
| Message-ID | <fed4e8ac-1aa2-4720-9881-d2397967ae56@googlegroups.com> |
| In reply to | #8186 |
Runs once eh.. it is not ;
ShellExecute(NULL,String2Psz("open"),String2Psz("shutdown /r"),NULL,
NULL,SW_SHOWNORMAL)
Phil McGuinness
[toc] | [prev] | [next] | [standalone]
| From | "Jamal Assaf" <someone@example.com> |
|---|---|
| Date | 2015-06-19 15:14 -0400 |
| Message-ID | <mm1pls$aj6$1@news.albasani.net> |
| In reply to | #8186 |
Maybe the issue with is the MyVulcanProgram.exe program possibly stuck in
memory. Have you checked the Task Manager?
Jamal
"D.J.W. van Kooten" wrote in message
news:ihminadbcjcefec7tnuqbcblqtjs7q63p9@4ax.com...
From time to time I encounter ShellExecute problems with isoaled
cases. For one client, ShellExecute starting a Vulcan executable works
one time (it starts the exe as we can see from the log from that exe).
The second time the users runs that code the Vulcan exe appears not to
start and also some logging activity further in that routine from the
VO program stops (these are some unconditional entries which then
stopped appearing, using FWriteText).
Only after re-entering the VO program it works again, one time.
The call is:
ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,
NULL,SW_SHOWNORMAL)
It looks like this happens for one user only but I have not yet found
out what is different for that user.
Anyone who has an idea?
Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-22 08:54 +0200 |
| Message-ID | <klbfoatdh0601hj2bn90va8ku4ook2uq48@4ax.com> |
| In reply to | #8224 |
On Fri, 19 Jun 2015 15:14:04 -0400, "Jamal Assaf" <someone@example.com> wrote: Hello Jamal, >Maybe the issue with is the MyVulcanProgram.exe program possibly stuck in >memory. Have you checked the Task Manager? > I haven't because I can not reproduce it myself and it happens multiple times during the day. If I run that part of the program on their RD system, I can repeat it over and over again without problems. What I can see from several logs is this: 1 The VO program logs in a DBF file that Shellexecute succeeded with exit code 32 2 At the same time, just one program line befor or after this log entry, it does NOT log to a text based log using FCreate and FWriteText 3 The Vulcan program does NOT log being started 4 If the Vulcan program doesn't start it doesn't delete a certain file so the VO program times out after 10 seconds. This is also logged in the DBF file. The user sometimes retries but the say that won't work. Just exiting the VO program does work, then it works again. Step 4 makes it not likely that the Vulcan program is stuck in memory, it would not work again after just starting VO I would say. If the exit code of ShellExecute is reliable, the scenario is that it does start but it something prevents both programs from writing text files and most likely, from more. It's one of the weirdest things I've seen in years. Dick
[toc] | [prev] | [next] | [standalone]
| From | "Jamal Assaf" <someone@example.com> |
|---|---|
| Date | 2015-06-23 11:53 -0400 |
| Message-ID | <mmbvds$3vv$1@speranza.aioe.org> |
| In reply to | #8186 |
Try this:
ShellExecute(NULL, String2Psz("open"), String2Psz("MyVulcanProgram.exe"),
NULL, String2Psz(cPath), SW_SHOW)
Note: the path is provided in the lpDirectory parameter. This is what I do.
instead of
ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,String2Psz(WorkDir()),
NULL,SW_SHOWNORMAL)
Jamal
"D.J.W. van Kooten" wrote in message
news:ihminadbcjcefec7tnuqbcblqtjs7q63p9@4ax.com...
From time to time I encounter ShellExecute problems with isoaled
cases. For one client, ShellExecute starting a Vulcan executable works
one time (it starts the exe as we can see from the log from that exe).
The second time the users runs that code the Vulcan exe appears not to
start and also some logging activity further in that routine from the
VO program stops (these are some unconditional entries which then
stopped appearing, using FWriteText).
Only after re-entering the VO program it works again, one time.
The call is:
ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,
NULL,SW_SHOWNORMAL)
It looks like this happens for one user only but I have not yet found
out what is different for that user.
Anyone who has an idea?
Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-24 17:01 +0200 |
| Message-ID | <gehloap4m1gndjahogmpg6v41vlgk5p2t6@4ax.com> |
| In reply to | #8233 |
On Tue, 23 Jun 2015 11:53:29 -0400, "Jamal Assaf"
<someone@example.com> wrote:
Hello Jamal,
>Try this:
>
>ShellExecute(NULL, String2Psz("open"), String2Psz("MyVulcanProgram.exe"),
>NULL, String2Psz(cPath), SW_SHOW)
>
>Note: the path is provided in the lpDirectory parameter. This is what I do.
>
>instead of
>
>ShellExecute(NULL,String2Psz("open"),String2Psz(cPath+"MyVulcanProgram.exe"),NULL,String2Psz(WorkDir()),
>NULL,SW_SHOWNORMAL)
>
I've changed it in the current program, thank you for the suggestion -
let's see if that makes any difference for the problem.
What I see happening doesn't seem to make any sense but sometimes
something seemingly unrelated solves a problem.
Dick
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-25 20:31 +0200 |
| Message-ID | <6uhooaln4plf710eddsj9mjjp1634mm9c0@4ax.com> |
| In reply to | #8233 |
On Tue, 23 Jun 2015 11:53:29 -0400, "Jamal Assaf"
<someone@example.com> wrote:
Hello Jamal,
You're my hero of the week!
Indeed:
>ShellExecute(NULL, String2Psz("open"), String2Psz("MyVulcanProgram.exe"),
>NULL, String2Psz(cPath), SW_SHOW)
solved the problem, I can see this from the log and it is confirmed by
the customer.
It really puzzles me how you knew this.
MSDN says:
SW_SHOW (5)
Activates the window and displays it in its current size and position.
SW_SHOWNORMAL (1)
Activates and displays a window. If the window is minimized or
maximized, Windows restores it to its original size and position. An
application should specify this flag when displaying the window for
the first time.
Almost every sample, also in this NG, routinely suggest to use
SHOW_SHOWNORMAL. Reading the above, you would expect this to use only
the first time. And then what? It's not really clear. But SW_SHOW
works the first time AND the next times.
Remains the puzzle why it works on some systems with SW_SHOWNORMAL and
not on others (even per user on the same RD) and especially the puzzle
how it could stop both the Vulcan and the VO program to create .txt
log files while the DBF read/writes remained working.
Anyhow, thank you so much for sharing this knowledge with me!
Dick
[toc] | [prev] | [next] | [standalone]
| From | Steve E <steven_emmett@yahoo.co.uk> |
|---|---|
| Date | 2015-06-25 23:22 -0700 |
| Message-ID | <496238f3-f7a8-4f36-bb7e-50cdc2b58bd0@googlegroups.com> |
| In reply to | #8245 |
On Thursday, June 25, 2015 at 7:31:45 PM UTC+1, D. J. W. van Kooten wrote:
> On Tue, 23 Jun 2015 11:53:29 -0400, "Jamal Assaf"
> <someone@example.com> wrote:
>
> Hello Jamal,
>
> You're my hero of the week!
>
> Indeed:
>
> >ShellExecute(NULL, String2Psz("open"), String2Psz("MyVulcanProgram.exe"),
> >NULL, String2Psz(cPath), SW_SHOW)
>
>
> solved the problem, I can see this from the log and it is confirmed by
> the customer.
>
>
> It really puzzles me how you knew this.
>
> MSDN says:
>
> SW_SHOW (5)
>
> Activates the window and displays it in its current size and position.
>
> SW_SHOWNORMAL (1)
>
> Activates and displays a window. If the window is minimized or
> maximized, Windows restores it to its original size and position. An
> application should specify this flag when displaying the window for
> the first time.
>
> Almost every sample, also in this NG, routinely suggest to use
> SHOW_SHOWNORMAL. Reading the above, you would expect this to use only
> the first time. And then what? It's not really clear. But SW_SHOW
> works the first time AND the next times.
>
> Remains the puzzle why it works on some systems with SW_SHOWNORMAL and
> not on others (even per user on the same RD) and especially the puzzle
> how it could stop both the Vulcan and the VO program to create .txt
> log files while the DBF read/writes remained working.
>
> Anyhow, thank you so much for sharing this knowledge with me!
>
> Dick
Hi Dick,
I think this is working because of the change to the you make to the path (parameter 5)and the program name (parameter 3). If you look at the text in MSDN it says not to include the path in parameter 3, only the program name and definitely not to include it in both parameters. Hopefully this is sustainable now and the problem is resolved.
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2015-06-26 10:18 +0200 |
| Message-ID | <i22qoal56u7u1j0tlut2mh1tk08frtmde3@4ax.com> |
| In reply to | #8246 |
On Thu, 25 Jun 2015 23:22:02 -0700 (PDT), Steve E <steven_emmett@yahoo.co.uk> wrote: Hello Steve, >I think this is working because of the change to the you make to the path (parameter 5)and the program name (parameter 3). > If you look at the text in MSDN it says not to include the path in parameter 3, only the program name and definitely not to include it in both parameters. > Hopefully this is sustainable now and the problem is resolved. Indeed! If it is the path you would expect it to not work at all - and not the 1st time (and without problems on other locations). But the erratic behaviour doesn't make sense at all anyway. It really seems fixed and that's great. Dick
[toc] | [prev] | [next] | [standalone]
| From | Steve E <steven_emmett@yahoo.co.uk> |
|---|---|
| Date | 2015-06-26 03:06 -0700 |
| Message-ID | <140557a7-590d-4b9a-9d19-31d12b46087f@googlegroups.com> |
| In reply to | #8247 |
On Friday, June 26, 2015 at 9:18:35 AM UTC+1, D. J. W. van Kooten wrote: > On Thu, 25 Jun 2015 23:22:02 -0700 (PDT), Steve E > <steven_emmett@yahoo.co.uk> wrote: > > Hello Steve, > > >I think this is working because of the change to the you make to the path (parameter 5)and the program name (parameter 3). > > If you look at the text in MSDN it says not to include the path in parameter 3, only the program name and definitely not to include it in both parameters. > > Hopefully this is sustainable now and the problem is resolved. > > Indeed! If it is the path you would expect it to not work at all - and > not the 1st time (and without problems on other locations). But the > erratic behaviour doesn't make sense at all anyway. > > It really seems fixed and that's great. > > Dick I agree Dick, it's often frustrating when things are not consistent but the main thing is that the problem seems to be resolved.
[toc] | [prev] | [next] | [standalone]
| From | "Jamal Assaf" <someone@example.com> |
|---|---|
| Date | 2015-06-26 10:35 -0400 |
| Message-ID | <mmjnv7$a8g$1@speranza.aioe.org> |
| In reply to | #8245 |
Hi Dick,
It is a combination of passing the exe path in the lpDirectory parameter and
show flag.
In my apps, I call several specialized external EXE programs which I've
written. Sometimes the apps did not start via the ShellExecute on different
computers even with the same version of windows.
After applying the changes I mentioned, I never had an issue.
I am glad it's working for you.
Jamal
"D.J.W. van Kooten" wrote in message
news:6uhooaln4plf710eddsj9mjjp1634mm9c0@4ax.com...
On Tue, 23 Jun 2015 11:53:29 -0400, "Jamal Assaf"
<someone@example.com> wrote:
Hello Jamal,
You're my hero of the week!
Indeed:
>ShellExecute(NULL, String2Psz("open"), String2Psz("MyVulcanProgram.exe"),
>NULL, String2Psz(cPath), SW_SHOW)
solved the problem, I can see this from the log and it is confirmed by
the customer.
It really puzzles me how you knew this.
MSDN says:
SW_SHOW (5)
Activates the window and displays it in its current size and position.
SW_SHOWNORMAL (1)
Activates and displays a window. If the window is minimized or
maximized, Windows restores it to its original size and position. An
application should specify this flag when displaying the window for
the first time.
Almost every sample, also in this NG, routinely suggest to use
SHOW_SHOWNORMAL. Reading the above, you would expect this to use only
the first time. And then what? It's not really clear. But SW_SHOW
works the first time AND the next times.
Remains the puzzle why it works on some systems with SW_SHOWNORMAL and
not on others (even per user on the same RD) and especially the puzzle
how it could stop both the Vulcan and the VO program to create .txt
log files while the DBF read/writes remained working.
Anyhow, thank you so much for sharing this knowledge with me!
Dick
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web