PlanetSquires Forums

Support Forums => WinFBE - Code Editor and Visual Designer => Topic started by: jermy on August 01, 2020, 12:28:21 PM

Title: Which window handle, WM_NOTIFY ?
Post by: jermy on August 01, 2020, 12:28:21 PM
Dear people,

how can I determine which window handle the WM_NOTIFY comes from ?.
If I want to use more than one Rich Edit control, I can't separate them to make them respond differently

Code: [Select]
''
Function frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
 SendMessage (frmMain.RichEdit1.hWindow, EM_SETEVENTMASK,0, ENM_SCROLLEVENTS or ENM_SCROLL or ENM_MOUSEEVENTS or ENM_KEYEVENTS)
    Function = 0
End Function

''
''
Function frmMain_AllEvents( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT

 dim as LPNMHDR pnm
 dim as MSGFILTER ptr pmf

   select case E.Message
     
          Case WM_NOTIFY

               pnm = cast(LPNMHDR,E.lParam)

                select case pnm->code
                    case EN_MSGFILTER
                           pmf = cast(MSGFILTER ptr, pnm)

                        select case   pmf->msg
                             case WM_MOUSEWHEEL
                              Print "WM_MOUSEWHEEL" 
                             Case WM_VSCROLL
                              ? "WM_VSCROLL"
                             case WM_HSCROLL
                              ? "WM_HSCROLL" 
                             case WM_MOUSEMOVE
                             
                             case else
                             ' ? MessageName(pmf->msg)
                        end select
 
                end select   
                             case else
                                 
                ' ? MessageName(e.Message)
   end select
 
    Function = 0
End Function

Thanks in advance for your help

code changed so the example works
Title: Re: Which window handle, WM_NOTIFY ?
Post by: Josť Roca on August 01, 2020, 12:56:58 PM
pnm->hwndFrom

See: https://docs.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-nmhdr