用过bcgcontrolbar的请进,该如何处理
用过bcgcontrolbar的请进
最近用BCG16.1做界面,程序由一个exe程序和一个dll程序,exe程序显示主界面,在主界面上有一个按钮,单击它调用dll界面,问题来了,单击按钮时出现debug assertion failed如图:

点重试后,进入wincore.cpp断点情况如下:
函数实现如下:在主界面中
然后通过OnBtnOpenCFG调用dll的导出函数
在DLL中显示界面:
CParamSheet类继承BCG库中的CBCGPPropertySheet类如下:
最近用BCG16.1做界面,程序由一个exe程序和一个dll程序,exe程序显示主界面,在主界面上有一个按钮,单击它调用dll界面,问题来了,单击按钮时出现debug assertion failed如图:
点重试后,进入wincore.cpp断点情况如下:
CObject* p=NULL;
if(pMap)
{
ASSERT( (p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
}
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
}
函数实现如下:在主界面中
ON_BN_CLICKED(IDC_BTN_OPENCFG, OnBtnOpenCFG)
然后通过OnBtnOpenCFG调用dll的导出函数
void CGOTODlg::OnBtnOpenCFG()
{
HT_OpenCtrlPane();
TClose();
}
在DLL中显示界面:
CParamSheet paramSheet;
paramSheet.DoModal();
CParamSheet类继承BCG库中的CBCGPPropertySheet类如下:
CParamSheet::CParamSheet(CWnd* pParentWnd)
:CBCGPPropertySheet (IDS_CAPTION, pParentWnd)
{
BOOL b32BitIcons = globalData.bIsOSAlphaBlendingSupport;
if (globalData.m_nBitsPerPixel == 16)
{
// 32-bit icons in 16 bpp display mode
// are correctly displayed in WinXP only
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
::GetVersionEx (&osvi);
b32BitIcons = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
(osvi.dwMajorVersion > 5 ||
(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1)));
}
SetLook (CBCGPPropertySheet::PropSheetLook_OutlookBar);//PropSheetLook_OutlookBar);
SetIconsList (b32BitIcons ? IDB_SHEETICON32 : IDB_SHEETICON, 64);
AddPage(&m_nModePage);
AddPage(&m_nConfigPage);
AddPage(&m_nAlignPage);
// AddPage(&m_Page1);
m_pPrtParam = CPrinterParam::Create();
ASSERT(m_pPrtParam);
if(PRO_SEGMENT == m_pPrtParam->GetProPrinterMode())
{
m_pTemplatePage = NULL;
if(NULL != g_pTempLibInst)
{
TEMPPROC_MODELPAGE ProcAdd = NULL;
ProcAdd = (TEMPPROC_MODELPAGE)GetProcAddress(g_pTempLibInst, TEMPFUNC[TEMP_MODELPAGE]);
// If the function address is valid, call the function.
if(NULL != ProcAdd)
{
m_pTemplatePage = (ProcAdd)(m_pPrtParam->GetSystemOfUnit());
if(NULL == m_pTemplatePage)
AfxMessageBox("Temp_CreateModelPageDlg Failed");
}
else
{
AfxMessageBox("Get Temp_CreateModelPageDlg Address Failed");
}
}
AddPage(m_pTemplatePage);
}
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CParamSheet::~CParamSheet()
{
if(PRO_SEGMENT == m_pPrtParam->GetProPrinterMode())
{
if(NULL != g_pTempLibInst)
{
TEMPPROC_DELMODELPAGE ProcAdd = NULL;
ProcAdd = (TEMPPROC_DELMODELPAGE)GetProcAddress(g_pTempLibInst, TEMPFUNC[TEMP_DELMODELPAGE]);
// If the function address is valid, call the function.
if(NULL != ProcAdd)
{
BOOL bRet = (ProcAdd)();
if(FALSE == bRet)
AfxMessageBox("Temp_DeleteModelPageDlg Failed");
}
else
{
AfxMessageBox("Get Temp_DeleteModelPageDlg Address Failed");
}
}
}
if(m_pPrtParam)
m_pPrtParam->Release();
}
BEGIN_MESSAGE_MAP(CParamSheet, CBCGPPropertySheet)
//{{AFX_MSG_MAP(CParamSheet)
ON_WM_QUERYDRAGICON()
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////