Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
EX17_1.cpp
EX17_1Dlg.cpp
d:\myprojects\ex17_1\ex17_1dlg.cpp(219) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.
EX17_1.exe - 1 error(s), 0 warning(s)
// EX17_1Dlg.cpp : implementation file
//
#include "EX17_1.h"
#include "EX17_1Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
CString m_sName;
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEX17_1Dlg dialog
CEX17_1Dlg::CEX17_1Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CEX17_1Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CEX17_1Dlg)
m_nAge = COleDateTime::GetCurrentTime();
m_nSex = -1;
m_bMarried = FALSE;
m_sname = _T("");
m_sTitle = -1;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_sName=_T("");
}
void CEX17_1Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEX17_1Dlg)
DDX_Control(pDX, IDC_SPINAGE, m_m_spinAge);
DDX_Control(pDX, IDC_AGE, m_editAge);
DDX_Control(pDX, IDC_DEGREE, m_listDegree);
DDX_Text(pDX, IDC_AGE, m_nAge);
DDX_Radio(pDX, IDC_MALE, m_nSex);
DDX_Check(pDX, IDC_MARRIED, m_bMarried);
DDX_Text(pDX, IDC_NAME, m_sname);
DDX_CBIndex(pDX, IDC_TITLE, m_sTitle);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEX17_1Dlg, CDialog)
//{{AFX_MSG_MAP(CEX17_1Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEX17_1Dlg message handlers
BOOL CEX17_1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_nSex=0;
m_listDegree.Addstring(");
m_listDegree.Addstring("Bachelor");
m_listDegree.Addstring("Master");
m_listDegree.Addstring("Doctor");
m_spinAge.SetBuddy(&m_editAge);
m_spinAge.SetRange(0.2000);
m_spinAge.SetBasee(10);
m_spinAge.SetPos90);
Updatedata(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
void CEX17_1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CEX17_1Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CEX17_1Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CEX17_1Dlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
char sText[100]="",sSex[8],SMarried[12],sDegrr[10]="";
switch(m_nsex)
{
case 0:
strcpy(sSex,'Male");
break;
case 1:
strcpu(sSex,"Female");
break;
}
if (m_bMarried)
strcpy(sMarried,"Married");
else
strcpy(sMarried,"Not married");
m_listDegree.GetText(m_listDegree.GetCapturl(),sDegrr);
wsprintf(sText,"%s,%s,%s,%d,%s,%s",m_sName.GetBuffer(20),
sSex,sMarried,m_nAge/*=m_spinAge.GetPos()*/,sDegree,
m_sTile.GetBuffer(10));
MessageBox(sText);
CDialog::OnOK();
}
5 个解决方案
#1
和程序没关系
设置的问题
看一看StdAfx.h等东西
设置的问题
看一看StdAfx.h等东西
#2
在这个文件的最上面添加:
#include "stdafx.h"
并且保证此文件所在的目录有stdafx.h文件
#include "stdafx.h"
并且保证此文件所在的目录有stdafx.h文件
#3
up
#4
谢谢了::
个位大虾祝你们快乐每一天
谢谢
个位大虾祝你们快乐每一天
谢谢
#5
这样做 在 Project->settings-> C/C++ -> Catgory :Precompiled Headers
里面选择 Automatic use of precompiled headers 就没有问题了
是预编译的问题
里面选择 Automatic use of precompiled headers 就没有问题了
是预编译的问题
#1
和程序没关系
设置的问题
看一看StdAfx.h等东西
设置的问题
看一看StdAfx.h等东西
#2
在这个文件的最上面添加:
#include "stdafx.h"
并且保证此文件所在的目录有stdafx.h文件
#include "stdafx.h"
并且保证此文件所在的目录有stdafx.h文件
#3
up
#4
谢谢了::
个位大虾祝你们快乐每一天
谢谢
个位大虾祝你们快乐每一天
谢谢
#5
这样做 在 Project->settings-> C/C++ -> Catgory :Precompiled Headers
里面选择 Automatic use of precompiled headers 就没有问题了
是预编译的问题
里面选择 Automatic use of precompiled headers 就没有问题了
是预编译的问题