|
WARNING !
I have not tested this, but I suspect the code above has a dangerous bug - maybe it will close not only every instance of MS-Internet explorer, but also any TWebBrowser component that is on any form included in any Delphi -made program !
Since it is not normal to close individual components in a running Delphi -program, this may cause severe malfunction in any delphi-application affected.
especially I find this one suspicious:
begin
// check by class name!
GetClassName (Wnd, sCap, sizeof(sCap));
if sCap = 'IEFrame' then
PostMessage (Wnd, WM_CLOSE, 0, 0);
end;
Myself, I would use the EnumWindows API call instead.
it requires a callback function, but defining your callback with the stdcall directive should make that no problem at all.
|