MSDN上写得很清楚呀!!CToolBarCtrl usually results in a smaller executable, and you may prefer to use CToolBarCtrl if you do not intend to integrate the toolbar into the MFC architecture. If you plan to use CToolBarCtrl and integrate the toolbar into the MFC architecture, you must take additional care to communicate toolbar control manipulations to MFC. This communication is not difficult; however, it is additional work that is unneeded when you use CToolBar.
—> GetDescendantWindow(AFX_IDW_TOOLBAR)
另外注释一下!
CWnd * AfxGetMainWnd()
返回值为主窗口句丙,失败为NULL
CWnd* GetDescendantWindow(int nID,bOnlyPen=FALSE)const;
返回子窗口句柄失败返回NULL,
nID 子窗口标识 bOnlyPen说明临时窗口句柄是否能返回
CToolBar * pToolBar = (CToolBar * ) AfxGetMainWnd ( )
—> GetDescendantWindow(AFX_IDW_TOOLBAR)
这里还有一点不清楚,CToolBar和CToolBarCtrl有什么区别?
有一个AFX_IDW_STATUS_BAR标识符,工具条有一个AFX_IDW_TOOLBAR标识符,
我采用静态链接方式加载DLL的,所以在EXE中没有load图片资源的语句;只是在预编译头文件中包含lib的同时包含了DLL中的那个资源头文件。DLL中的那个资源头文件是我新建的,它包含了我在DLL中新建的一个Bitmap。