>>>Hi
>>>
>>>I am trying to colse an application using the above api functions, but I always get a return value of zero, can you tel me what I am doing wrong
>>>
>>>lnOk=PostMessage (thisform.lnActiveWindowHandel, WM_CLOSE, 0, 0)
>>>
>>
>>A few questions - what is in lnActiveWindowHandle (ie are you sure it's a valid handle?)
>>
>>What do you have defined as WM_CLOSE (are you sure the value is defined properly?)
>>
>>What is the error returned by GetLastError()?
>>
>>You should probably read the MSDN Library documentation on PostMessage() if you aren't sure of the answers; the information you give is inadequate to analyze the error.
>
>Ed,
>
>According to the SDK, an application processing the message will return zero.
Actually, PostMessage() only indicates that the message is queued, not processed; the MSDN docs on PostMessage() show:
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.