1 #include "studiox_includes.h"
2 
3 #ifdef _DEBUG
4 #define new DEBUG_NEW
5 #endif
6 
BEGIN_MESSAGE_MAP(MacroRecordDlg,express_dialog)7 BEGIN_MESSAGE_MAP(MacroRecordDlg, express_dialog)
8     ON_BN_CLICKED(IDC_BROWSE_PATH, &MacroRecordDlg::OnBnClickedBrowsePath)
9     ON_BN_CLICKED(IDCANCEL, &MacroRecordDlg::OnCancel)
10     ON_WM_SHOWWINDOW()
11 END_MESSAGE_MAP()
12 
13 MacroRecordDlg::MacroRecordDlg(CWnd* pParent)
14 	: express_dialog(MacroRecordDlg::IDD, pParent)
15 {
16     IconId = IDB_MACRO_RECORD_ICON;
17     SetTitleText("Record Macro");
18 }
19 
~MacroRecordDlg()20 MacroRecordDlg::~MacroRecordDlg()
21 {
22 }
23 
OnShowWindow(BOOL bShow,UINT nStatus)24 void MacroRecordDlg::OnShowWindow(BOOL bShow, UINT nStatus)
25 {
26     CRect size;
27     GetWindowRect(&size);
28 
29     size.OffsetRect(0, -120);
30     MoveWindow(size);
31     CDialog::OnShowWindow(bShow, nStatus);
32 }
33 
OnInitDialog()34 BOOL MacroRecordDlg::OnInitDialog()
35 {
36     express_dialog::OnInitDialog();
37 
38     // TODO:  Add extra initialization here
39     AddCancelButton();
40     AddSaveButton(_T("Record"));
41 
42     return TRUE;  // return TRUE unless you set the focus to a control
43                   // EXCEPTION: OCX Property Pages should return FALSE
44 }
45 
DoDataExchange(CDataExchange * pDX)46 void MacroRecordDlg::DoDataExchange(CDataExchange* pDX)
47 {
48     CDialog::DoDataExchange(pDX);
49 }
50 
OnOK()51 void MacroRecordDlg::OnOK()
52 {
53     GetDlgItemText(IDC_EDIT_NAME, mmacro_name);
54     GetDlgItemText(IDC_EDIT_PATH, mmacro_path);
55 
56     if (mmacro_name.IsEmpty() || mmacro_path.IsEmpty())
57     {
58         return;
59     }
60     CDialog::OnOK();
61 }
62 
OnCancel()63 void MacroRecordDlg::OnCancel()
64 {
65     CDialog::OnCancel();
66 }
67 
OnBnClickedBrowsePath()68 void MacroRecordDlg::OnBnClickedBrowsePath()
69 {
70     TCHAR path[MAX_PATH];
71     if (BrowseForFolder(m_hWnd, NULL, NULL, path))
72     {
73         SetDlgItemText(IDC_EDIT_PATH, path);
74     }
75 }
76