(MSDN中的remark)If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage, SendNotifyMessage, and SendMessageCallback), its message parameters can not include pointers. Otherwise, the operation will fail. The functions will return before the receiving thread has had a chance to process the message and the sender will free the memory before it is used。
自己在程序中使用了一个postmessage向父窗口发送自定义消息,带一个指针参数,结果在父窗口的函数中取出参数之后发现内容被改动了!O.M.G.!调了一上午,能想到的地方都测试了,还是出错,忽然想到前两天也使用自定义消息传递过指针为什么那一次就行呢?找出程序来检查了一遍,发现那个使用的是sendmessage,也就是发送同步消息,疑问:除了一个放入消息队列,直接返回(post),一个等待知道处理完成返回(send)外,还有什么区别?查了一个MSDN发现,还真不是那么简单的一回事,又到网上一搜,发现原来如此,把post改为send之后果然,指针参数就正常了。