Home > Software engineering >  The lParam peekmessage received data errors?
The lParam peekmessage received data errors?

Time:10-17

Through the PostThreadMessage function to send data to the thread, and then through the PeekMessage function to receive data in the thread,
But the PeekMessage function receives (LPSTR) MSG. LParam sometimes right or wrong, most of the time to receive the
Is the code; (DWORD) MSG. WParam data are correct, how to solve this problem?
Below is the code,
 if (m_pWriteThread - & gt; M_dwWriteThreadID PostThreadMessage (/* and */
PWM_COMMWRITE (WPARAM) dwBytesToWrite, (LPARAM) lpByte))

if (! : : PeekMessage (& amp; MSG, NULL, 0, 0, PM_REMOVE))

CodePudding user response:

You pass the address of the local variable?

CodePudding user response:

I can assure you that your lpByte is too big, too.

CodePudding user response:

reference 1st floor VisualEleven response:
you the address of the local variable is passed?


If yes, can't use local variables? If use public variables of a class is no problem?

CodePudding user response:

reference freezexiao reply: 3/f
Quote: refer to 1st floor VisualEleven response:

You pass the address of the local variable?


If yes, can't use local variables? If use public variables of a class is no problem?

You try not clear ~

CodePudding user response:

refer to the second floor wuchuncai response:
I can assure you that your lpByte is too big, too.

No, oh is no more than 100 bytes,

CodePudding user response:

Before you can Post new buffer, finished processing the message delete buffer
  • Related