CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2001
    Posts
    44

    SendMessage to RichTextBox

    Please tell me why the following code works on Win2K Server but not in Win9x.

    I use the same version of Richtx32.ocx, riched32.dll and riched20.dll.


    public Type CHARFORMAT2
    .....
    .....
    End Type

    dim charf as CHARFORMAT2
    ......
    charf.cbSize = LenB(charf)
    charf.dwMask = CFM_BACKCOLOR
    charf.crBackColor = nColor

    ret = SendMessageLong(rtfText1.hwnd, EM_SETCHARFORMAT, SCF_SELECTION, VarPtr(charf))
    .....





  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: SendMessage to RichTextBox

    Is it a typo or it exists a SendMessageLong function or you have subclassed SendMessage.
    Try with:
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Apr 2001
    Posts
    44

    Re: SendMessage to RichTextBox

    Thank you for your reply.
    I declared function as :


    public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, byval lParam as Long) as Long







  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: SendMessage to RichTextBox

    Matter is I found no information about SendMessageLong...

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Apr 2001
    Posts
    44

    Re: SendMessage to RichTextBox

    Thanks.
    But that code runs on Win2K


  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: SendMessage to RichTextBox

    Yes, as you provided the alias "SendmessageA". Have a try declaring it like I posted (even if I am afraid this is not the matter: some differences may exist on parameters type in win2K and win9x) .

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured