// API SampleHWND hwnd = ::FindWindow(NULL, "MyDialog");if (hwnd) ::SendMessage(hwnd, WM_CLOSE, 0 , 0);// MFC SampleCWnd* pD = FindWindow(NULL, "MyDialog");if (pD) pD->SendMessage(WM_CLOSE, 0 , 0);