I'm working on a applications that is multi-threaded...

My questions is does anyone have an example of one where the application sends information to the thread and the thread processes it in a message loop?

can be only a one thread example ,but using multiple threads would be helpful too...

Looked at Icz. tutorials on the matter, but he doesn't use PostMessageThread (or something like that) which i think i might need

Sliver
Posted on 2002-03-04 17:29:12 by Sliver

I'm working on a applications that is multi-threaded...

My questions is does anyone have an example of one where the application sends information to the thread and the thread processes it in a message loop?

can be only a one thread example ,but using multiple threads would be helpful too...


Hi sliver,
in the listening thread u've to implement such a loop:

int a;
a=GetMessage(&msg,0,0,0);
while(a)
{
if(a==-1)
break;
switch msg.message
{
case msg1:
break;

default:
break;
}
}

When u wanna send a msg to the listening thread u've to know its Thread ID and then u can do this way:

PostThreadMessage(ThreadID, message, wparam, lparam);

Sorry if i didnt code in asm but writing in c was faster 4 me
and its quite late

See ya
NikDH
Posted on 2002-03-04 20:54:03 by NikDH
Hi Sliver,

I had found a couple of thread examples some time ago, not sure if they're exactly what you want:

CatWalk by Ron Thomas.
A multithread animation demo with a dialog box for changing the thread priorities and suspending and resuming threads.

http://www.rbthomas.freeserve.co.uk/CatWalk.zip


Multi Thread by Betrayed
Description: This example shows how to create a thread to handle a task while your program is free to do other things. This example has two buttons, one that counts to 10,000 without the help of a thread and one that has the help of a thread. The one without the help will appear to freeze the program(bad thing in windows), and the one with the thread will allow the window to act as normal because it is handled outside the main program. This program has been tested on Windows 9x and Nt/2000.

http://betrayed.virtualave.net/cgi-bin/load.cgi?asm/thread.zip


And you guys thought no one appreciated your work? ;-)

Cheers,
Kayaker
Posted on 2002-03-04 21:51:14 by Kayaker