WordBreakProc


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: WordBreakProc

  1. #1
    Jacques Levy Guest

    WordBreakProc

    Hi Dan,

    I have a problem with the WordBreakProc. I'm trying to create my own word
    wrapping routine but when the controls calls the call back function
    my program crash.

    Any suggestions ?

    thanks

    ----------------------------------------------------------
    'Form1.frm
    Private Sub Form_Load()
    SendMessage Text1.hwnd, EM_SETWORDBREAKPROC, 0, AddressOf
    EditWordBreakProc
    End Sub

    'Module1.bas
    Public Function EditWordBreakProc(ByVal lpch As Long, _
    ByVal ichCurrent As Long, ByVal cch As Long, _
    ByVal code As Long) As Long

    Debug.Print "From Callback EditWordBreakProc"
    On Error GoTo hdlr


    Select Case code
    Case WB_ISDELIMITER
    EditWordBreakProc = 1
    Case WB_LEFT
    EditWordBreakProc = 0
    Case WB_RIGHT
    EditWordBreakProc = 0
    End Select
    Debug.Print EditWordBreakProc

    Exit Function

    hdlr:

    Debug.Print Error
    End Function


    Share on Google+

  2. #2
    Dan Appleman Guest

    Re: WordBreakProc


    "Jacques Levy" <jlevy3@tampabay.rr.com> wrote:
    >Hi Dan,
    >
    >I have a problem with the WordBreakProc. I'm trying to create my own word
    >wrapping routine but when the controls calls the call back function
    >my program crash.
    >
    >Any suggestions ?
    >
    >thanks
    >
    >----------------------------------------------------------
    >'Form1.frm
    >Private Sub Form_Load()
    > SendMessage Text1.hwnd, EM_SETWORDBREAKPROC, 0, AddressOf
    >EditWordBreakProc
    >End Sub
    >
    >'Module1.bas
    >Public Function EditWordBreakProc(ByVal lpch As Long, _
    > ByVal ichCurrent As Long, ByVal cch As Long, _
    > ByVal code As Long) As Long
    >
    > Debug.Print "From Callback EditWordBreakProc"
    > On Error GoTo hdlr
    >
    >
    > Select Case code
    > Case WB_ISDELIMITER
    > EditWordBreakProc = 1
    > Case WB_LEFT
    > EditWordBreakProc = 0
    > Case WB_RIGHT
    > EditWordBreakProc = 0
    > End Select
    > Debug.Print EditWordBreakProc
    >
    > Exit Function
    >
    >hdlr:
    >
    > Debug.Print Error
    >End Function
    >
    >


    Best guess - you don't have a ByVal on the lParam parameter of you SendMessage
    declaration.

    You might want to check out my book "Dan Appleman's Win32 API Puzzle Book
    and Tutorial for
    Visual Basic Programmers". It's designed to help programmers learn to handle
    this type of problem.

    Dan

    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center