BBC BASIC for Windows
« Using OSCLI to call xcopy »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:57pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Using OSCLI to call xcopy  (Read 1215 times)
81RED
Guest
xx 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
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx 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 » User IP Logged

81RED
Guest
xx Re: Using OSCLI to call xcopy
« Reply #10 on: Feb 3rd, 2010, 3:19pm »

Didn't I tell you I was being stupid? smiley

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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls