// DebugDialog.cpp : implementation file // #include "stdafx.h" #include "DFE32.h" #include "DebugDialog.h" #include "extern.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDebugDialog dialog CDebugDialog::CDebugDialog(CWnd* pParent /*=NULL*/) : CDialog(CDebugDialog::IDD, pParent) { //{{AFX_DATA_INIT(CDebugDialog) m_DebugEdit = _T(""); //}}AFX_DATA_INIT } void CDebugDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDebugDialog) DDX_Text(pDX, IDC_DEBUG_EDIT, m_DebugEdit); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDebugDialog, CDialog) //{{AFX_MSG_MAP(CDebugDialog) ON_BN_CLICKED(IDC_DEBUG_BROWSE_BUTTON, OnDebugBrowseButton) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDebugDialog message handlers void CDebugDialog::OnDebugBrowseButton() { // TODO: Add your control notification handler code here CFileDialog filedialog(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Executable Files (*.exe)|*.exe||"); if (filedialog.DoModal() == IDOK) { m_DebugEdit = filedialog.GetPathName(); UpdateData(FALSE); } } void CDebugDialog::OnOK() { // TODO: Add extra validation here int i, j; char str[256]; UpdateData(TRUE); if (m_DebugEdit.IsEmpty()) { AfxMessageBox("Please enter an executable file"); } else { for ( i = 0, j = 0; i < m_DebugEdit.GetLength(); i++) { str[j] = m_DebugEdit[i]; if (str[j] == '\\') str[++j] = '\\'; j++; } str[j] = '\0'; ShellExecute(NULL,"open",gdbpath.GetBuffer(500),str,".",SW_NORMAL); CDialog::OnOK(); } }