BCG使用注意事项

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
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

AfxOleInit :初始化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
#else
Enable3dControlsStatic(); // 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();
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值