void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString str = this->Edit1->Text;
char chr[MAX_PATH];
strcpy( chr , str.c_str() );
HWND WinHandle = FindWindow(NULL, chr);
SendMessage(WinHandle, WM_SYSCOMMAND, SC_CLOSE, 0);
}