| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1058 人关注过本帖
标题:[求助]成员函数问题
只看楼主 加入收藏
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
结帖率:100%
收藏
 问题点数:0 回复次数:4 
[求助]成员函数问题

图片附件: 游客没有浏览图片的权限,请 登录注册


在做管理系统的时候,我创建一个对话框,如上图:

资源属性如下:
DDX_Control(pDX, IDC_GIRD, m_Grid);//IDC_GIRD 为ID,m_Grid为成员变量,下同
DDX_Control(pDX, IDC_BUTQUERY, m_ButQuery);
DDX_CBString(pDX, IDC_COMEMBLEM, m_ComEmblem);
DDX_CBString(pDX, IDC_COMFIELD, m_ComField);
DDX_Text(pDX, IDC_EDTCONDITION, m_EdtCondition);
奇怪的是在添加 的那个查询的函数的时候,
void CDWare::OnButquery()
{
CString sField,sEmblem,sCondition,sSQL;

m_Grid.DeleAllCol();
m_ComField.GetWindowText(sField);//获取Combox,Edit里面的内容。
m_ComEmblem.GetWindowText(sEmblem);
m_EdtCondition.GetWindowText(sCondition);
//.........................

}
会出现错误提示:DeleAllCol' : is not a member of 'CListCtrl';
GetWindowTextA' : is not a member of 'CString'

以前也写过这样的,输入 m_ComField加"."后会有GetWindowText()的提示,但这次没有,出现过几次这样的情况了

还有一些关键代码帖一下;
/////////////////////////////////////////////
CToolBarCtrl m_ToolBar;
CImageList m_ImageList;
CStatusBarCtrl m_StatusBar;
UINT ID_TOOLBAR;
UINT IDS_STRING1;
UINT IDS_STATUSBAR;


///////////////////////////////////////////////

BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// 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


////////////////////////////////////////////////////////////////////////
//添加工具栏和菜单栏:
TBBUTTON button[11];
/*
typedef struct _TBBUTTON {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
DWORD dwData;
int iString;
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
typedef const TBBUTTON FAR* LPCTBBUTTON;

*/
int i=0,nStringLength;
CString string;
TCHAR *pString;
m_ImageList.Create(32,32,ILC_COLOR|ILC_MASK,0,0);//Initializes an image list and attaches it to a CImageList object.
/*
BOOL Create(
int cx,
int cy,
UINT nFlags,
int nInitial,
int nGrow
);
*/
m_ToolBar.EnableAutomation();
m_ToolBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_TOOLBAR);
//向ImageList对象中添加图标
UINT Resouce[11]={IDI_ICON1,IDI_ICON2,IDI_ICON3,IDI_ICON4,IDI_ICON5,\
IDI_ICON6,IDI_ICON7,IDI_ICON8,IDI_ICON9};
for(i=0;i<11;i++)
{
m_ImageList.Add(::LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(Resouce[i])));
}
m_ToolBar.SetImageList(&m_ImageList);
for(i=0;i<=9;i++)
{
button[i].dwData=0;//what means?
button[i].fsState=TBSTATE_ENABLED;//The button accepts user input. A button without this state does not accept user input, and is dimmed.
if(i==4||i==8)
{
button[i].fsState=TBSTYLE_SEP;

}
else
button[i].fsState=TBSTYLE_BUTTON;
button[i].iBitmap=i;//Zero-based index of the button image.


string.LoadString(i+IDS_STRING1);
//为每一个字符串加一个"\0"用于向工具栏加字符串
nStringLength=string.GetLength()+1;
pString=string.GetBufferSetLength(nStringLength);
//返回刚加的字符串编号
button[i].iString=m_ToolBar.AddStrings(pString);
string.ReleaseBuffer();
}
button[1].idCommand=ID_MENUITEM32771;
button[2].idCommand=ID_MENUITEM32774;
button[3].idCommand=ID_MENUITEM32781;
button[4].idCommand=ID_MENUITEM32775;
button[5].idCommand=ID_MENUITEM32776;
button[6].idCommand=ID_MENUITEM32777;
button[7].idCommand=ID_MENUITEM32778;
button[8].idCommand=ID_MENUITEM32779;
m_ToolBar.AddButtons(11,button);
m_ToolBar.AutoSize();
m_ToolBar.SetStyle(TBSTYLE_FLAT|CCS_TOP);
//建立状态栏
m_StatusBar.EnableAutomation();
m_StatusBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDS_STATUSBAR);
int width[3];
width[1]=150;
width[2]=500;
width[3]=200;
m_StatusBar.SetParts(4,&width[1]);
m_StatusBar.SetText("Clean_Sky Stdio",0,0);
CString StatusText,UserName;
StatusText.Format("当前用户: %s",UserName);
m_StatusBar.SetText(StatusText,0,3);


/////////////////////////////////////////////////////////////////////////


return TRUE; // return TRUE unless you set the focus to a control
}

搜索更多相关主题的帖子: 函数 IDC 成员 pDX DDX 
2007-10-15 12:57
Janlex
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:303
专家分:0
注 册:2006-9-12
收藏
得分:0 
m_Grid什么控件?

★★★★★欢迎光临我的博客 ★★★★★
http://www.
2007-10-15 14:00
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 

listControl组件


Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-10-15 16:11
Janlex
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:303
专家分:0
注 册:2006-9-12
收藏
得分:0 
m_Grid.DeleteAllItems()

[此贴子已经被作者于2007-10-15 16:48:44编辑过]



★★★★★欢迎光临我的博客 ★★★★★
http://www.
2007-10-15 16:48
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 

恩,这个可用,谢谢!


Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-10-15 17:34
快速回复:[求助]成员函数问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020353 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved