bcb: C++ Builder XE:
项目: newtower: ok:
BCB_定时关闭IE_alert窗口
Edit1: [Microsoft Internet Explorer]
Edit2: [#32770]
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
// 关闭IE alert
if( ! CheckBox1->Checked )
return;
Timer1->Interval = Edit3->Text.ToInt();
// 执行关闭alert
Timer1->Enabled = 0;
//
// HWND hw = FindWindow(0, Edit1->Text.c_str() ); // ok, 这个也可以
HWND hw = FindWindow( Edit2->Text.c_str(), Edit1->Text.c_str() ); // ok
// Edit1: [Microsoft Internet Explorer]
// Edit2: [#32770]
if( hw != 0 )
{
PostMessage(hw, WM_COMMAND, IDNO, 0); //关闭的窗口
//PostMessage(hw, WM_CLOSE, 0, 0);
PostMessage(hw, WM_SYSCOMMAND, SC_CLOSE, 0);
// PostMessage(hw, WM_CLOSE, 0, 0);
}
Timer1->Enabled = 1;
//
}
刘涛 136,1308,6264 30234923@qq.com QQ: 30234923 MSN: newtower@hotmail.com http://XiaoJinTa.com