CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    258

    SendMessage Function

    Actually i am having a list control in that list control i having 2 columns one contaning url value n other for displaying result....
    this i have done through making a class for ping which is derieved from CWinThread class...
    if i run a single class then the result displayed in the list control column is correct but instead if i select more than 1 value then the result displayed is same (both rows contain same value). But the value calculated for ping is correct..problem is in displaying it in listctrl..
    for sending messeage i have used SendMessage function .

    Can anybody help me in this...

    thanks in advance

  2. #2
    Join Date
    Mar 2003
    Location
    The Netherlands
    Posts
    586

    Re: SendMessage Function

    Please post parts of your code containing the problem. Use code tags when posting code.
    Time is fun when you're having flies

  3. #3
    Join Date
    Feb 2002
    Posts
    4,640

    Re: SendMessage Function

    If you're working with threads, you should use PostMessage, not SendMessage. SendMessage executes in the same thread as the thread it was called in (from). MFC objects are not valid across threads. Also, with SendMessage you run the risk of a deadlock situation (the message you are sending depends on something in the function that sends the message).

    Viggy

  4. #4
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: SendMessage Function

    Quote Originally Posted by MrViggy
    SendMessage executes in the same thread as the thread it was called in (from).
    That's true, but the real reason not to use SendMessage for inter-thread communication, is that although SendMessage executes in the thread it was called from, the actual message itself is handled in the thread that created the recipient window.

    Mike

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