Strange thing - in so many applications over the years, I have used a Button and SendMessage to %WM_HELP in order to support both Button and pressing F1 for help/Info. Never a problem. Last night I happened to type "PostMessage" instead of "SendMessage" - and it failed! Seems like PostMessage disappears along the line, while SendMessage survives. Tried some variations, like PostMessage to %WM_USER and then it works like expected. It's only when I target %WM_HELP PostMessage fails. Same with DIALOG POST/SEND, of course.
And yes, I know that lParam can/should point to a HELPINFO structure - also tested - no difference and not really needed. Just wanted to tell, in case someone else encounter similar problem.
Tiny code shows and explains better:
'
And yes, I know that lParam can/should point to a HELPINFO structure - also tested - no difference and not really needed. Just wanted to tell, in case someone else encounter similar problem.

'
Code:
#COMPILE EXE #DIM ALL #INCLUDE "WIN32API.INC" '==================================================================== FUNCTION PBMAIN () AS LONG LOCAL hDlg AS DWORD DIALOG NEW 0, "Press F1 - press Buttons",,, 136, 26, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg '------------------------------------------------------------------ CONTROL ADD BUTTON, hDlg, %IDOK, "SendMessage", 5, 5, 60, 14 CONTROL ADD BUTTON, hDlg, %IDHELP, "PostMessage", 70, 5, 60, 14 '------------------------------------------------------------------ DIALOG SHOW MODAL hDlg CALL DlgProc END FUNCTION '==================================================================== CALLBACK FUNCTION DlgProc() AS LONG SELECT CASE AS LONG CB.MSG CASE %WM_COMMAND SELECT CASE AS LONG CB.CTL CASE %IDOK IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN 'DIALOG SEND CB.HNDL, %WM_HELP, 0, lpHELPINFO ' same result, of course.. SendMessage CB.HNDL, %WM_HELP, 0, 0 ' works END IF CASE %IDHELP IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN 'DIALOG POST CB.HNDL, %WM_HELP, 0, lpHELPINFO ' same result, of course.. PostMessage CB.HNDL, %WM_HELP, 0, 0 ' fails END IF END SELECT CASE %WM_HELP ' F1 triggers this one MSGBOX "F1 works" + $CR + _ "SendMessage from button works" + $CR + _ "PostMessage from button fails", _ %MB_ICONINFORMATION, "%WM_HELP test" END SELECT END FUNCTION '
Comment