Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 67,661 times

Contents

Related Categories

Enum Windows & SendMessage API - SendMessage vs PostMessage

SendMessage vs PostMessage

There’s another similar API which works exactly like SendMessage and that is PostMessage API. Both require same parameters but there’s a slight difference. When a message is sent to a window with SendMessage, the window procedure is called and the calling program (or thread) waits for the message to be processed and replied back, and until then the calling program does not resume its processing. One thing is wrong with this approach however, that is if the program that is busy carrying out long instructions or a program that has been hung and hence no time to respond to the message will in turn hang your program too because your program will be waiting for a reply that may never arrive. The solution to this is to use PostMessage instead of SendMessage. PostMessage on the otherhand returns to the calling program immediately without waiting for the thread to process the message, hence saving your program from hanging. Which of them you have to use depends on your requirement.

Nothing to say anything about me yet.

Comments

  • [HELP] SendMessage API

    Posted by khickyphutz on 27 Jul 2007

    Hi All,

    I wanna ask about the equivalent of SendKey if I will use SendMessage:

    Ex.

        If ctr2 <= length Then
            myKey...

  • Re: cann't get selected text for HTML file/VC/PDF file/SourceInsight File

    Posted by wangdl5201314 on 13 Jul 2007

    you said you can't get selected text from html file..etc ,may be you havn't find the right handle of area which can be edit.

  • Re: [34] Enum Windows &amp; SendMessage API

    Posted by fcescobar on 10 Jul 2007

    Hi,


    About this subject, I´m trying to define the size of an image captured from a generic camera.


    I'm using the SendMessage and SetWindowPos functions with the following instru...

  • Posted by erictioh on 21 Jan 2006

    i'm doing something similar to this thread starter. below is my code:

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    prevWindow =...

  • Posted by DavidChiu on 09 Jun 2005

    [quote][1]Posted by [b]arshad[/b] on 29 Jun 2004 12:18 PM[/1]
    Hi Riaz,
    Could you plz explain me how did u fetch data from MS-Word.
    I can able to get typed text from notepad using sendmessage API.
    ...