Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11827 > unrolled thread
| Started by | Jafar <jafar@marti-orbak.nl> |
|---|---|
| First post | 2018-08-20 01:03 -0700 |
| Last post | 2018-08-21 12:30 +0200 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
How do I correctly handle error codes returned by App:Run in Visual Objects? Jafar <jafar@marti-orbak.nl> - 2018-08-20 01:03 -0700
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? jafar@marti-orbak.nl - 2018-08-20 01:08 -0700
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-08-20 14:34 +0200
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? jafar@marti-orbak.nl - 2018-08-20 07:27 -0700
Re: How do I correctly handle error codes returned by App:Run inVisual Objects? "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-08-20 20:21 +0200
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-08-20 23:27 +0200
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? jafar@marti-orbak.nl - 2018-08-21 00:43 -0700
Re: How do I correctly handle error codes returned by App:Run in Visual Objects? D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-08-21 12:30 +0200
| From | Jafar <jafar@marti-orbak.nl> |
|---|---|
| Date | 2018-08-20 01:03 -0700 |
| Subject | How do I correctly handle error codes returned by App:Run in Visual Objects? |
| Message-ID | <2d545562-32ac-44f6-b10b-7c8f6b387548@googlegroups.com> |
I was just reading through the Visual Objects documentation about error codes in App:Run, but I can't really make sense how the error codes correspond to windows errors. For example the VO documentation says 0 is an out of memory error: '(e.g., 0 means "out of memory," 2 means "file not found," etc.);' However, according to this Microsoft page 0 corresponds to a successful completion: https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--0-499- '0x0 The operation completed successfully.' Which should I use to determine the meaning of these error codes? The VO documentation or the Microsoft page?
[toc] | [next] | [standalone]
| From | jafar@marti-orbak.nl |
|---|---|
| Date | 2018-08-20 01:08 -0700 |
| Message-ID | <82fea77e-265c-437b-9adc-3a77c6381c2a@googlegroups.com> |
| In reply to | #11827 |
Op maandag 20 augustus 2018 10:03:39 UTC+2 schreef Jafar: > I was just reading through the Visual Objects documentation about error codes in App:Run, but I can't really make sense how the error codes correspond to windows errors. > > For example the VO documentation says 0 is an out of memory error: > > '(e.g., 0 means "out of memory," 2 means "file not found," etc.);' > > However, according to this Microsoft page 0 corresponds to a successful completion: > https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--0-499- > > > '0x0 > The operation completed successfully.' > > Which should I use to determine the meaning of these error codes? The VO documentation or the Microsoft page? To be a bit more clear, here is the entire documentation in VO about what App:Run could return: Returns 'A long integer value indicating successful completion or an error. The numbers 0-32 correspond to a specific error type in Windows (e.g., 0 means "out of memory," 2 means "file not found," etc.); any other number indicates successful completion.' Why is the VO documentation say 0 is out of memory while the Microsoft page says 0 is a successful completion? How do I know I did my error handling correctly?
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2018-08-20 14:34 +0200 |
| Message-ID | <ftvqriFnuouU1@mid.individual.net> |
| In reply to | #11827 |
Hi Jafar, if you have a non too old VO version, you should have also the SDK sources to the GUI classes. And if you look at the code in the App:Run() method, you will find exactly one line of code: RETURN WinExec(String2Psz(sCommand), SW_SHOWNORMAL) So to understand what error will be returned, look at the WinExec function: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase- winexec And there is effectively stated: 0 The system is out of memory or resources. So the VO documentation is correct. Wolfgang Jafar wrote: > I was just reading through the Visual Objects documentation about > error codes in App:Run, but I can't really make sense how the error > codes correspond to windows errors. > > For example the VO documentation says 0 is an out of memory error: > > '(e.g., 0 means "out of memory," 2 means "file not found," etc.);' > > However, according to this Microsoft page 0 corresponds to a > successful completion: > https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-co > des--0-499- > > > '0x0 > The operation completed successfully.' > > Which should I use to determine the meaning of these error codes? The > VO documentation or the Microsoft page? --
[toc] | [prev] | [next] | [standalone]
| From | jafar@marti-orbak.nl |
|---|---|
| Date | 2018-08-20 07:27 -0700 |
| Message-ID | <1bdb3783-b061-4305-b28f-4b52aa2b4432@googlegroups.com> |
| In reply to | #11829 |
Op maandag 20 augustus 2018 14:35:00 UTC+2 schreef Wolfgang Riedmann: > Hi Jafar, > > if you have a non too old VO version, you should have also the SDK > sources to the GUI classes. > > And if you look at the code in the App:Run() method, you will find > exactly one line of code: > > RETURN WinExec(String2Psz(sCommand), SW_SHOWNORMAL) > > So to understand what error will be returned, look at the WinExec > function: > > https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase- > winexec > > And there is effectively stated: > > 0 The system is out of memory or resources. > > So the VO documentation is correct. > > Wolfgang > > > Jafar wrote: > > > I was just reading through the Visual Objects documentation about > > error codes in App:Run, but I can't really make sense how the error > > codes correspond to windows errors. > > > > For example the VO documentation says 0 is an out of memory error: > > > > '(e.g., 0 means "out of memory," 2 means "file not found," etc.);' > > > > However, according to this Microsoft page 0 corresponds to a > > successful completion: > > https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-co > > des--0-499- > > > > > > '0x0 > > The operation completed successfully.' > > > > Which should I use to determine the meaning of these error codes? The > > VO documentation or the Microsoft page? > > > > -- Hello Wolfgang, Thanks for the response. My VO is 2.8 SP4b. I don't understand what you mean by VO SDK. Are you by any chance referring to the error constants in WinError module located Win32API library, because that also uses different set of codes (this is also the case in the sdk version): DEFINE ERROR_SUCCESS := 0L DEFINE NO_ERROR := 0L DEFINE ERROR_NOT_ENOUGH_MEMORY := 8L define ERROR_OUTOFMEMORY := 14L define ERROR_NOT_ENOUGH_SERVER_MEMORY := 1130L Additionally, according to the VO docs, a number above 32 is a successful result, while according to the link you directed to me a number above 31 is successful: 'If the function succeeds, the return value is greater than 31.' In VO when something succeeds I get a 33 code, so I assume 32 must either be a typo or something else, but this doesn't seem to be clearly documented. Thanks again for the response. Jafar
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2018-08-20 20:21 +0200 |
| Subject | Re: How do I correctly handle error codes returned by App:Run inVisual Objects? |
| Message-ID | <fu0f4pFsom7U1@mid.individual.net> |
| In reply to | #11830 |
Hi Jafar, > My VO is 2.8 SP4b. I don't understand what you mean by VO SDK. if you look in your VO folder, you will find a subfolder Sdk and it contains the sources to all VO class libraries, but not to the runtime (AFAIK written in C++). > Additionally, according to the VO docs, a number above 32 is a > successful result, while according to the link you directed to me a > number above 31 is successful: 'If the function succeeds, the return > value is greater than 31.' > > In VO when something succeeds I get a 33 code, so I assume 32 must > either be a typo or something else, but this doesn't seem to be > clearly documented. since the VO method returns directly what the Windows function returns, the Windows documentation matters. It could be that the return values were changed after the VO documentation was written. So the best bet will be to read the Microsoft documentation. Wolfgang --
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2018-08-20 23:27 +0200 |
| Message-ID | <ebcmndpghqdels0gunkolfopmih3qt1dgg@4ax.com> |
| In reply to | #11827 |
Replying on message of Mon, 20 Aug 2018 01:03:38 -0700 (PDT) from
Jafar:
Hello Jafar
>I was just reading through the Visual Objects documentation about error codes in App:Run, but I can't really make sense how the error codes correspond to windows errors.
I think these are equal to ShellExecute codes and this site describes
them:
http://www.oehive.org/node/528
Also this may help:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
For ShellExecute I sometimes program like this:
LOCAL hReturn AS PTR
LOCAL nRet AS LONGINT
hReturn:=ShellExecute(NULL, String2Psz("open"),
String2Psz("somexe.exe"), String2Psz(cParms),
String2Psz(cConvertPath), SW_SHOW)
nRet:=INT(@hReturn)
IF nRet<=32
IF nRet=2
ErrorBox{,Vt(MSG_FILENOTFOUND,"File not found")+" :
"+cConvertPath+"convert.exe"}:Show()
ELSE
ErrorBox{,Vt(MSG_ERROR,"Error:")+" "+NTrim(nRet)}:Show()
ENDIF
ENDIF
Dick
[toc] | [prev] | [next] | [standalone]
| From | jafar@marti-orbak.nl |
|---|---|
| Date | 2018-08-21 00:43 -0700 |
| Message-ID | <7d909d13-7d2f-4e68-8d72-658cc5fa8e11@googlegroups.com> |
| In reply to | #11833 |
Op maandag 20 augustus 2018 23:27:42 UTC+2 schreef D.J.W. van Kooten:
> Replying on message of Mon, 20 Aug 2018 01:03:38 -0700 (PDT) from
> Jafar:
>
>
> Hello Jafar
>
> >I was just reading through the Visual Objects documentation about error codes in App:Run, but I can't really make sense how the error codes correspond to windows errors.
>
>
> I think these are equal to ShellExecute codes and this site describes
> them:
>
> http://www.oehive.org/node/528
>
> Also this may help:
>
> https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
>
> For ShellExecute I sometimes program like this:
>
> LOCAL hReturn AS PTR
> LOCAL nRet AS LONGINT
>
>
> hReturn:=ShellExecute(NULL, String2Psz("open"),
> String2Psz("somexe.exe"), String2Psz(cParms),
> String2Psz(cConvertPath), SW_SHOW)
> nRet:=INT(@hReturn)
> IF nRet<=32
> IF nRet=2
> ErrorBox{,Vt(MSG_FILENOTFOUND,"File not found")+" :
> "+cConvertPath+"convert.exe"}:Show()
> ELSE
> ErrorBox{,Vt(MSG_ERROR,"Error:")+" "+NTrim(nRet)}:Show()
> ENDIF
> ENDIF
>
>
> Dick
Thanks Dick,
That is more like it.
Do you by any chance also know of any constants in VO I could use?
If not I will just create a custom mapping myself.
Thanks again for the response.
Jafar
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2018-08-21 12:30 +0200 |
| Message-ID | <m5qnnd9chgaob857fuqbmiigs5psslokpb@4ax.com> |
| In reply to | #11837 |
Replying on message of Tue, 21 Aug 2018 00:43:57 -0700 (PDT) from jafar@marti-orbak.nl: Hello Jafar, > >Do you by any chance also know of any constants in VO I could use? >If not I will just create a custom mapping myself. > What Wolfgang meant: if you open c:\cavo28 youi will see a directory called SDK. All the AEF's are the source version of the built in VO libraries. If for example you open Win32 API Library SDK (best is with Paul Piko's VOPP) you will find a mef called WinError. From VOPP select Open all source and you'll find 1292 lines with constants. Not sure if searching the constants takes less time than writing 32 lines of IF/CASE lines against the error code ;). Dick
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web