我想把数据库中的数据显示出来其中用了“CListCtrl& ctrllist=(CListCtrl&)GetListCtrl();这条语句,可是编译的时候提示说D:\Code\Manage\ManageView.cpp(86) : error C2065: 'GetListCtrl' : undeclared identifier
在这个情况下要怎么处理它
在这个情况下要怎么处理它
解决方案 »
- 网页插件在vista系统下如何主动弹出uac提示框
- 怎样升级OPenGL版本?
- 关于CString与unsigned char的转换问题
- 如何修改ACCESS的字段名称
- MFC新手
- 关于COM的继承问题
- CReocrdSet为什么这么慢?做过连续insert数据库的高手请进!!!
- 我用VC编写一个数据库程序,数据库是Access,请问怎么连接,并可以取得里面的记录值!!!
- 请问Windows 2000 Professional 用不用装Services Pack?(130分!!!!!!!!!)
- 在 ATL 中如何实现 MDI 窗口?
- SHBrowseForFolder
- 大家来讨论一下!学MFC一定要将精通C++吗?
省略必要的包含文件,尤其是在定义 VC_EXTRALEAN、WIN32_LEAN_AND_MEAN 或 WIN32_EXTRA_LEAN 时。这些符号从 windows.h 和 afxv_w32.h 中排除了一些头文件以加快编译。(在 windows.h 和 afxv_w32.h 中查找排除的头文件的最新说明。)
标识符名拼写错误。
标识符使用了错误的大小写字母。
字符串常数的后面缺少右引号。
字符串常数中的换行符没有继续符:
// C2065a.cpp
#include <stdio.h>
main() {
printf("\n %s
%s // C2065, 's' : undeclared identifier
%s",
"this", "is", "it");
}
在若干行上拆分常数字符串时要特别小心。一种方法是更改格式字符串。仅由空白(空格、Tab 键、换行符)分隔的字符串被连接起来: #include <stdio.h>
main() {
printf("\n %s"
" %s"
" %s",
"this", "is", "it");
}
不太可取的一种方法是在行尾使用反斜杠。每个连续行开头处的空格成为字符串的组成部分: printf("\n %s\
%s\
%s",
"this", "is", "it");
命名空间范围不正确。例如,若要解析 ANSI C++ 标准库函数和运算符,则必须用 using 指令指定 std 命名空间。下面的示例未能编译,因为 using 指令被注释掉,并且在 std 命名空间中定义了 cout:
// C2065c.cpp
#include <iostream>
// using namespace std;
void main()
{
cout << "Hello" << endl; // C2065
}
Return Value
A reference to the list control associated with the view.Example
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate(); // this code only works for a report-mode list view
ASSERT(GetStyle() & LVS_REPORT); // Gain a reference to the list control itself
CListCtrl& theCtrl = GetListCtrl(); // Insert a column. This override is the most convenient.
theCtrl.InsertColumn(0, _T("Player Name"), LVCFMT_LEFT); // The other InsertColumn() override requires an initialized
// LVCOLUMN structure.
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Jersey Number");
col.fmt = LVCFMT_LEFT;
theCtrl.InsertColumn(1, &col); // Set reasonable widths for our columns
theCtrl.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
theCtrl.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);
}
=========================
在afxstd.h加入
#include <afxcview.h>即可