-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCommandDlg.cpp
104 lines (84 loc) · 2.14 KB
/
CommandDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// CommandDlg.cpp : implementation file
//
#include "stdafx.h"
#include "exe2c_gui.h"
#include "CommandDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCommandDlg dialog
CCommandDlg::CCommandDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCommandDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCommandDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CCommandDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCommandDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCommandDlg, CDialog)
//{{AFX_MSG_MAP(CCommandDlg)
// NOTE: the ClassWizard will add message map macros here
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCommandDlg message handlers
#include "mainfrm.h"
extern class CMainFrame* g_Mfm;
BOOL CCommandDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
{
CString m_strCommand;
GetDlgItem(IDC_COMMAND)->GetWindowText(m_strCommand);
::g_EXE2C->DoCommandLine(m_strCommand);
g_Mfm->ClearFun();
g_Mfm->ShowFun();
//MessageBox(m_strCommand);
GetDlgItem(IDC_COMMAND)->SetWindowText("");
// return false;
}
return CDialog::PreTranslateMessage(pMsg);
}
void CCommandDlg::OnOK()
{
}
void CCommandDlg::AddLine(PCSTR str)
{
CEdit *p = (CEdit *)GetDlgItem(IDC_EDIT1);
strcpy(this->buf,str);
char *s = strchr(buf,'\n');
if(s != NULL)
{
strcpy(s, "\r\n");
}//*/
if (p != NULL)
{
p->ReplaceSel(buf);
}
}
void CCommandDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(nType ==SIZE_RESTORED)
{
CRect r;
this->GetClientRect(&r);
CEdit *p = (CEdit *)GetDlgItem(IDC_EDIT1);
if(NULL != p->GetSafeHwnd())
{
p->MoveWindow(r);
p->GetClientRect(&r);
}
}
}