OpenNetCF 1.4, HP iPaq rx1950/rx1955 and serialport.close problem

M

Markus Humm

Hello,

we've developped a application for PDAs which uses the RS232 port and
works fine on some models (with WM 2003 and WM 5.0). But with the new
rx1950 from HP we've got some a ploblem but would like especially this
model.

We can open the port and communicate well enough, but closing the port
throws this exception:

Der Thread '<Kein Name>' (0x24ad54) hat mit Code 0 (0x0) geendet.

and then the application hangs somehow so that you don't see it anymore
and even the settings/memory/open apps. doesn't show it. Launching it
again also fails until you do a soft reset of the device. If you debug
from VS2003 even the debugger doesn't notices that the app. is closed
(thinks it's running still).

The rx1950 runs WM 5.0

What is wron with our code?

Here the opening part:

Try
s_string = "COM1:"
SerialPort.PortName = s_string
SerialPort.RThreshold = 1

SerialPort.DTREnable = True
SerialPort.RTSEnable = True
SerialPort.Settings.BaudRate =
OpenNETCF.IO.Serial.BaudRates.CBR_9600
SerialPort.Settings.ByteSize = 8
SerialPort.Settings.Parity = OpenNETCF.IO.Serial.Parity.none
SerialPort.Settings.StopBits = OpenNETCF.IO.Serial.StopBits.one
SerialPort.InputLen = 0

If SerialPort.Open() = False Then
SerialPort.Close()
SerialPort.Dispose()
com_aktiviert = False
Else
echo_buffer(0) = CByte(Asc("A"))
SerialPort.Output = echo_buffer

Timer_RS485_Echo.Enabled = True
Debuggerdatei_Beschreiben("timer_rs485 gestartet")
End If

Catch ex As Exception
MessageBox.Show(ex.Message)
SerialPort.Close()
SerialPort.Dispose()
Finally
End Try

Closing is this:
If SerialPort.IsOpen = True Then
SerialPort.Close() <-- here we get the exception
SerialPort.Dispose()
End If
Application.Exit()
Me.Close()

Greetings

Markus
 
M

Markus Humm

Hello,

found that I forgot to translate the message of the exception:

Der Thread '<Kein Name>' (0x24ad54) hat mit Code 0 (0x0) geendet.

The english translation is:

The thread '<no name>' (0x24ad54) has ended with Code 0 (0x0).

Another thing we found: somehow it seems related to GEWS.EXE which is
responsible for managing nearly all graphical controls (like buttons
etc.) and for handling of user input.

Maybe that one crashes? But why/how? And how to solve? On another PDA
with WM 5.0 it doesn't occur!

Greetings

Markus
 
P

Paul G. Tobey [eMVP]

I don't read that as an exception at all. It simply indicates that the
thread, whichever thread that happens to be (something created using
CreateThread), is exiting and returning 0 when it does. Maybe a thread is
finding a port unopenable or something, but it doesn't appear to be to be an
unintentional exit at all!

Paul T.
 
M

Markus Humm

Paul said:
I don't read that as an exception at all. It simply indicates that the
thread, whichever thread that happens to be (something created using
CreateThread), is exiting and returning 0 when it does. Maybe a thread is
finding a port unopenable or something, but it doesn't appear to be to be an
unintentional exit at all!

Hm, other persons seem to have gotten in that (or similar) situations as
well. It requires a soft reset. It doesn't happen at opening the port
but at closeing. Why should that fail? How to prevent this?
Just Try / Catch around it and ignore it? Or why that necessary reboot?

Greetings

Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top