CDialog::OnInitDialog(); CString cmdline = AfxGetApp()->m_lpCmdLine; if (cmdline == "bk") { PostMessage(WM_CLOSE,NULL,NULL); }