How can a thread communicate with the main thread?

S

steel

I'm a newer in CF developing, now i'm confused about the multiplethread
programing. I Created a thread to monitor the powerOff keyEvent, and
inform the Mainthread if the event comes. but it does not work when i
use interface invoke.
so i want to know how can the moniter thread communicate with main
thread.
 
P

Paul G. Tobey [eMVP]

There are many ways to communicate (global variables, events, both OS and
window). I don't understand what you're saying was the problem. You have
to Control.Invoke() to call a UI method from a non-UI thread, but that's no
big deal.

Paul T.
 
F

Fabien

Hi,

I suppose you use CF1.0 and Invoke can't have parameters. A good way to
communicate is to use the MessageQueue of Win CE, to import the
functions CreateMsgQueue... there is a lot of examples of importations
of this functions on the Internet.

BR

Fabien Decret
Windows Embedded consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/



Paul G. Tobey [eMVP] a écrit :
 
P

Paul G. Tobey [eMVP]

You can also use properties of the form as 'parameters', as long as only one
thread accesses them at a time, you don't even have to synchronize.

Paul T.

Hi,

I suppose you use CF1.0 and Invoke can't have parameters. A good way to
communicate is to use the MessageQueue of Win CE, to import the
functions CreateMsgQueue... there is a lot of examples of importations
of this functions on the Internet.

BR

Fabien Decret
Windows Embedded consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/



Paul G. Tobey [eMVP] a écrit :
 

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