Threading and WndProc - basic question

C

Chris Ashley

Hi,

I'm overriding WndProc to process some custom messages like so:


protected override void WndProc(ref Message m)
{


if (m.Msg == ImageFileMsg.MSG_IF_NEW_DATA)
{
ProcessNewDataMessage(m);
}
base.WndProc(ref m);
}


I receive one of these messages every 100ms or so for a few seconds.
This locks up my user interface completely until this is complete which

isn't ideal as each time I get a message I want to update a textbox on
my form.


I'm not sure if my solution is to use threading? I've never used
threads in .NET before, but my understanding is that if I use threading

I'll have to use delegates for my methods which update my form
controls, and these are all translated into messages which go through
WndProc. Is it possible for me to get my ProcessNewDataMessage to work
in a separate thread bearing in mind it's being called from WndProc? Or

will I encounter problems?
 
J

Jon Skeet [C# MVP]

Chris Ashley said:
I'm overriding WndProc to process some custom messages like so:

<snip>

Please see my response in another group where you asked the same
question. Posting the same question in multiple groups leads to
fragmented discussion - it's harder for everyone to see all the answers
together, and it means someone may end up wasting time writing an
answer that is similar to one someone else has posted in another group.
 

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