Re: SendMessage( HWnd, WM_CLOSE, 0, 0); does not work



On Tue, 02 Oct 2007 05:10:31 -0700, Sonnich Jensen
<sonnich.jensen@xxxxxxxxxxxxxxxxx> wrote:

hi all

the following piece of code does not work. I get a "negative" ding on
the wm_close line... any ideas anyone?



procedure TForm1.Button2Click(Sender: TObject);
var
HWnd: thandle;
begin
HWnd := FindWindow('IEFrame', nil);
while HWnd <> 0 do
begin
SendMessage( HWnd, WM_CLOSE, 0, 0);
HWnd := FindWindow('IEFrame', nil);
end;
end;

Try using PostMessage instead of SendMessage. It works for me.

Don
.