Please add your comments and suggestions as a Reply to this thread.

PB/WIN - CONTROL SEND statement
Purpose

PB/WIN - CONTROL SEND statement
Purpose
Send a message to a control.
SyntaxCONTROL SEND hDlg, id&, Msg&, wParam&, lParam& [TO lResult&]
RemarkshDlg refers to the dialog that owns the control.
id& is the unique control identifier as assigned to the control with a CONTROL ADD statement.
Msg& is the message you want to send the control.
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 control is expected to return or alter the values passed in the wParam& and lParam& parameters, pass them using VARPTR or the return values will be discarded. For example:
CONTROL SEND does not return from execution until the control's callback has processed the message. This synchronous behavior is quite different to the behavior of CONTROL POST, which simply places the message in the control's message queue (for processing at a later time) and immediately returns. On this basis, CONTROL SEND can receive a return value from the message, but CONTROL POST cannot.
TO
The return value from the message can optionally be assigned to lResult&.
If CONTROL SEND sends a message that arrives back in the same callback as the message originated, care should be exercised to ensure that critical STATIC and GLOBAL variables are not unexpectedly altered by the second message processing code in the callback. This is known as re-entrant code design.
Restrictionsid& is the unique control identifier as assigned to the control with a CONTROL ADD statement.
Msg& is the message you want to send the control.
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 control is expected to return or alter the values passed in the wParam& and lParam& parameters, pass them using VARPTR or the return values will be discarded. For example:
Code:
' Retrieve an Edit control's Current Selection CONTROL SEND CB.HNDL, %ID_EDIT1, %EM_GETSEL, VARPTR(Sel1&), VARPTR(Sel2&)
TO
The return value from the message can optionally be assigned to lResult&.
If CONTROL SEND sends a message that arrives back in the same callback as the message originated, care should be exercised to ensure that critical STATIC and GLOBAL variables are not unexpectedly altered by the second message processing code in the callback. This is known as re-entrant code design.
To send 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 AlsoReferencesCONTROL ADD:
Examples CONTROL ADD "custom-control" statement
CONTROL ADD BUTTON statement
CONTROL ADD CHECK3STATE statement
CONTROL ADD CHECKBOX statement
CONTROL ADD COMBOBOX statement
CONTROL ADD FRAME statement
CONTROL ADD GRAPHIC statement
CONTROL ADD IMAGE statement
CONTROL ADD IMAGEX statement
CONTROL ADD IMGBUTTON statement
CONTROL ADD IMGBUTTONX statement
CONTROL ADD LABEL statement
CONTROL ADD LINE statement
CONTROL ADD LISTBOX statement
CONTROL ADD OPTION statement
CONTROL ADD SCROLLBAR statement
CONTROL ADD TEXTBOX statement
CONTROL ADD BUTTON statement
CONTROL ADD CHECK3STATE statement
CONTROL ADD CHECKBOX statement
CONTROL ADD COMBOBOX statement
CONTROL ADD FRAME statement
CONTROL ADD GRAPHIC statement
CONTROL ADD IMAGE statement
CONTROL ADD IMAGEX statement
CONTROL ADD IMGBUTTON statement
CONTROL ADD IMGBUTTONX statement
CONTROL ADD LABEL statement
CONTROL ADD LINE statement
CONTROL ADD LISTBOX statement
CONTROL ADD OPTION statement
CONTROL ADD SCROLLBAR statement
CONTROL ADD TEXTBOX statement
' Programmatically click a button:
CONTROL SEND hDlg, %ID_BTN1, %BM_CLICK, 0, 0
CONTROL SEND hDlg, %ID_BTN1, %BM_CLICK, 0, 0
Comment