• Welcome to PlanetSquires Forums.
 

Which window handle, WM_NOTIFY ?

Started by jermy, August 01, 2020, 12:28:21 PM

Previous topic - Next topic

jermy

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


''
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