15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Q: Using Registered Window message for a thread

Tsvilikhovskiy_Jake/ny_mis@npd.com
Thursday, October 03, 1996

Environment: VC++ 4.0  WinNT 3.51 ( build 1057 )

Hello: 

I would like to use registered messages to communicate with
threads in my application --ON_REGISTERED_MESSAGE.
In my app there is a main dispatcher object and some number of threads.

There is batch of data files to be processed.
Each thread is responsible for processing one data file and main
dispatcher needs to pass the filename to be processed to the next
available thread.

What I want to do is :
when each thread becomes available it sends registered message about it,
main distpatcher gets the message and sends another registered message
to the available thread. (I think i can use PARAMs of this message to
pass the actual filename )

Q: How do I use ON_REGISTERED_MESSAGE for threads? Is it possible at
all? CWinThread is not derived from CWindow so it probably does not know
about registered messages- right?


Any help , or possibly code sample is greatly appreciated.

jake

jake_tsvilikhovskiy@npd.com
http://ourworld.compuserve.com/homepages/genat/





Mike Blaszczak -- mikeblas@nwlink.com
Sunday, October 06, 1996

At 15:35 10/3/96 -0400, you wrote:
>Environment: VC++ 4.0  WinNT 3.51 ( build 1057 )

>Q: How do I use ON_REGISTERED_MESSAGE for threads? Is it possible at
>all? CWinThread is not derived from CWindow so it probably does not know
>about registered messages- right?

CWinThread isn't derived from CWnd (there is no CWindow class in MFC)
and therefore can't be used with the window-based thread messages.
There's two ways to solve your problem:

a) Upgrade to MFC 4.2b and use the ON_REGISTERED_THREAD_MESSAGE() macros
b) hack up your own solution--override PreTranslateMessage() in your
CWinThread, for example.

.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |