比较下面的代码:if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle()&~CBRS_BORDER_TOP);
m_wndToolBar.SetButtonInfo(m_wndToolBar.CommandToIndex(ID_TTASK), ID_TTASK,TBBS_SEPARATOR, 53);
m_wndToolBar.GetItemRect(m_wndToolBar.CommandToIndex(ID_TTASK), &rect);
if (!m_wndToolBar.m_Task.Create("任务(&T)",WS_CHILD|WS_VISIBLE ,rect, &m_wndToolBar, IDC_STASK))
{
TRACE0("Failed to create flat Button\n");
return FALSE;
}
m_wndToolBar.m_Task.ShowWindow(SW_SHOW);
//在mainfrm.h中定义class CExToolBar:public CToolBar
//m_Task是CExToolBar的flatbutton变量
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle()&~CBRS_BORDER_TOP);
m_wndToolBar.SetButtonInfo(m_wndToolBar.CommandToIndex(ID_TTASK), ID_TTASK,TBBS_SEPARATOR, 53);
m_wndToolBar.GetItemRect(m_wndToolBar.CommandToIndex(ID_TTASK), &rect);
if (!m_wndToolBar.m_Task.Create("任务(&T)",WS_CHILD|WS_VISIBLE ,rect, &m_wndToolBar, IDC_STASK))
{
TRACE0("Failed to create flat Button\n");
return FALSE;
}
m_wndToolBar.m_Task.ShowWindow(SW_SHOW);
//在mainfrm.h中定义class CExToolBar:public CToolBar
//m_Task是CExToolBar的flatbutton变量
解决方案 »
- MSN搜索框 没焦点也可以接受输入法输入
- ODBC 添加数据的问题
- 在MFC中,如何实现像Word似的,选择一块区域,让这块区域的背景显示为黑色
- VC日历控件 CMonthCalCtrl日期选择异常
- 怎样把UrlEncode 转化 gb2312??
- 关于调用底层api函数问题,在线等待
- EnterCriticalSection放在普通函数中可以吗?
- 如何做出具有搜索功能的图形显示界面?高手请进
- 字符串问题?
- vc++中编译后0 error(s), 0 warning(s),可执行时:一个或更多文件已过时!是什么原因呢?望指点!
- redcoral(宁采臣): 你用的SQL SERVER 的DB-LIBRARY的开发库*.LIB文件及*.H文件是什么版本,可否给我一份,我等着救命呀!
- 简单问题,nt\win2000的多线程性能怎么样?一个程序最多开多少线程比较合适?
"wxs2.wxs","wxs",WS_VISIBLE,CRect (10,10,30,30),&m_toolbar,ID_CONTROL,NULL,FALSE,NULL
);//创建出来了,但同时显示出错信息,faint
"wxs2.wxs","wxs",WS_VISIBLE,CRect (10,10,30,30),&m_toolbar,ID_CONTROL,NULL,FALSE,NULL
))
{
TRACE0("Failed to create Control\n");
return -1;
}
看看.
出错信息:
Debug Assertion Failed!
Program: e:\......
File:oocsite.cpp
Line:901
For information on how your program can cause an Assertion Failed..........................................
"wxs2.wxs","wxs",WS_VISIBLE,CRect (10,10,30,30),&m_toolbar,ID_CONTROL,NULL,FALSE,NULL
)句时出错。但控件已经显示在窗体上了。你走到括号里的原因可能是你的计算机里没有progID为“wxs2.wxs”控件的缘故,自己写一个控件然后再测试看看----呵呵,一定就能看到出错信息了。