简体   繁体   中英

Is there a convention for Win32 message parameters use?

I read that each message has its own way of using lparam and wparam. I couldn't find any convention about when we pass pointers, who is responsible for memory handling. Should the caller keep track or the message handler should take care of it? I sense that in messaging model it would be hard for caller to manage the memory. Because it won't know when the resource is no longer needed for the message handler. On the other hand that is known as a bad practice in C++ programming. Would you please help me on this?

I conclude it is completely by code designer on how message parameters are managed. I also note that if a message is posted aysnc either the resource should be freed by message handler or somehow sender must be signaled by message handler that the resource passed in lparam or wparam is no longer needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM