急急!!在delphi的ActiveForm中怎样调用windows的api来关闭当前打开的浏览器窗口,在线等!!!

解决方案 »

  1.   

    没有用过ActiveForm。ActiveForm里面的控件有句柄么?若是有,你就不断的使用GetParent,直到得到 IE 窗口句柄,然后再SendMessage 关闭窗口。或者使用PostQuitMessage试试~~~
      

  2.   

    Read ActiveForm to learn which form in the application has input focus. If the application is not currently active, ActiveForm is the form that will have focus when the application becomes active again.ActiveForm is a read-only property. To change the ActiveForm, use the SetFocus method of the form that should receive focus. ActiveForm also changes if the SetFocusedControl method of an inactive form is called to set focus to a control on that inactive form.After focus shifts from one form to another, the screen receives an OnActiveFormChange event.Note: If the application window with focus is not a TForm descendant (for example, if it is a property page), it will not appear as ActiveForm. To handle such cases, use the ActiveCustomForm property instead.
      

  3.   

    procedure GetActiveForm;
    begin
      if Screen.ActiveForm=form1 then
        yourform.close;
    end;