DIALOG POST statement


Place a message in the message queue to be processed at the leisure of the target dialog.


DIALOG POST hDlg, Msg&, wParam&, lParam&


DIALOG POST places the message in the message queue and returns immediately. The message is processed by the dialog at a later time, when it reads the message from the queue.

This behavior is quite different to the DIALOG SEND statement, which forces the control to process the message immediately before returning. Since DIALOG POST is an asynchronous operation, it is not possible to retrieve a return code from the message.

hDlg refers to the target dialog.

Msg& is the message you want to post to the dialog.

wParam& is the first message parameter. lParam& is the second message parameter. The values of wParam& and lParam& are message-dependent. By Default, PowerBASIC passes these parameters BYVAL. If the target dialog is expected to alter the values held by variables passed in the wParam& and lParam& parameters, pass them using VARPTR() or the changes will likely be discarded.

Note that the address of the data must remain valid until after the dialog has processed the message and accessed the data. In this case, using STATIC or GLOBAL variables can be very important or a General Protection Fault (GPF) may occur (that is, if the variables have gone out of scope by the time the message is processed).

An example of posting the addresses of variables to a dialog:

' Sel1& and Sel2& must be STATIC or GLOBAL


DIALOG POST returns immediately after the placing the message in the queue.


To post a custom message to a dialog, use a message value in the range of (%WM_USER + 500) to (%WM_USER + &H07FFF), or use the RegisterWindowMessage API to obtain a unique message value from the operating system. Using messages with a numeric value of less then %WM_USER + 500 may conflict with Windows Common Control messages.

See also

Dynamic Dialog Tools, CB Callback functions, CONTROL POST, CONTROL SEND, DIALOG SEND


' Programmatically post a message to a dialog: