Board index » delphi » Error 31???

Error 31???

I'm getting an error 31 from an IO routine.  Normally I wouldn't ask this
sort of dumb question, but....

What is error 31?  It happens when I try to open a COM port on a win95
machine.

On a more general note...  Where are these things listed.   They were easy
to find under TP 3.01a :-)  but appear to be well hidden now.

Please reply by email.

Thanks

Steve

 

Re:Error 31???


On Thu, 3 Sep 1998 14:43:07 +0800, "Steve Hodges"

Quote
<ste...@excalibur.com.au> wrote:
>I'm getting an error 31 from an IO routine.  Normally I wouldn't ask this
>sort of dumb question, but....

>What is error 31?  It happens when I try to open a COM port on a win95
>machine.

Well, it is not very helpful. It is a WIN32 error code
ERROR_GEN_FAILURE

meaning

"A device attached to the system is not functioning."

which is not really surprising.

Quote
>On a more general note...  Where are these things listed.   They were easy
>to find under TP 3.01a :-)  but appear to be well hidden now.

The runtime-errors can be found under run-time errors (as
distinguished from 'runtime errors':) in the Delphi 3 help. Don't know
for other versions. (It said that error 31 is not a Delphi but a
Windows error). The win32 error messages are also 'somewhere'. I found
#31 by looking in the winerror.h file.

hth

David

Quote
>Please reply by email.

>Thanks

>Steve

------------------
David A. Schweizer

iec ProGAMMA, The Netherlands
d.a.schweizer[OK, i don't want any more spam]gamma.rug.nl
guess where the '@' goes ?

Re:Error 31???


Steve Hodges heeft geschreven in bericht ...
|I'm getting an error 31 from an IO routine.  Normally I wouldn't ask this
|sort of dumb question, but....
|
|What is error 31?  It happens when I try to open a COM port on a win95
|machine.

The "normal" way to open a comport by code under Win32 is through
CreateFile(), which returns an error code if the port cannot be opened for
some reason. ( non-existent port, port in use by another app,...)
Createfile()  does _not_ throw an exception however, so I guess you're
doing something odd here. A code snippet might help.

|
|On a more general note...  Where are these things listed.   They were easy
|to find under TP 3.01a :-)  but appear to be well hidden now.
|

Open WIN32-Help. search for "error codes" . They're all there
For specific Delphi-error codes search for "I/O-error" in D3-Help.
Always use try/except blocks when doing I/O. When the exception is trapped,
do something like ShowMessage( SysErrorMessage( GetLastError) ), which will
at least show a descriptive message, instead of "Error 927"

Regards,
Dirk Claessens
______________________________________________
dirk.claessens@village.#NOSPAM#uunet.be
dirk.claessens.dc@belgium.#NOSPAM#agfa.com
remove #NOSPAM#  from mailheader
______________________________________________

Other Threads