different user defined messages to the same thread
madhav@cmc.stph.net
Wednesday, January 15, 1997
hi friends,
Environment: VC++ 4.1, NT3.51
This has to do with handling multiple user defined messages by the same thread.
i have created a thread like this:
CMyThread : public CWinThread
{
------
----
};
i have defined 2 user defined messages like :
#define MY_MSG WM_USER+10
#define YOUR_MSG WM_USER+20
i wrote handlers for them in CMyThread.
i have created an instance of CMyThread like :
m_pMyThread = new CMyThread;
then i used m_pMyThread->CreateThread();
when i tried to post messages MY_MSG and YOUR_MSG to the above thread
it is processing the first message and if other messages are being
received at the same time, it is ignoring them. i tried to catch them
using PreTranslateMessage() i found that it is not receiving these
user defined messages at all while one is being serviced. but when i
put a count which i s incremented as many times as the messages are
received, its giving me correct results. even then iam not getting them
for sequential processing.
Can someone please tell me how to get around this problem?
please send a reply to madhav@sunserv.cmc.stph.net
- Madhav A. V. D.
(madhav@sunserv.cmc.stph.net)
Jim Lawson Williams -- jimlw@mail.ccur.com.au
Friday, January 17, 1997
At 11:34 AM 15/01/97 +0000, cmc.stph.net!madhav (A V D MADHAV) wrote:
>
>hi friends,
>
> Environment: VC++ 4.1, NT3.51
>
>This has to do with handling multiple user defined messages by the same thread.
>i have created a thread like this:
>
> CMyThread : public CWinThread
> {
> ------
> ----
> };
>
> i have defined 2 user defined messages like :
> #define MY_MSG WM_USER+10
> #define YOUR_MSG WM_USER+20
>
G'day!
You have at least this problem:
>From commctrl.h - - Interface for the Windows Common Controls --
#define SB_GETRECT (WM_USER+10)
#define TBM_SETSEL (WM_USER+10)
#define TBM_SETTICFREQ (WM_USER+20)
>From "Books Online" --
The WM_USER constant is used by applications to help define private messages.
WM_USER
Remarks
The WM_USER constant is used to distinguish between message values that are reserved for use by Windows and values that can be used by an application to send messages within a private window class. There are five ranges of message numbers:
Range Meaning
0 through WM_USER - 1 Messages reserved for use by Windows.
WM_USER through 0x7FFF Integer messages for use by private window classes.
0x8000 through 0xBFFF Messages reserved for future use by Windows.
0xC000 through 0xFFFF String messages for use by applications.
Greater than 0xFFFF Reserved by Windows for future use.
Regards,
Jim LW
>From the BBC's "Barchester Chronicles":
"I know that ultimately we are not supposed to understand.
But I also know that we must try."
-- the Reverend Septimus Harding, crypt-analyst, clog-dancer, C++ programmer
| Вернуться в корень Архива
|