OpenNETCF -serial library - GUI events stopped firing

A

anbeyon

Dear all,

I'm hoping you might be able to help me?

I recently added some code to an application I'm developing to handle
serial port commands. I used the OpenNETCF library to do this.

The comms is now working but it seems to have had an odd side effect.

Somtimes the standard windows GUI events handling system seems to stop
working. The comms associated events still work though. It's almost
as though the GUI has stopped posting messages.

The consequence of this is that the application appears to be locked up
as mouse click events etc... are not processed.

Does any one have any ideas where I can start to look.

Anbeyon
 
P

Paul G. Tobey [eMVP]

It sounds like you're doing the serial I/O from the user interface thread of
the application. That will interfere with handling (not posting), of
messages. If you make sure not to do that, there should not be a problem.
As for where to look, anywhere that you do some serial process as a result
of some user interface event is a suspicious location...

Paul T.
 
G

Guest

The serial event handlers are in a separate thread context, so any calls to
UI elements must go through Control.Invoke.

-Chris
 
A

anbeyon

Thanks Paul/Chris

Paul is correct I do have eveything in the same thread right now - I
will try running the comms in a separate thread.

Chris sorry I'm not quite sure what you mean - could you explain a
liitle more for me please. I don't think I am accessing any UI controls
from the comms events.

Thanks

Anbeyon
 
C

Chris Tacke, eMVP

There is an event that fires when data is received (depends on which
OpenNETCF library ou're using as to what the event is). This event is in a
separate thread context (the serial class creates a thread for Rx). If in
that handler (or method called by it) you affect a UI element (getting or
setting text, changing colors, etc.) then you're going to get a hang. To
call a UI element you _must_ use Control.Invoke. Search the web for
examples on it's use.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
A

anbeyon

Thanks Chris for the very clear description - I will check but think I
am OK with this.

Anbeyon
 

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

Top