I thought SendMessage, when used as a FUNCTION, returns the return value of the associated window procedure.
But, when I did this...
And called it like this...
... It always returned zero, even why my "debug" code told me the function was being set to %TRUE..
So, I thought I'd just call the function this way:
This way returned the value assigned to the FUNCTION.
Using SendMessage, I know the message was getting to the right place; but the return value was always zero.
Using the explicit call works, so I am going to do that with a couple of other private messages I need to process.
But I was wondering if I misunderstand how "sendmessage" works. MSDN enlightens (?) us with,
Comments appreciated...
MCM
But, when I did this...
Code:
FUNCTION TabMainDialogProc (BYVAL hWnd AS LONG, BYVAL wMsg AS LONG, _ BYVAL wParam AS LONG, BYVAL lParam AS LONG) EXPORT AS LONG SELECT CASE wMSg CASE %PWM_QUERY_MARKED ' private message; wparam = claim_seq_no ' returns true or false, claim is marked ' need to search every item of the listview, query its lparam ' until I find the target sequence number ' get the item data from the listview, in which the lparam is its pClaim 'MSGBOX "RECEIVED PWM_QUERY MARKED in TabMain" hWndLV = GetDlgItem (hWndTab(%SUB_TAB_CLAIMLIST),%ID_LISTVIEW_CLAIMS) lvi.iSubItem = 0 lvi.mask = %LVIF_PARAM OR %LVIF_STATE lvi.Statemask = %LVIS_STATEIMAGEMASK ' bits 12-15 K = %FALSE FOR I = 0 TO @pOSVP.RFI.nClaim - 1 lvi.iitem = I J = SendMessage (hWndLV, %LVM_GETITEM, 0&, BYVAL VARPTR (lvi)) pCLaim = lvi.lparam IF @pclaim.claim_seq_no = wparam THEN ' this is the one we want ' working OK now MSGBOX "Found requested claim, seq#=" & STR$(wParam) 'MSGBOX "lvi State of target=" & HEX$(lvi.state, 4) ' returns correwct IF lvi.state = %LV_CHECKBOX_SELECTED THEN ' MSGBOX "CHECKBOX SELECTED, SETTING FUNCTION = TRUE" K = %TRUE END IF EXIT FOR ' FUNCTION = ISTRUE (lvi.state AND %LV_CHECKBOX_SELECTED) = %LV_CHECKBOX_SELECTED END IF NEXT I ' MSGBOX "Exiting funtion with K = " & STR$(K) FUNCTION = K EXIT FUNCTION
Code:
I = SendMessage (GetParent(GetParent(hwnd)), %PWM_QUERY_MARKED, Claim_seq_no, 0&) ' MSGBOX "PWM QUERY FUNCTION RETURNS:" & STR$(I)
So, I thought I'd just call the function this way:
Code:
I = TabMainDialogProc (GetParent(GetParent(hwnd)), %PWM_QUERY_MARKED, Claim_seq_no, 0&)
Using SendMessage, I know the message was getting to the right place; but the return value was always zero.
Using the explicit call works, so I am going to do that with a couple of other private messages I need to process.
But I was wondering if I misunderstand how "sendmessage" works. MSDN enlightens (?) us with,
"Return Values.
The return value specifies the result of the message processing; it depends on the message sent. "
The return value specifies the result of the message processing; it depends on the message sent. "
MCM
Comment