您的位置:C++老鼠窝编程 新闻公告 正文
 添加时间:2008-09-25 原文发表时间:2008-09-25 人气:2

本文章共6004字,分2页,当前第1页,快速翻页:
 

Hello, I've got a problem that I'm not able to cope with... I've 2 forms that connect to MySql database, and the case is that if I use CBrush and ON_WM_CTLCOLOR() message on my second form I got this error at the exit. I can change the background of the first problem without any problem. That's a SDI application and I change CurrentView with SelectView procedure (written in CMainFrm). Here's the code for the ViewClass of my second form:

#include "stdafx.h" 
#include "klienci2.h" 
#include "assignmentsView.h" 
#include "assignments_MULTI.h" 
#include "klienci2Doc.h" 
#include "OurConstants.h" 
#include "MainFrm.h" 
 
 
IMPLEMENT_DYNCREATE(CassignmentsView, CRecordView) 
 
BEGIN_MESSAGE_MAP(CassignmentsView, CRecordView) 
    ON_BN_CLICKED(IDC_POWROT, &CassignmentsView::OnPowrot) 
    ON_WM_CTLCOLOR() 
END_MESSAGE_MAP() 
 
CassignmentsView::CassignmentsView():CRecordView(CassignmentsView::IDD),m_pSet(NULL) 
, m_koszty(0) 
    m_brBrush.CreateSolidBrush(RGB(255, 255, 255)); 
 
 
 
#ifdef DEBUG 
void CassignmentsView::AssertValid() const 
    CRecordView::AssertValid(); 
void CassignmentsView::Dump(CDumpContext& dc) const 
    CRecordView::Dump(dc); 
#endif //DEBUG 
 
void CassignmentsView::DoDataExchange(CDataExchange *pDX) 
    CRecordView::DoDataExchange(pDX); 
    m_koszty=0
    m_pSet->MoveFirst(); 
    while(!m_pSet->IsEOF()) 
    { 
        m_koszty+=m_pSet->m_tariffsvalue; 
        m_pSet->MoveNext(); 
    } 
    m_koszty+=m_pSet->m_tariffsvalue; 
    DDX_Text(pDX, IDC_KOSZTY, m_koszty); 
 
Cassignments_MULTI* CassignmentsView::GetRecordset() 
    ASSERT(m_pSet != NULL); 
    return m_pSet; 
 
CRecordset* CassignmentsView::OnGetRecordset() 
    return m_pSet; 
 
void CassignmentsView::OnInitialUpdate() 
    //GetDlgItem(IDC_STATIC1)->ShowWindow(FALSE); 
    BeginWaitCursor(); 
    Cklienci2Doc* pDoc = static_cast<Cklienci2Doc*>(GetDocument()); 
    m_pSet= &pDoc->m_assignmentsMULTI; 
    m_pSet->m_pDatabase=pDoc->m_klienci2Set.m_pDatabase; 
    m_pSet->m_CustomerIDparam= pDoc->m_klienci2Set.m_id; 
    m_pSet->m_strFilter= "[assignments].[customerid]=? AND [assignments].[tariffid]=[tariffs].[id]"
    CRecordView::OnInitialUpdate(); 
    EndWaitCursor(); 
 
 
void CassignmentsView::OnPowrot() 
    // TODO: Add your control notification handler code here 
    static_cast<CMainFrame*>(GetParentFrame())->SelectView(KLIENCI2_VIEW); 
 
void CassignmentsView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) 
     
    // TODO: Add your specialized code here and/or call the base class 
    if (bActivate) 
    { 
        Cklienci2Doc* pDoc = GetDocument(); 
        CMainFrame* pMFramestatic_cast<CMainFrame*>(GetParentFrame()); 
        if (pMFrame->m_CurrentViewID==KLIENCI2_VIEW) 
        { 
            if(!m_pSet->IsOpen()) 
                return; 
            m_pSet->m_CustomerIDparam=pDoc->m_klienci2Set.m_id; 
            m_pSet->Requery(); 
            if(m_pSet->IsEOF()) 
                    AfxMessageBox(L" Brak zobowiązań klienta"); 
        } 
        CString strTitle=_T("Table Name; "); 
        CString strTable=m_pSet->GetTableName(); 
        if(!strTable.IsEmpty()) 
            strTitle+=strTable; 
        else 
            strTitle+=_T("Orders - Multiple Tables"); 
        pDoc->SetTitle(strTitle); 
        CRecordView::OnInitialUpdate(); 
    } 
    CRecordView::OnActivateView(bActivate, pActivateView, pDeactiveView); 
 
 
BOOL CassignmentsView::PreCreateWindow(CREATESTRUCT& cs) 
    // TODO: Add your specialized code here and/or call the base class 
 
    return CRecordView::PreCreateWindow(cs); 
 
HBRUSH CassignmentsView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)  
    return m_brBrush; 

 
本文章更多内容1 - 2 - 下一页>>
本页地址
相关文章

_CrtIsValidHeapPointer fails on globally
_ASSERTE(_CrtIsValidHeapPointer(pUserDat
VC Debug中“please enter the path for mf
afxcontextisDLL表示什么意思呢?
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
C++ sizeof 祥解
直接通过ODBC读写Excel表格文件
VC++ 中的ODBC 编程
vc 在ODBC 中应用DDX 和 RFX
ODBC中的同步与异步执行模式

相关评论


本文章所属分类:首页 新闻公告