我在主线程中创建了一个子线程,然后子线程发送一个Msg给主线程,主线程中有一个小心响应函数。
我想请问大家一下,当子线程发送消息以后,
如果主线程当前是Idle等待状态,应当立刻执行消息响应函数
如果主线程当前正在执行某个函数,则在执行完该函数以后,是否立即执行子线程的消息响应???

解决方案 »

  1.   

    传送系统消息函数,发送到WndPro()h函数中!!!!
      

  2.   

    那么为什么我用在消息函数中调用的GetCurrentThreadId()时,取到的是主线程的Id呢!!!
      

  3.   

    If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message.-----
    同时,我的理解是错的,GetCurrentThreadId()返回的应该是主线程的ID,向你道歉!!!
      

  4.   

    在消息队列,等待处理!
    SendMessage
      

  5.   

    这个问题,mahatma回答的最完整。
    我很想看那片文档
      

  6.   

    楼上的牛哥,这段论述在哪里找得的。我想看看:)
    --------------------  我想也许是在MSDN里的    不知是不是
      

  7.   

    如果是本线程send的消息,立即处理,否则排在消息队列等待处理