Compiling...
PrintFram.cpp
F:\学员队信息管理\PrintFram.cpp(15) : error C2146: syntax error : missing ';' before identifier 'theApp'
F:\学员队信息管理\PrintFram.cpp(15) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\PrintFram.sbr': No such file or directory
Error executing bscmake.exe.
UseAdo.exe - 3 error(s), 0 warning(s)
#include "stdafx.h"
#include "PrintFram.h"
#include "PrintView.h"
#include "UseAdoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrintFram
extern CUseAdoApp theApp;
IMPLEMENT_DYNCREATE(CPrintFram, CFrameWnd)
CPrintFram::CPrintFram()
{
}
。。。。。。。。。。
。。。。。。。。
。。。。。。
错误在这extern CUseAdoApp theApp;
还有这是什么错啊:
BSCMAKE: error BK1506 : cannot open file '.\Debug\PrintFram.sbr': No such file or directory
Error executing bscmake.exe.
调试时没错,再编译是就有错了,我把Debug删除之后再编译还是一样的错误!这是什么错误啊!
16 个解决方案
#1
extern CUseAdoApp theApp;
我也给它定义了头文件了
我也给它定义了头文件了
#2
代码中什么地方缺少一个分号或者有未定义的类型,检查一下头文件。
#3
没有啊我都检查过了
#4
以前碰到过,忘了怎么解决的啦。
extern CUseAdoApp theApp;
我也给它定义了头文件了
估计还是类型不能识别的原因。
extern CUseAdoApp theApp;
我也给它定义了头文件了
估计还是类型不能识别的原因。
#5
那怎么解决呢?
#6
另外,.sbr是与浏览信息有关的文件,其它错误改正了它就应该不会出现了
#7
哦!那错误应该怎么改啊,
我的这个PrintFram.cpp和.h是通过添加文件的方式添加进去的,后来我是改写了它原来的头文件定义。而写成了#include "UseAdoDlg.h"。按理来说应该是没错的啊!
#8
需要包含声明了 CUseAdoApp类 的头文件
#9
你这说的太模糊了
能不能把详细的代码贴出来啊
能不能把详细的代码贴出来啊
#10
extern CUseAdoApp theApp;它这是外引用啊,应该只要定义#include "UseAdoDlg.h"吧,CUseAdoApp theApp被包含于UseAdoDlg.cpp里!应该是这样啊?
#11
贴点代码吧
#12
这是主程序比较长不用看明白
// UseAdoDlg.cpp : implementation file
//
#if !defined(AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_)
#define AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "ADO.h"
#include "qidong.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.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();
// 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()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg dialog
CUseAdoDlg::CUseAdoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUseAdoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUseAdoDlg)
m_xingming = _T("");
m_xuehao = _T("");
m_chusheng = _T("");
m_dangtuan = _T("");
m_jiguan = _T("");
m_banji = _T("");
m_zhiwu = _T("");
m_minzu = _T("");
m_dizhi = _T("");
m_dianhua = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CUseAdoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUseAdoDlg)
DDX_Control(pDX, IDC_COMBO4, m_neirong);
DDX_Control(pDX, IDC_BUTTON3, m_tuichu);
DDX_Control(pDX, IDC_BUTTON2, m_chazhao);
DDX_Control(pDX, IDC_BUTMOD, m_xiugai);
DDX_Control(pDX, IDC_BUTDEL, m_shanchu);
DDX_Control(pDX, IDC_BUTCLEAR, m_qingkong);
DDX_Control(pDX, IDC_BUTADD, m_tianjia);
DDX_Control(pDX, IDC_BUTTON1, m_liulan);
DDX_Control(pDX, IDC_COMBO1, m_Combo);
DDX_Control(pDX, IDC_LIST2, m_Grid1);
DDX_Control(pDX, IDC_PICTURESHOW, m_pictureshow);
DDX_Control(pDX, IDC_LIST1, m_Grid);
DDX_Text(pDX, IDC_EDIT1, m_xingming);
DDX_Text(pDX, IDC_EDIT2, m_xuehao);
DDX_Text(pDX, IDC_EDIT4, m_chusheng);
DDX_Text(pDX, IDC_EDIT5, m_dangtuan);
DDX_Text(pDX, IDC_EDIT6, m_jiguan);
DDX_Text(pDX, IDC_EDIT7, m_banji);
DDX_Text(pDX, IDC_EDIT8, m_zhiwu);
DDX_Text(pDX, IDC_EDIT3, m_minzu);
DDX_Text(pDX, IDC_EDIT10, m_dizhi);
DDX_Text(pDX, IDC_EDIT9, m_dianhua);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUseAdoDlg, CDialog)
//{{AFX_MSG_MAP(CUseAdoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTADD, OnButadd)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BUTMOD, OnButmod)
ON_BN_CLICKED(IDC_BUTDEL, OnButdel)
ON_BN_CLICKED(IDC_BUTCLEAR, OnButclear)
ON_BN_CLICKED(IDC_BUTTON1, OnButliulan)
ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
ON_BN_CLICKED(IDC_BUTTON2, OnButchazhao)
ON_BN_CLICKED(IDC_BUTTON3, Ontuichu)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_CBN_SELCHANGE(IDC_COMBO4, OnSelchangeCombo4)
ON_BN_CLICKED(IDC_dayin, Ondayin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg message handlers
BOOL CUseAdoDlg::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
// GetDlgItem(IDB_BITMAP1)->SetWindowPos(&CWnd::wndBottom,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
arrays[0] ="入库单号";
arrays[1] ="图书名称";
arrays[2] ="条形码";
arrays[3] ="作者";
arrays[4] ="出版社";
arrays[5] ="价格";
arrays[6] ="数量";
arrays[7] ="价格";
arrays[8] ="数量";
arrays[9] ="入库单号";
Cqidong dlg0;
dlg0.DoModal();
m_liulan.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_liulan))); //设置位图
m_tianjia.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tianjia))); //设置位图
m_xiugai.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_xiugai))); //设置位图
m_shanchu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_shanchu))); //设置位图
m_qingkong.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_qingkong))); //设置位图
m_chazhao.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_chazhao))); //设置位图
m_tuichu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tuichu))); //设置位图
m_bitmap.LoadBitmap(IDB_BITMAP1);
m_Combo.SetCurSel(0);
m_neirong.SetCurSel(-1);
m_Grid1.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid1.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid1.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid1.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid1.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid1.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid1.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid1.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid1.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid1.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid1.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
m_Grid.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
AddToGrid();
return TRUE; // return TRUE unless you set the focus to a control
}
void CUseAdoDlg::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 CUseAdoDlg::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
{
CPaintDC dc(this);
dc.DrawState(CPoint(0,0),CSize(900,700),m_bitmap,DST_BITMAP);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CUseAdoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CUseAdoDlg::AddToGrid()
{
}
void CUseAdoDlg::OnButadd()
{
}
void CUseAdoDlg::OnButdel()
{
/
}
void CUseAdoDlg::OnButliulan()
{
}
void CUseAdoDlg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
{
/
}
void CUseAdoDlg::OnButchazhao()
{
}
void CUseAdoDlg::OnSelchangeCombo4()
{
// TODO: Add your control notification handler code here
int pos=m_neirong.GetCurSel();
m_neirong.GetLBText(pos,neirong);
}
void CUseAdoDlg::Ondayin()
{
// TODO: Add your control notification handler code here
CUseAdoApp * app=(CUseAdoApp*)AfxGetApp();
app->m_main =app->m_pMainWnd;
app->m_pMainWnd = NULL;
report.m_plist = &m_Grid;
report.verinterval = 20;
report.title = "学员信息";
report.fields = arrays;
report.lmargin = 40;
report.rmargin = 40;
report.framtilte = "打印";
app->m_pDocManager->OnFileNew();
CPrintFram * temp=(CPrintFram*)app->m_pMainWnd;
temp->SetTitle(report.framtilte);
}
// UseAdoDlg.cpp : implementation file
//
#if !defined(AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_)
#define AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "ADO.h"
#include "qidong.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.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();
// 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()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg dialog
CUseAdoDlg::CUseAdoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUseAdoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUseAdoDlg)
m_xingming = _T("");
m_xuehao = _T("");
m_chusheng = _T("");
m_dangtuan = _T("");
m_jiguan = _T("");
m_banji = _T("");
m_zhiwu = _T("");
m_minzu = _T("");
m_dizhi = _T("");
m_dianhua = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CUseAdoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUseAdoDlg)
DDX_Control(pDX, IDC_COMBO4, m_neirong);
DDX_Control(pDX, IDC_BUTTON3, m_tuichu);
DDX_Control(pDX, IDC_BUTTON2, m_chazhao);
DDX_Control(pDX, IDC_BUTMOD, m_xiugai);
DDX_Control(pDX, IDC_BUTDEL, m_shanchu);
DDX_Control(pDX, IDC_BUTCLEAR, m_qingkong);
DDX_Control(pDX, IDC_BUTADD, m_tianjia);
DDX_Control(pDX, IDC_BUTTON1, m_liulan);
DDX_Control(pDX, IDC_COMBO1, m_Combo);
DDX_Control(pDX, IDC_LIST2, m_Grid1);
DDX_Control(pDX, IDC_PICTURESHOW, m_pictureshow);
DDX_Control(pDX, IDC_LIST1, m_Grid);
DDX_Text(pDX, IDC_EDIT1, m_xingming);
DDX_Text(pDX, IDC_EDIT2, m_xuehao);
DDX_Text(pDX, IDC_EDIT4, m_chusheng);
DDX_Text(pDX, IDC_EDIT5, m_dangtuan);
DDX_Text(pDX, IDC_EDIT6, m_jiguan);
DDX_Text(pDX, IDC_EDIT7, m_banji);
DDX_Text(pDX, IDC_EDIT8, m_zhiwu);
DDX_Text(pDX, IDC_EDIT3, m_minzu);
DDX_Text(pDX, IDC_EDIT10, m_dizhi);
DDX_Text(pDX, IDC_EDIT9, m_dianhua);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUseAdoDlg, CDialog)
//{{AFX_MSG_MAP(CUseAdoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTADD, OnButadd)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BUTMOD, OnButmod)
ON_BN_CLICKED(IDC_BUTDEL, OnButdel)
ON_BN_CLICKED(IDC_BUTCLEAR, OnButclear)
ON_BN_CLICKED(IDC_BUTTON1, OnButliulan)
ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
ON_BN_CLICKED(IDC_BUTTON2, OnButchazhao)
ON_BN_CLICKED(IDC_BUTTON3, Ontuichu)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_CBN_SELCHANGE(IDC_COMBO4, OnSelchangeCombo4)
ON_BN_CLICKED(IDC_dayin, Ondayin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg message handlers
BOOL CUseAdoDlg::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
// GetDlgItem(IDB_BITMAP1)->SetWindowPos(&CWnd::wndBottom,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
arrays[0] ="入库单号";
arrays[1] ="图书名称";
arrays[2] ="条形码";
arrays[3] ="作者";
arrays[4] ="出版社";
arrays[5] ="价格";
arrays[6] ="数量";
arrays[7] ="价格";
arrays[8] ="数量";
arrays[9] ="入库单号";
Cqidong dlg0;
dlg0.DoModal();
m_liulan.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_liulan))); //设置位图
m_tianjia.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tianjia))); //设置位图
m_xiugai.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_xiugai))); //设置位图
m_shanchu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_shanchu))); //设置位图
m_qingkong.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_qingkong))); //设置位图
m_chazhao.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_chazhao))); //设置位图
m_tuichu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tuichu))); //设置位图
m_bitmap.LoadBitmap(IDB_BITMAP1);
m_Combo.SetCurSel(0);
m_neirong.SetCurSel(-1);
m_Grid1.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid1.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid1.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid1.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid1.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid1.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid1.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid1.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid1.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid1.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid1.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
m_Grid.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
AddToGrid();
return TRUE; // return TRUE unless you set the focus to a control
}
void CUseAdoDlg::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 CUseAdoDlg::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
{
CPaintDC dc(this);
dc.DrawState(CPoint(0,0),CSize(900,700),m_bitmap,DST_BITMAP);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CUseAdoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CUseAdoDlg::AddToGrid()
{
}
void CUseAdoDlg::OnButadd()
{
}
void CUseAdoDlg::OnButdel()
{
/
}
void CUseAdoDlg::OnButliulan()
{
}
void CUseAdoDlg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
{
/
}
void CUseAdoDlg::OnButchazhao()
{
}
void CUseAdoDlg::OnSelchangeCombo4()
{
// TODO: Add your control notification handler code here
int pos=m_neirong.GetCurSel();
m_neirong.GetLBText(pos,neirong);
}
void CUseAdoDlg::Ondayin()
{
// TODO: Add your control notification handler code here
CUseAdoApp * app=(CUseAdoApp*)AfxGetApp();
app->m_main =app->m_pMainWnd;
app->m_pMainWnd = NULL;
report.m_plist = &m_Grid;
report.verinterval = 20;
report.title = "学员信息";
report.fields = arrays;
report.lmargin = 40;
report.rmargin = 40;
report.framtilte = "打印";
app->m_pDocManager->OnFileNew();
CPrintFram * temp=(CPrintFram*)app->m_pMainWnd;
temp->SetTitle(report.framtilte);
}
#13
这是出现错误的程序
// PrintFram.cpp : implementation file
//
#include "stdafx.h"
#include "PrintFram.h"
#include "PrintView.h"
#include "UseAdoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrintFram
extern CUseAdoApp theApp;////////////////////////////错误在这
IMPLEMENT_DYNCREATE(CPrintFram, CFrameWnd)
CPrintFram::CPrintFram()
{
}
CPrintFram::~CPrintFram()
{
}
BEGIN_MESSAGE_MAP(CPrintFram, CFrameWnd)
//{{AFX_MSG_MAP(CPrintFram)
ON_WM_CREATE()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrintFram message handlers
#ifdef _DEBUG
void CPrintFram::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CPrintFram::Dump(CDumpContext &dc) const
{
CFrameWnd::Dump(dc);
}
#endif
int CPrintFram::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_ToolBar);
theApp.m_mainfram = this;
this->SetTitle(report.framtilte);
this->ShowWindow(SW_SHOWMAXIMIZED);
//this->UpdateWindow();
return 0;
}
void CPrintFram::OnClose()
{
theApp.m_mainfram = NULL;
CPrintView* temp = (CPrintView*)this->GetActiveView();
if (! temp->ispreview)
theApp.m_pMainWnd = theApp.m_main;
CFrameWnd::OnClose();
}
// PrintFram.cpp : implementation file
//
#include "stdafx.h"
#include "PrintFram.h"
#include "PrintView.h"
#include "UseAdoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrintFram
extern CUseAdoApp theApp;////////////////////////////错误在这
IMPLEMENT_DYNCREATE(CPrintFram, CFrameWnd)
CPrintFram::CPrintFram()
{
}
CPrintFram::~CPrintFram()
{
}
BEGIN_MESSAGE_MAP(CPrintFram, CFrameWnd)
//{{AFX_MSG_MAP(CPrintFram)
ON_WM_CREATE()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrintFram message handlers
#ifdef _DEBUG
void CPrintFram::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CPrintFram::Dump(CDumpContext &dc) const
{
CFrameWnd::Dump(dc);
}
#endif
int CPrintFram::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_ToolBar);
theApp.m_mainfram = this;
this->SetTitle(report.framtilte);
this->ShowWindow(SW_SHOWMAXIMIZED);
//this->UpdateWindow();
return 0;
}
void CPrintFram::OnClose()
{
theApp.m_mainfram = NULL;
CPrintView* temp = (CPrintView*)this->GetActiveView();
if (! temp->ispreview)
theApp.m_pMainWnd = theApp.m_main;
CFrameWnd::OnClose();
}
#14
// UseAdo.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.h"
//#include "Startup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp
BEGIN_MESSAGE_MAP(CUseAdoApp, CWinApp)
//{{AFX_MSG_MAP(CUseAdoApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp construction
CUseAdoApp::CUseAdoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CUseAdoApp object
CUseAdoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp initialization
BOOL CUseAdoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
m_mainfram = NULL;
CSingleDocTemplate* pDocTemplate;// 文档模板,CSingleDocTemplate是CDocManager的子类(派生类),表示单文档模板。
// 由pDocTemplate掌管Document、View、Frame三位的关系,至于RUNTIME_CLASS这个宏是用来处理动态创建对象的
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPrintDoc),
RUNTIME_CLASS(CPrintFram), // main SDI frame window
RUNTIME_CLASS(CPrintView));
AddDocTemplate(pDocTemplate);// 将文档模板添加到m_pDocManager管理的指针序列中
CUseAdoDlg dlg;
m_pMainWnd = &dlg;// // // 主窗口指针
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
//
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.h"
//#include "Startup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp
BEGIN_MESSAGE_MAP(CUseAdoApp, CWinApp)
//{{AFX_MSG_MAP(CUseAdoApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp construction
CUseAdoApp::CUseAdoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CUseAdoApp object
CUseAdoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp initialization
BOOL CUseAdoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
m_mainfram = NULL;
CSingleDocTemplate* pDocTemplate;// 文档模板,CSingleDocTemplate是CDocManager的子类(派生类),表示单文档模板。
// 由pDocTemplate掌管Document、View、Frame三位的关系,至于RUNTIME_CLASS这个宏是用来处理动态创建对象的
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPrintDoc),
RUNTIME_CLASS(CPrintFram), // main SDI frame window
RUNTIME_CLASS(CPrintView));
AddDocTemplate(pDocTemplate);// 将文档模板添加到m_pDocManager管理的指针序列中
CUseAdoDlg dlg;
m_pMainWnd = &dlg;// // // 主窗口指针
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
#15
"CUseAdoApp theApp;" 在useadoapp.cpp里面,然后
"extern CUseAdoApp theApp"写到useadoapp.h里面就可以了。
"extern CUseAdoApp theApp"写到useadoapp.h里面就可以了。
#16
谢谢大家了,我的问题解决了,是有一个头文件没定义,呵呵!少写了UseAdo.h!
#1
extern CUseAdoApp theApp;
我也给它定义了头文件了
我也给它定义了头文件了
#2
代码中什么地方缺少一个分号或者有未定义的类型,检查一下头文件。
#3
没有啊我都检查过了
#4
以前碰到过,忘了怎么解决的啦。
extern CUseAdoApp theApp;
我也给它定义了头文件了
估计还是类型不能识别的原因。
extern CUseAdoApp theApp;
我也给它定义了头文件了
估计还是类型不能识别的原因。
#5
那怎么解决呢?
#6
另外,.sbr是与浏览信息有关的文件,其它错误改正了它就应该不会出现了
#7
哦!那错误应该怎么改啊,
我的这个PrintFram.cpp和.h是通过添加文件的方式添加进去的,后来我是改写了它原来的头文件定义。而写成了#include "UseAdoDlg.h"。按理来说应该是没错的啊!
#8
需要包含声明了 CUseAdoApp类 的头文件
#9
你这说的太模糊了
能不能把详细的代码贴出来啊
能不能把详细的代码贴出来啊
#10
extern CUseAdoApp theApp;它这是外引用啊,应该只要定义#include "UseAdoDlg.h"吧,CUseAdoApp theApp被包含于UseAdoDlg.cpp里!应该是这样啊?
#11
贴点代码吧
#12
这是主程序比较长不用看明白
// UseAdoDlg.cpp : implementation file
//
#if !defined(AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_)
#define AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "ADO.h"
#include "qidong.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.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();
// 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()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg dialog
CUseAdoDlg::CUseAdoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUseAdoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUseAdoDlg)
m_xingming = _T("");
m_xuehao = _T("");
m_chusheng = _T("");
m_dangtuan = _T("");
m_jiguan = _T("");
m_banji = _T("");
m_zhiwu = _T("");
m_minzu = _T("");
m_dizhi = _T("");
m_dianhua = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CUseAdoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUseAdoDlg)
DDX_Control(pDX, IDC_COMBO4, m_neirong);
DDX_Control(pDX, IDC_BUTTON3, m_tuichu);
DDX_Control(pDX, IDC_BUTTON2, m_chazhao);
DDX_Control(pDX, IDC_BUTMOD, m_xiugai);
DDX_Control(pDX, IDC_BUTDEL, m_shanchu);
DDX_Control(pDX, IDC_BUTCLEAR, m_qingkong);
DDX_Control(pDX, IDC_BUTADD, m_tianjia);
DDX_Control(pDX, IDC_BUTTON1, m_liulan);
DDX_Control(pDX, IDC_COMBO1, m_Combo);
DDX_Control(pDX, IDC_LIST2, m_Grid1);
DDX_Control(pDX, IDC_PICTURESHOW, m_pictureshow);
DDX_Control(pDX, IDC_LIST1, m_Grid);
DDX_Text(pDX, IDC_EDIT1, m_xingming);
DDX_Text(pDX, IDC_EDIT2, m_xuehao);
DDX_Text(pDX, IDC_EDIT4, m_chusheng);
DDX_Text(pDX, IDC_EDIT5, m_dangtuan);
DDX_Text(pDX, IDC_EDIT6, m_jiguan);
DDX_Text(pDX, IDC_EDIT7, m_banji);
DDX_Text(pDX, IDC_EDIT8, m_zhiwu);
DDX_Text(pDX, IDC_EDIT3, m_minzu);
DDX_Text(pDX, IDC_EDIT10, m_dizhi);
DDX_Text(pDX, IDC_EDIT9, m_dianhua);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUseAdoDlg, CDialog)
//{{AFX_MSG_MAP(CUseAdoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTADD, OnButadd)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BUTMOD, OnButmod)
ON_BN_CLICKED(IDC_BUTDEL, OnButdel)
ON_BN_CLICKED(IDC_BUTCLEAR, OnButclear)
ON_BN_CLICKED(IDC_BUTTON1, OnButliulan)
ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
ON_BN_CLICKED(IDC_BUTTON2, OnButchazhao)
ON_BN_CLICKED(IDC_BUTTON3, Ontuichu)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_CBN_SELCHANGE(IDC_COMBO4, OnSelchangeCombo4)
ON_BN_CLICKED(IDC_dayin, Ondayin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg message handlers
BOOL CUseAdoDlg::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
// GetDlgItem(IDB_BITMAP1)->SetWindowPos(&CWnd::wndBottom,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
arrays[0] ="入库单号";
arrays[1] ="图书名称";
arrays[2] ="条形码";
arrays[3] ="作者";
arrays[4] ="出版社";
arrays[5] ="价格";
arrays[6] ="数量";
arrays[7] ="价格";
arrays[8] ="数量";
arrays[9] ="入库单号";
Cqidong dlg0;
dlg0.DoModal();
m_liulan.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_liulan))); //设置位图
m_tianjia.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tianjia))); //设置位图
m_xiugai.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_xiugai))); //设置位图
m_shanchu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_shanchu))); //设置位图
m_qingkong.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_qingkong))); //设置位图
m_chazhao.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_chazhao))); //设置位图
m_tuichu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tuichu))); //设置位图
m_bitmap.LoadBitmap(IDB_BITMAP1);
m_Combo.SetCurSel(0);
m_neirong.SetCurSel(-1);
m_Grid1.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid1.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid1.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid1.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid1.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid1.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid1.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid1.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid1.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid1.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid1.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
m_Grid.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
AddToGrid();
return TRUE; // return TRUE unless you set the focus to a control
}
void CUseAdoDlg::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 CUseAdoDlg::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
{
CPaintDC dc(this);
dc.DrawState(CPoint(0,0),CSize(900,700),m_bitmap,DST_BITMAP);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CUseAdoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CUseAdoDlg::AddToGrid()
{
}
void CUseAdoDlg::OnButadd()
{
}
void CUseAdoDlg::OnButdel()
{
/
}
void CUseAdoDlg::OnButliulan()
{
}
void CUseAdoDlg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
{
/
}
void CUseAdoDlg::OnButchazhao()
{
}
void CUseAdoDlg::OnSelchangeCombo4()
{
// TODO: Add your control notification handler code here
int pos=m_neirong.GetCurSel();
m_neirong.GetLBText(pos,neirong);
}
void CUseAdoDlg::Ondayin()
{
// TODO: Add your control notification handler code here
CUseAdoApp * app=(CUseAdoApp*)AfxGetApp();
app->m_main =app->m_pMainWnd;
app->m_pMainWnd = NULL;
report.m_plist = &m_Grid;
report.verinterval = 20;
report.title = "学员信息";
report.fields = arrays;
report.lmargin = 40;
report.rmargin = 40;
report.framtilte = "打印";
app->m_pDocManager->OnFileNew();
CPrintFram * temp=(CPrintFram*)app->m_pMainWnd;
temp->SetTitle(report.framtilte);
}
// UseAdoDlg.cpp : implementation file
//
#if !defined(AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_)
#define AFX_ADO_H__E0F8432E_F797_4979_8FB0_EAC60CA6C7F9__INCLUDED_
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "ADO.h"
#include "qidong.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.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();
// 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()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg dialog
CUseAdoDlg::CUseAdoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUseAdoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUseAdoDlg)
m_xingming = _T("");
m_xuehao = _T("");
m_chusheng = _T("");
m_dangtuan = _T("");
m_jiguan = _T("");
m_banji = _T("");
m_zhiwu = _T("");
m_minzu = _T("");
m_dizhi = _T("");
m_dianhua = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CUseAdoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUseAdoDlg)
DDX_Control(pDX, IDC_COMBO4, m_neirong);
DDX_Control(pDX, IDC_BUTTON3, m_tuichu);
DDX_Control(pDX, IDC_BUTTON2, m_chazhao);
DDX_Control(pDX, IDC_BUTMOD, m_xiugai);
DDX_Control(pDX, IDC_BUTDEL, m_shanchu);
DDX_Control(pDX, IDC_BUTCLEAR, m_qingkong);
DDX_Control(pDX, IDC_BUTADD, m_tianjia);
DDX_Control(pDX, IDC_BUTTON1, m_liulan);
DDX_Control(pDX, IDC_COMBO1, m_Combo);
DDX_Control(pDX, IDC_LIST2, m_Grid1);
DDX_Control(pDX, IDC_PICTURESHOW, m_pictureshow);
DDX_Control(pDX, IDC_LIST1, m_Grid);
DDX_Text(pDX, IDC_EDIT1, m_xingming);
DDX_Text(pDX, IDC_EDIT2, m_xuehao);
DDX_Text(pDX, IDC_EDIT4, m_chusheng);
DDX_Text(pDX, IDC_EDIT5, m_dangtuan);
DDX_Text(pDX, IDC_EDIT6, m_jiguan);
DDX_Text(pDX, IDC_EDIT7, m_banji);
DDX_Text(pDX, IDC_EDIT8, m_zhiwu);
DDX_Text(pDX, IDC_EDIT3, m_minzu);
DDX_Text(pDX, IDC_EDIT10, m_dizhi);
DDX_Text(pDX, IDC_EDIT9, m_dianhua);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUseAdoDlg, CDialog)
//{{AFX_MSG_MAP(CUseAdoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTADD, OnButadd)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BUTMOD, OnButmod)
ON_BN_CLICKED(IDC_BUTDEL, OnButdel)
ON_BN_CLICKED(IDC_BUTCLEAR, OnButclear)
ON_BN_CLICKED(IDC_BUTTON1, OnButliulan)
ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
ON_BN_CLICKED(IDC_BUTTON2, OnButchazhao)
ON_BN_CLICKED(IDC_BUTTON3, Ontuichu)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_CBN_SELCHANGE(IDC_COMBO4, OnSelchangeCombo4)
ON_BN_CLICKED(IDC_dayin, Ondayin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoDlg message handlers
BOOL CUseAdoDlg::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
// GetDlgItem(IDB_BITMAP1)->SetWindowPos(&CWnd::wndBottom,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
arrays[0] ="入库单号";
arrays[1] ="图书名称";
arrays[2] ="条形码";
arrays[3] ="作者";
arrays[4] ="出版社";
arrays[5] ="价格";
arrays[6] ="数量";
arrays[7] ="价格";
arrays[8] ="数量";
arrays[9] ="入库单号";
Cqidong dlg0;
dlg0.DoModal();
m_liulan.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_liulan))); //设置位图
m_tianjia.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tianjia))); //设置位图
m_xiugai.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_xiugai))); //设置位图
m_shanchu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_shanchu))); //设置位图
m_qingkong.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_qingkong))); //设置位图
m_chazhao.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_chazhao))); //设置位图
m_tuichu.SetBitmap(LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_tuichu))); //设置位图
m_bitmap.LoadBitmap(IDB_BITMAP1);
m_Combo.SetCurSel(0);
m_neirong.SetCurSel(-1);
m_Grid1.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid1.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid1.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid1.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid1.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid1.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid1.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid1.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid1.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid1.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid1.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
m_Grid.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_Grid.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_Grid.InsertColumn(2,"学号",LVCFMT_LEFT,110,2);
m_Grid.InsertColumn(3,"民族",LVCFMT_LEFT,110,3);
m_Grid.InsertColumn(4,"出生日期",LVCFMT_LEFT,110,4);
m_Grid.InsertColumn(5,"党/团时间",LVCFMT_LEFT,110,5);
m_Grid.InsertColumn(6,"籍贯",LVCFMT_LEFT,110,6);
m_Grid.InsertColumn(7,"班级",LVCFMT_LEFT,110,7);
m_Grid.InsertColumn(8,"职务",LVCFMT_LEFT,110,8);
m_Grid.InsertColumn(9,"固定电话",LVCFMT_LEFT,110,9);
m_Grid.InsertColumn(10,"家庭住址",LVCFMT_LEFT,110,10);
AddToGrid();
return TRUE; // return TRUE unless you set the focus to a control
}
void CUseAdoDlg::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 CUseAdoDlg::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
{
CPaintDC dc(this);
dc.DrawState(CPoint(0,0),CSize(900,700),m_bitmap,DST_BITMAP);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CUseAdoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CUseAdoDlg::AddToGrid()
{
}
void CUseAdoDlg::OnButadd()
{
}
void CUseAdoDlg::OnButdel()
{
/
}
void CUseAdoDlg::OnButliulan()
{
}
void CUseAdoDlg::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
{
/
}
void CUseAdoDlg::OnButchazhao()
{
}
void CUseAdoDlg::OnSelchangeCombo4()
{
// TODO: Add your control notification handler code here
int pos=m_neirong.GetCurSel();
m_neirong.GetLBText(pos,neirong);
}
void CUseAdoDlg::Ondayin()
{
// TODO: Add your control notification handler code here
CUseAdoApp * app=(CUseAdoApp*)AfxGetApp();
app->m_main =app->m_pMainWnd;
app->m_pMainWnd = NULL;
report.m_plist = &m_Grid;
report.verinterval = 20;
report.title = "学员信息";
report.fields = arrays;
report.lmargin = 40;
report.rmargin = 40;
report.framtilte = "打印";
app->m_pDocManager->OnFileNew();
CPrintFram * temp=(CPrintFram*)app->m_pMainWnd;
temp->SetTitle(report.framtilte);
}
#13
这是出现错误的程序
// PrintFram.cpp : implementation file
//
#include "stdafx.h"
#include "PrintFram.h"
#include "PrintView.h"
#include "UseAdoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrintFram
extern CUseAdoApp theApp;////////////////////////////错误在这
IMPLEMENT_DYNCREATE(CPrintFram, CFrameWnd)
CPrintFram::CPrintFram()
{
}
CPrintFram::~CPrintFram()
{
}
BEGIN_MESSAGE_MAP(CPrintFram, CFrameWnd)
//{{AFX_MSG_MAP(CPrintFram)
ON_WM_CREATE()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrintFram message handlers
#ifdef _DEBUG
void CPrintFram::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CPrintFram::Dump(CDumpContext &dc) const
{
CFrameWnd::Dump(dc);
}
#endif
int CPrintFram::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_ToolBar);
theApp.m_mainfram = this;
this->SetTitle(report.framtilte);
this->ShowWindow(SW_SHOWMAXIMIZED);
//this->UpdateWindow();
return 0;
}
void CPrintFram::OnClose()
{
theApp.m_mainfram = NULL;
CPrintView* temp = (CPrintView*)this->GetActiveView();
if (! temp->ispreview)
theApp.m_pMainWnd = theApp.m_main;
CFrameWnd::OnClose();
}
// PrintFram.cpp : implementation file
//
#include "stdafx.h"
#include "PrintFram.h"
#include "PrintView.h"
#include "UseAdoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrintFram
extern CUseAdoApp theApp;////////////////////////////错误在这
IMPLEMENT_DYNCREATE(CPrintFram, CFrameWnd)
CPrintFram::CPrintFram()
{
}
CPrintFram::~CPrintFram()
{
}
BEGIN_MESSAGE_MAP(CPrintFram, CFrameWnd)
//{{AFX_MSG_MAP(CPrintFram)
ON_WM_CREATE()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrintFram message handlers
#ifdef _DEBUG
void CPrintFram::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CPrintFram::Dump(CDumpContext &dc) const
{
CFrameWnd::Dump(dc);
}
#endif
int CPrintFram::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_ToolBar);
theApp.m_mainfram = this;
this->SetTitle(report.framtilte);
this->ShowWindow(SW_SHOWMAXIMIZED);
//this->UpdateWindow();
return 0;
}
void CPrintFram::OnClose()
{
theApp.m_mainfram = NULL;
CPrintView* temp = (CPrintView*)this->GetActiveView();
if (! temp->ispreview)
theApp.m_pMainWnd = theApp.m_main;
CFrameWnd::OnClose();
}
#14
// UseAdo.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.h"
//#include "Startup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp
BEGIN_MESSAGE_MAP(CUseAdoApp, CWinApp)
//{{AFX_MSG_MAP(CUseAdoApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp construction
CUseAdoApp::CUseAdoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CUseAdoApp object
CUseAdoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp initialization
BOOL CUseAdoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
m_mainfram = NULL;
CSingleDocTemplate* pDocTemplate;// 文档模板,CSingleDocTemplate是CDocManager的子类(派生类),表示单文档模板。
// 由pDocTemplate掌管Document、View、Frame三位的关系,至于RUNTIME_CLASS这个宏是用来处理动态创建对象的
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPrintDoc),
RUNTIME_CLASS(CPrintFram), // main SDI frame window
RUNTIME_CLASS(CPrintView));
AddDocTemplate(pDocTemplate);// 将文档模板添加到m_pDocManager管理的指针序列中
CUseAdoDlg dlg;
m_pMainWnd = &dlg;// // // 主窗口指针
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
//
#include "stdafx.h"
#include "UseAdo.h"
#include "UseAdoDlg.h"
#include "PrintDoc.h"
#include "PrintFram.h"
#include "PrintView.h"
//#include "Startup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp
BEGIN_MESSAGE_MAP(CUseAdoApp, CWinApp)
//{{AFX_MSG_MAP(CUseAdoApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp construction
CUseAdoApp::CUseAdoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CUseAdoApp object
CUseAdoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CUseAdoApp initialization
BOOL CUseAdoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
m_mainfram = NULL;
CSingleDocTemplate* pDocTemplate;// 文档模板,CSingleDocTemplate是CDocManager的子类(派生类),表示单文档模板。
// 由pDocTemplate掌管Document、View、Frame三位的关系,至于RUNTIME_CLASS这个宏是用来处理动态创建对象的
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPrintDoc),
RUNTIME_CLASS(CPrintFram), // main SDI frame window
RUNTIME_CLASS(CPrintView));
AddDocTemplate(pDocTemplate);// 将文档模板添加到m_pDocManager管理的指针序列中
CUseAdoDlg dlg;
m_pMainWnd = &dlg;// // // 主窗口指针
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
#15
"CUseAdoApp theApp;" 在useadoapp.cpp里面,然后
"extern CUseAdoApp theApp"写到useadoapp.h里面就可以了。
"extern CUseAdoApp theApp"写到useadoapp.h里面就可以了。
#16
谢谢大家了,我的问题解决了,是有一个头文件没定义,呵呵!少写了UseAdo.h!