Posted by kishua2000 on 22:11:00 12-27-2001
hi forum
i'm trying to write a win api application.
is it true that every thread has an individual queue, and if so how a thread ,that is not the main thread, can read from his own queue?
I know that the main thread uses getMessage() and dispatch Messages to his windowProc function, but what about a thread that is not the main thread?
Posted by -KEN- on 23:00:00 12-27-2001
I've never heard that each thread of execution gets its own window procedure...lemme look. *scans through petzold*
Nope. But I suppose a workaround could be to create a child window for each thread, and give all of those their own procedures, then start the threads on the WM_CREATE of each child...I'm sure you could work something out from that point. (think constantly updating structures)
Hope that helps.
_________________
[ This Message was edited by: -KEN- on 2001-12-27 23:00 ]
Posted by KaGez on 04:16:00 12-28-2001
Why do you use WinAPI? It's just a simple Q, cuz I also did a little WinAPI before, and for me it was the pain in the a**, so I wondered what makes it so good for the ppls who use it
[addsig]
Posted by -KEN- on 16:03:00 12-28-2001
I love it! It's actually fun. It gives you a sense of accomplishment when you've finished a project in it, or you've just figured out how to layout your GUI perfectly. I wrote a tutorial on it and posted it here, go read it
[addsig]
Posted by Peter on 17:47:00 12-28-2001
I promise to read it. Btw, all programming gives you a sense of accomplishment, of course depending on your level (a hardcore asm programmer won't find much affirmation in BASIC programming, I suppose)..
peace out =)
Posted by -KEN- on 00:00:00 12-29-2001
Well true, but think of the differnce between writing a nice spiffy new GUI for your program, as well as the actual program part (whatever it does...buty who cares! it has a spiffy gui! jk)you get a bit more satisfaction then just using a billion printf's.
Of course when I program something in ASM I get a good feeling even if it just displays some text and gets some input :) (hell, even if it doesn't get input...just do something funky and print it out...ASM is wayy too cool )
Posted by kishua2000 on 20:38:00 12-29-2001
i dont want to complicate it (more then what it is allready). i think the best solution is to use GetMessage() in a while loop inside the thread function, without dispatching the message (cuz theres no winproc).
thanks anyway
Posted by -KEN- on 23:58:00 12-29-2001
Oh, it's really not too complicated...
try these lil snippets:
struct MESSAGESTUFF{
int done;
}Params;
.....
void MyThread(PVOID Void)
{
MESSAGESTUFF params;
....
if(params.done==1)
_endthread();
....
}
....
_beginthread(MyThread, 0, &Params);
...
case WM_CLOSE:
Params.done = 1;
.....
I think that actually works out...but then again I'm just trying to remember things I skimmed through in Petzold's.
Posted by KaGez on 02:43:00 12-30-2001
I think GTK+ is good enough for me ... you can create a windows with only 3 or 4 lines
[addsig]