Results 1 to 3 of 3

Thread: What is faster?

  1. #1

    Thread Starter
    Lively Member Xcoder's Avatar
    Join Date
    Jan 2004
    Posts
    120

    What is faster?

    Hello all,

    What Im trying to find out is if using SendMessage is faster than using this with a RichTextBox:
    Code:
    RichText1.SelStart = Len(RichText1.Text)
    RichText1.SelText = mystring
    If so, I will appreciate if you could point me to the right Consts and maybe an insight of what to do. Thanks a lot.

  2. #2
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    Use the GetTickCount and SendMessage API calls:
    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    2.   (ByVal hWnd As Long, _
    3.   ByVal wMsg As Long, _
    4.   ByVal wParam As Long, _
    5.   lParam As Any) As Long
    6.  
    7. Private Declare Function GetTickCount Lib "kernel32" () As Long
    8.  
    9. Private Const WM_SETTEXT = &HC
    Populate a long variable with the result of GetTickCount, then subtract this from another result of GetTickCount after you have done your comparison code.

    I've put together this myself out of curiosity, was suprised at the results to be honest..

    -adehh

  3. #3
    Member
    Join Date
    Mar 2004
    Location
    Texas
    Posts
    53

    Re: What is faster?

    Originally posted by Xcoder
    Hello all,

    What Im trying to find out is if using SendMessage is faster than using this with a RichTextBox:
    Code:
    RichText1.SelStart = Len(RichText1.Text)
    RichText1.SelText = mystring
    If so, I will appreciate if you could point me to the right Consts and maybe an insight of what to do. Thanks a lot.
    Have you figured it out yet or still trying? B/C now im kinda courious myself, so I may give it a try. From jstu looking at it, I think that send message would give the command slower, since all the messages are handled, compared to using a function directly.
    Good programming site:
    *http://www.planet-source-code.com

    Our CS Clan Page:
    *http://h2p.inter-gamer.com/index.html

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