Author |
Topic: Using OSCLI to call xcopy (Read 1215 times) |
|
81RED
Guest
|
 |
Re: Using OSCLI to call xcopy
« Reply #8 on: Feb 3rd, 2010, 11:41am » |
|
I asked because a
Code:SYS "GetExitCodeProcess", sei.hProcess% TO exitcode% Within the procedure you kindly provided, unceremoniously causes BB4W to crash. I suspect I'm doing something blatantly stupid, as per the usual routine :P
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Using OSCLI to call xcopy
« Reply #9 on: Feb 3rd, 2010, 1:37pm » |
|
on Feb 3rd, 2010, 11:41am, Simon Mathiassen wrote:I asked because a Code:SYS "GetExitCodeProcess", sei.hProcess% TO exitcode% Within the procedure you kindly provided, unceremoniously causes BB4W to crash. I suspect I'm doing something blatantly stupid |
|
Did you take on board my comment that I'd done the work for you? The code you need, complete with the SYS "GetExitCodeProcess" and ready for you to run with no further modification, can be found here:
http://bb4w.wikispaces.com/Waiting+for+an+external+program+to+terminate
(you need to scroll down past PROCexecuteandwait to the new FNexecuteandwait I added today).
I said that in my last message, but from the tone of your reply I'm not sure you appreciated that I'd actually written the code for you and included it in the Wiki.
As far as your above comment is concerned, it wouldn't be appropriate for me to describe your attempt as "blatantly stupid". However you shouldn't be too surprised at a crash if you use an API the way you think it ought to work rather than the way it is actually documented by Microsoft to work!
A glance at the MSDN documentation shows that GetExitCodeProcess is not defined as your code would imply:
Code:DWORD GetExitCodeProcess(HANDLE hProcess) \\ imagined by SM but instead it's defined as follows:
Code:BOOL GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode) The difference is far from just cosmetic! I expect your next question will be "why did Microsoft design the API that way" to which the answer is I've no idea. There are very many inconsistencies of that kind in the Windows API, no doubt stemming from the long period of time and the large number of different people involved.
Microsoft can't even manage to spell their APIs correctly:
http://blogs.msdn.com/oldnewthing/archive/2008/05/19/8518565.aspx
Richard.
|
| « Last Edit: Feb 3rd, 2010, 1:39pm by admin » |
Logged
|
|
|
|
81RED
Guest
|
 |
Re: Using OSCLI to call xcopy
« Reply #10 on: Feb 3rd, 2010, 3:19pm » |
|
Didn't I tell you I was being stupid? 
And yes, I also totally failed to realize you had updated the wiki with the perfectly working code.
It's all good now, I'm off to strip some Mneumonics and am as usual in your debt.
|
|
Logged
|
|
|
|
|