请教:我在 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 加入
if (!m_wndDlgBar.Create(this,IDD_MYDIALOG,CBRS_TOP | CBRS_BOTTOM ,AFX_IDW_DIALOGBAR))
{
}
nt CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
} if (!m_wndDlgBar.Create(this,IDD_MYDIALOG,CBRS_TOP | CBRS_BOTTOM ,AFX_IDW_DIALOGBAR))
{
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar); return 0;
}
编译时提示的错误是:
--------------------Configuration: Mypro31 - Win32 Debug--------------------
Compiling...
MainFrm.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Mypro31\MainFrm.cpp(70) : error C2065: 'IDD_MYDIALOG' : undeclared identifier
Error executing cl.exe.Mypro31.exe - 1 error(s), 0 warning(s)这是为什么啊?
if (!m_wndDlgBar.Create(this,IDD_MYDIALOG,CBRS_TOP | CBRS_BOTTOM ,AFX_IDW_DIALOGBAR))
{
}
nt CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
} if (!m_wndDlgBar.Create(this,IDD_MYDIALOG,CBRS_TOP | CBRS_BOTTOM ,AFX_IDW_DIALOGBAR))
{
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar); return 0;
}
编译时提示的错误是:
--------------------Configuration: Mypro31 - Win32 Debug--------------------
Compiling...
MainFrm.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Mypro31\MainFrm.cpp(70) : error C2065: 'IDD_MYDIALOG' : undeclared identifier
Error executing cl.exe.Mypro31.exe - 1 error(s), 0 warning(s)这是为什么啊?
Compiling...
MainFrm.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Mypro31\MainFrm.cpp(71) : error C2065: 'IDD_MYDIALOG' : undeclared identifier
Error executing cl.exe.Mypro31.exe - 1 error(s), 0 warning(s)
我哪里还有错误啊?谢谢!
#define IDD_MYDIALOG 123456
我刚学 VC ,您说:“你 在 资源中 添加 的对话框 ,属性(对话框上点右键) 里 ID 里 应该添的是 'IDD_MYDIALOG' ”我找不到这个地方啊?还有 #define IDD_MYDIALOG 123456这个 123456 ,是自己定义的?还是系统规定的啊?谢谢!
这个操作是想在框架上加一个对话条,没有这个对话条的模板,系统不知道怎样加!
当然#include "**.h"是一定的,如果不是一个单独的对话框类,那就参考property1 的做法.
资源 窗口是在VC窗口左边的类视图的旁边,自己找找有三个按钮排在一起的classView/resourceView/FileView就是第二个,点进去,里面有你这个程序用到的所有的资源文件,FileView 中包括你用到的所有文件. resource.h也在其中...
CSDN 真是好人多啊!