本文共 2052 字,大约阅读时间需要 6 分钟。
BCGappWizard生成的应用程序特点: 1、在Stdafx.h中添加BCG的头文件 #include <BCGCBProInc.h> // BCGPro Control Bar 2、应用程序类的派生方法: class CDlgBarsApp : public CWinApp, public CBCGPWorkspace{ public:CDlgBarsApp();………… } 3、AfxEnableControlContainer(): You must call the AfxEnableControlContainer function when you use OLE control containers in Visual C++BOOL CDlgBarsApp::InitInstance() { AfxEnableControlContainer();// Standard initialization // If you are not using these features and wish to reduce the size// of your final executable, you should remove from the following// the specific initialization routines you do not need.#ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL#elseEnable3dControlsStatic(); // Call this when linking to MFC statically#endif:初始化COM库。 4、 BCGCBProCleanUp ():顾名思义吧,呵呵 对于模式对话框: CDlgBarsDlg dlg; m_pMainWnd = &dlg;int nResponse = (int) dlg.DoModal();if (nResponse == IDOK){ // TODO: Place code here to handle when the dialog is // dismissed with OK}else if (nResponse == IDCANCEL){ // TODO: Place code here to handle when the dialog is // dismissed with Cancel}BCGCBProCleanUp (); 另外:可以在应用程序类的ExitInstance()中使用。防止BCG资源内存泄漏。 5、BCG软件例子无法修改编译,这是因为BCG界面库会自动写注册表,解决: a、最笨,修改注册表 b、最简单,不让写注册表。在CxxxApp的InitInstance()中加入一句:m_bSaveState=FALSE; BOOL CDlgBarsApp::InitInstance() { AfxEnableControlContainer();// Standard initialization // If you are not using these features and wish to reduce the size// of your final executable, you should remove from the following// the specific initialization routines you do not need.#ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL#elseEnable3dControlsStatic(); // Call this when linking to MFC statically#endif// Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate// such as the name of your company or organization.m_bSaveState = FALSE; c、虽然写了,还可以这样: int CXXXApp::ExitInstance() { BCGCBProCleanUp();this->CleanState();return CWinApp::ExitInstance();} |
转载地址:http://qouli.baihongyu.com/