Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:45:56+00:00 2026-05-30T03:45:56+00:00

I don’t quite understand how GetWindowText can work for a window on the same

  • 0

I don’t quite understand how GetWindowText can work for a window on the same thread as the caller. If GetWindowText blocks until the message is processed, how can the thread call DispatchMessage? It’s been blocked inside GetWindowText. Does this mean that GetWindowText must always be called from a separate thread from the one operating the message loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:45:57+00:00Added an answer on May 30, 2026 at 3:45 am

    GetWindowText is just a thin wrapper for SendMessage(WM_GETTEXT).

    Messages sent to a window are always processed in the thread which created the window (windows have “thread affinity”). Sent messages do not go through DispatchMessage, rather GetMessage (or PeekMessage or MsgWaitForMultipleObjects) will call the window procedure directly, for messages sent from another thread. If the message is sent from the same thread, SendMessage will call the window procedure.


    The SendMessage documentation says:

    The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

    And the GetMessage documentation says:

    Retrieves a message from the calling thread’s message queue. The function dispatches incoming sent messages until a posted message is available for retrieval.

    From the PeekMessage docs:

    Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).


    The behavior of sending messages has previously been highlighted on Raymond Chen’s excellent blog, The Old New Thing, which all Win32 developers ought to subscribe to:

    If you use any of the above send-type functions to send a message to a window that belongs to the sending thread, the call is made synchronously.

    • http://blogs.msdn.com/b/oldnewthing/archive/2004/11/19/266664.aspx

    Recall that SendMessage delivers the message directly to the window procedure; the message pump never sees it.

    • http://blogs.msdn.com/b/oldnewthing/archive/2008/12/23/9248851.aspx

    And of course, there are related questions found here on StackOverflow:

    • SendMessage vs PostMessage + WaitForSingleObject
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't understand why this code doesn't work: function Messages(type,text) { console.log(In function Message);
Don't quite understand determinism in the context of concurrency and parallelism in Haskell. Some
I don't understand where the extra bits are coming from in this article about
Don't think that I'm mad, I understand how php works! That being said. I
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't know a whole lot about streams. Why does the first version work using
I don’t think I’ve grokked currying yet. I understand what it does, and how
Don't these two mean the same thing, first get the value and then increment?
don't understand: in my controller: @json = User.all.to_gmaps4rails do |user| \Title\: \#{user.email}\ end in
Don't understand, if Data.Map is and [] is. I found this out while wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.