Data may be passed to a window upon its creation, using the CtlData parameter of the WinCreateWindow() function. The contents of this parameter (a 32-bit pointer) are passed to the target window as a parameter to the WM_CREATE message. The contents may then be extracted from the message parameter and used by the window procedure.
When an application wishes to pass a message between two standard windows that currently exist, whether they are display windows or object windows, either of two methods may be used, depending on whether the desired communication is to be synchronous or asynchronous.
The use of WinPostMsg() is recommended over that of WinSendMsg(), since posted messages are processed in the order in which they arrive in the queue, and the integrity of the user's intention is thus preserved in the order of processing. In addition, synchronous window procedures are invoked and executed without the original window procedure completing its processing and returning control to the message processing loop. Thus the application is prevented from processing additional user interaction, which may lead to violation of the SAA CUA responsiveness guidelines.