Results 1 to 4 of 4

Thread: SendMessageTimeout

  1. #1

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Unhappy

    Uhm, what about the SendMessageTimeout function?

    I tried to figure out how it works, but I couldn't found anything... I tried this code, but it seems to have wrong parameters or something...
    Code:
    Function HungUp(iProcess As ProcessEntry32) As Boolean
        Dim Temp As Long
        Dim Process As Long
    
        Process = OpenProcess(PROCESS_TERMINATE, 0, iProcess.ProcessID)
    
        Temp = SendMessageTimeout(Process, WM_NULL, 0, 0,_
        SMTO_NORMAL Or SMTO_ABORTIFHUNG Or SMTO_BLOCK, 1000, Temp)
        
        If Temp = 0 Then
            HungUp = True
        End If
    End Function
    I think WM_NULL is not that good, but I have no idea what to use else... anyone knows?

    Thanks in advance!

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    OK, yer big mistake is that where the procedure expects an hWnd you've given it a process handle.(first parameter)

    the first four params are the parameters you normaly use for sendmessage, the fith is reserved for flags, you can probably get away with setting it to 0, the last parameter is how long the function should waid before it returns, if the message is not processed after this time the function returns 0.

    WM_NULL always returns Zero. I can't offhand think of any message that will never return 0. but there must be a message you're trying to get to work, use that to test it.

  3. #3

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Well, I tried it with the hWnd, didn't work so I tried the process

    However, thx for your time, I'll play around with it

  4. #4

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    no no...

    I'd say it's the same as I tried, especially the function. My mistake was to take the process instead of the window handle

    Thx anyway...

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