本文整理汇总了C++中ASSERT_KINDOF函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_KINDOF函数的具体用法?C++ ASSERT_KINDOF怎么用?C++ ASSERT_KINDOF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_KINDOF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT_KINDOF
// walk up two parents for MDIFrame that owns MDIChild (skip MDIClient)
CMDIFrameWnd* CMDIChildWnd::GetMDIFrame()
{
ASSERT_KINDOF(CMDIChildWnd, this);
ASSERT(m_hWnd != NULL);
HWND hWndMDIClient = ::GetParent(m_hWnd);
ASSERT(hWndMDIClient != NULL);
CMDIFrameWnd* pMDIFrame;
pMDIFrame = (CMDIFrameWnd*)CWnd::FromHandle(::GetParent(hWndMDIClient));
ASSERT(pMDIFrame != NULL);
ASSERT_KINDOF(CMDIFrameWnd, pMDIFrame);
ASSERT(pMDIFrame->m_hWndMDIClient == hWndMDIClient);
ASSERT_VALID(pMDIFrame);
return pMDIFrame;
}
示例2: GetScrollPos
void CLibraryMetaPanel::OnLButtonUp(UINT nFlags, CPoint point)
{
point.y += GetScrollPos( SB_VERT );
if ( m_nSelected > 0 && m_rcFolder.PtInRect( point ) )
{
CQuickLock oLock( Library.m_pSection );
if ( CLibraryFolder* pFolder = LibraryFolders.GetFolder( m_sFolder ) )
{
if ( Settings.Library.ShowVirtual )
{
CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
ASSERT_KINDOF(CLibraryFrame, pFrame );
pFrame->Display( pFolder );
}
else if ( LibraryFolders.CheckFolder( pFolder, TRUE ) )
{
ShellExecute( AfxGetMainWnd()->GetSafeHwnd(), NULL,
m_sFolder, NULL, NULL, SW_SHOWNORMAL );
}
}
}
else if ( m_nSelected > 0 && m_rcRating.PtInRect( point ) )
{
CLibraryListPtr pList( GetViewSelection() );
if ( pList && pList->GetCount() > 0 )
{
CFilePropertiesSheet dlg;
dlg.Add( pList );
dlg.DoModal( 2 );
}
}
else if ( CMetaItem* pItem = m_pMetadata->HitTest( point, TRUE ) )
{
CQuickLock oLock( Library.m_pSection );
if ( CAlbumFolder* pFolder = pItem->GetLinkTarget() )
{
CLibraryFrame* pFrame = (CLibraryFrame*)GetOwner();
ASSERT_KINDOF(CLibraryFrame, pFrame );
pFrame->Display( pFolder );
}
}
CPanelCtrl::OnLButtonUp( nFlags, point );
}
示例3: ASSERT
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
ASSERT(pContext != NULL && pContext->m_pNewViewClass != NULL);
if (!splitter_.CreateStatic(this, 1, 5))
{
AfxMessageBox("Failed to create splitter.");
return FALSE;
}
// We create with 5 columns then delete all except one, which means only one (for
// hex view) is shown but 4 more can be added (template, aerial, preview and compare views).
splitter_.DelColumn(4);
splitter_.DelColumn(3);
splitter_.DelColumn(2);
splitter_.DelColumn(1);
if (!splitter_.CreateView(0, 0, RUNTIME_CLASS(CHexTabView), CSize(0, 0), pContext))
{
AfxMessageBox("Failed to create splitter view.");
return FALSE;
}
ptv_ = (CHexTabView *)splitter_.GetPane(0, 0);
ASSERT_KINDOF(CHexTabView, ptv_);
return TRUE;
}
示例4: ASSERT_VALID
STDMETHODIMP COleUILinkInfo::UpdateLink(
DWORD dwLink, BOOL /*fErrorMessage*/, BOOL /*fErrorAction*/)
{
COleClientItem* pItem = (COleClientItem*)dwLink;
ASSERT_VALID(pItem);
ASSERT_KINDOF(COleClientItem, pItem);
SCODE sc;
TRY
{
// link not up-to-date, attempt to update it
if (!pItem->UpdateLink())
AfxThrowOleException(pItem->GetLastStatus());
pItem->m_bLinkUnavail = FALSE;
sc = S_OK;
}
CATCH_ALL(e)
{
pItem->m_bLinkUnavail = TRUE;
sc = COleException::Process(e);
pItem->ReportError(sc);
DELETE_EXCEPTION(e);
}
END_CATCH_ALL
return sc;
}
示例5: ASSERT_VALID
//////////////////
// Handle WM_NCACTIVATE for main window
//
BOOL CCaptionPainter::OnNcActivate(BOOL bActive)
{
ASSERT_VALID(m_pParentDlg);
CDialog& dlg = *((CDialog*)m_pParentDlg);
ASSERT_KINDOF(CDialog, &dlg);
/* // Turn WS_VISIBLE off before calling DefWindowProc,
// so DefWindowProc won't paint and thereby cause flicker.
//
DWORD dwStyle = dlg.GetStyle();
if (dwStyle & WS_VISIBLE)
::SetWindowLong(dlg, GWL_STYLE, (dwStyle & ~ WS_VISIBLE));
MSG& msg = AfxGetThreadState()->m_lastSentMsg;
msg.wParam = bActive;
Default();
if (dwStyle & WS_VISIBLE)
::SetWindowLong(frame, GWL_STYLE, dwStyle);
*/
// At this point, nothing has happened (since WS_VISIBLE was off).
// Now it's time to paint.
//
m_bActive = bActive; // update state
dlg.SendMessage(WM_NCPAINT); // paint non-client area (frame too)
return TRUE; // done OK
}
示例6: ASSERT_KINDOF
LRESULT COleIPFrameWnd::OnResizeChild(WPARAM, LPARAM lParam)
{
// notify the container that the rectangle has changed!
COleServerDoc* pDoc = (COleServerDoc*)GetActiveDocument();
if (pDoc == NULL)
return 0;
ASSERT_KINDOF(COleServerDoc, pDoc);
// get new rect and parent
CRect rectNew;
rectNew.CopyRect((LPCRECT)lParam);
CWnd* pParentWnd = GetParent();
ASSERT_VALID(pParentWnd);
// convert rectNew relative to pParentWnd
ClientToScreen(&rectNew);
pParentWnd->ScreenToClient(&rectNew);
// adjust the new rectangle for the current control bars
CWnd* pLeftOver = GetDlgItem(AFX_IDW_PANE_FIRST);
ASSERT(pLeftOver != NULL);
CRect rectCur = m_rectPos;
pLeftOver->CalcWindowRect(&rectCur, CWnd::adjustOutside);
rectNew.left += m_rectPos.left - rectCur.left;
rectNew.top += m_rectPos.top - rectCur.top;
rectNew.right -= rectCur.right - m_rectPos.right;
rectNew.bottom -= rectCur.bottom - m_rectPos.bottom;
OnRequestPositionChange(rectNew);
return 0;
}
示例7: ASSERT_KINDOF
BOOL CGlobalObj::bOpenFunctioneditorfile(CString omStrNewCFileName)
{
BOOL bFileFound = TRUE;
CFunctionEditorDoc* pDoc = CFunctionEditorBase::pCreateNewDocument(m_eBus);
// file-attribute information
if (pDoc != nullptr)
{
CEditFrameWnd::sm_eBus = m_eBus;
struct _tfinddata_t fileinfo;
// Check if file exists
if (_tfindfirst( omStrNewCFileName.GetBuffer(MAX_PATH), &fileinfo) == -1L)
{
bFileFound = pDoc->bCreateNewDocument(omStrNewCFileName);
}
if (bFileFound == TRUE)
{
//// Now open the selected file
pDoc->OnOpenDocument(omStrNewCFileName);
CMultiDocTemplate* pTemplate = m_pEditorDocTemplate;
m_pEditFrameWnd = (CEditFrameWnd*)(pTemplate->CreateNewFrame(pDoc, nullptr));
//If null is passed as parameter the m_pdoc->GetNextView(pos) will
// give null value
if (m_pEditFrameWnd != nullptr)
{
ASSERT_KINDOF(CEditFrameWnd, m_pEditFrameWnd);
pTemplate->InitialUpdateFrame(m_pEditFrameWnd, /*nullptr*/pDoc);
}
}
}
return bFileFound;
}
示例8: ASSERT_VALID
void CBasePropertySheet::AddPage(CPropertyPage* pPage)
{
ASSERT_VALID(this);
ASSERT(pPage != NULL);
ASSERT_KINDOF(CPropertyPage, pPage);
ASSERT_VALID(pPage);
// add page to internal list
m_pages.Add(pPage);
// add page externally
if (m_hWnd != NULL)
{
// build new prop page array
AFX_OLDPROPSHEETPAGE *ppsp = new AFX_OLDPROPSHEETPAGE[m_pages.GetSize()];
memcpy(ppsp, m_psh.ppsp, sizeof(AFX_OLDPROPSHEETPAGE) * (m_pages.GetSize()-1));
delete[] (PROPSHEETPAGE*)m_psh.ppsp;
m_psh.ppsp = (PROPSHEETPAGE*)ppsp;
ppsp += m_pages.GetSize()-1;
// copy processed PROPSHEETPAGE struct to end
memcpy(ppsp, &pPage->m_psp, sizeof(pPage->m_psp));
// pPage->PreProcessPageTemplate((PROPSHEETPAGE&)*ppsp, IsWizard());
CPropertyPage_PreProcessPageTemplate((_CCPropertyPage*)pPage, (PROPSHEETPAGE&)*ppsp, IsWizard());
HPROPSHEETPAGE hPSP = CreatePropertySheetPage((PROPSHEETPAGE*)ppsp);
if (hPSP == NULL)
AfxThrowMemoryException();
if (!SendMessage(PSM_ADDPAGE, 0, (LPARAM)hPSP))
{
DestroyPropertySheetPage(hPSP);
AfxThrowMemoryException();
}
}
}
示例9: OutputDebugString
CBenubirdAutoProxy::CBenubirdAutoProxy()
{
g_strDBG.Empty();
g_strDBG.Format(_T("------------------------------------- start AutoProxy %X"),this);
OutputDebugString(g_strDBG);
EnableAutomation();
// To keep the application running as long as an automation
// object is active, the constructor calls AfxOleLockApp.
AfxOleLockApp();
// Get access to the dialog through the application's
// main window pointer. Set the proxy's internal pointer
// to point to the dialog, and set the dialog's back pointer to
// this proxy.
ASSERT_VALID(AfxGetApp()->m_pMainWnd);
if (AfxGetApp()->m_pMainWnd)
{
ASSERT_KINDOF(CMainFrame, AfxGetApp()->m_pMainWnd);
if (AfxGetApp()->m_pMainWnd->IsKindOf(RUNTIME_CLASS(CMainFrame)))
{
m_pDialog = reinterpret_cast<CMainFrame*>(AfxGetApp()->m_pMainWnd);
m_pDialog->m_pAutoProxy = this;
}
}
}
示例10: ASSERT_VALID
void CListViewWalkerPropertySheet::InsertPage(int iIndex, CPropertyPage* pPage)
{
ASSERT_VALID( this );
ASSERT( pPage != NULL );
ASSERT_KINDOF( CPropertyPage, pPage );
ASSERT_VALID( pPage );
m_pages.InsertAt(iIndex, pPage);
BuildPropPageArray();
if (m_hWnd != NULL)
{
PROPSHEETPAGE* ppsp = const_cast<PROPSHEETPAGE*>(m_psh.ppsp);
for (UINT i = 0; i < m_psh.nPages; i++) {
if (i == (UINT)iIndex)
break;
(BYTE*&)ppsp += ppsp->dwSize;
}
HPROPSHEETPAGE hPSP = CreatePropertySheetPage(ppsp);
if (hPSP == NULL)
AfxThrowMemoryException();
if (!SendMessage(PSM_INSERTPAGE, iIndex, (LPARAM)hPSP)) {
DestroyPropertySheetPage(hPSP);
AfxThrowMemoryException();
}
}
}
示例11: GetFirstViewPosition
void CServerDoc::OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect)
{
// get first view of document
POSITION pos = GetFirstViewPosition();
ASSERT(pos != NULL);
CServerView* pView = (CServerView*)GetNextView(pos);
ASSERT_KINDOF(CServerView, pView);
ASSERT_VALID(pView);
CSize sizeNum(lpPosRect->right - lpPosRect->left,
lpPosRect->bottom - lpPosRect->top);
// for denom -- get extent in device
// create a view dc
CServerDC dc(pView);
// set zoom to 100%
dc.SetViewportExt(CSize(1,1));
dc.SetWindowExt(CSize(1,1));
// get extents in device
CSize sizeDenom = pView->CalcActualItemSize(m_pRoot, &dc);
// notify first view of potential zoom factor change!
pView->SetZoomFactor(sizeNum, sizeDenom);
// resize the window
COleServerDoc::OnSetItemRects(lpPosRect, lpClipRect);
// set scrollbar state (if necessary)
pView->SetScrollInfo();
}
示例12: ASSERT_KINDOF
/////////////////////////////////////////////////////////////////////////////
// CNewProjectEndPage message handlers
BOOL CNewProjectEndPage::OnSetActive()
{
CPropertySheet* pSheet = (CPropertySheet*)GetParent();
ASSERT_KINDOF(CPropertySheet, pSheet);
pSheet->SetWizardButtons(PSWIZB_FINISH);
return CPropertyPageEx::OnSetActive();
}
示例13: sizeof
void CDrawObj::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if (ar.IsStoring())
{
ar << m_position;
ar << (WORD)m_bPen;
ar.Write(&m_logpen, sizeof(LOGPEN));
ar << (WORD)m_bBrush;
ar.Write(&m_logbrush, sizeof(LOGBRUSH));
}
else
{
// get the document back pointer from the archive
m_pDocument = (CDrawDoc*)ar.m_pDocument;
ASSERT_VALID(m_pDocument);
ASSERT_KINDOF(CDrawDoc, m_pDocument);
WORD wTemp;
ar >> m_position;
ar >> wTemp; m_bPen = (BOOL)wTemp;
ar.Read(&m_logpen,sizeof(LOGPEN));
ar >> wTemp; m_bBrush = (BOOL)wTemp;
ar.Read(&m_logbrush, sizeof(LOGBRUSH));
}
}
示例14: ASSERT_VALID
BOOL CBCGPDropDownToolBar::OnSendCommand(const CBCGPToolbarButton* pButton)
{
ASSERT_VALID (pButton);
if ((pButton->m_nStyle & TBBS_DISABLED) != 0 ||
pButton->m_nID == 0 || pButton->m_nID == (UINT)-1)
{
return FALSE;
}
CBCGPDropDownFrame* pParent = (CBCGPDropDownFrame*)GetParent();
ASSERT_KINDOF(CBCGPDropDownFrame, pParent);
pParent->m_pParentBtn->SetDefaultCommand (pButton->m_nID);
//----------------------------------
// Send command to the parent frame:
//----------------------------------
CFrameWnd* pParentFrame = GetParentFrame ();
ASSERT_VALID (pParentFrame);
GetOwner()->PostMessage(WM_COMMAND, pButton->m_nID);
pParentFrame->DestroyWindow ();
return TRUE;
}
示例15: ASSERT_KINDOF
BOOL CLicenseDlg::OnSetActive()
{
if (!CheckWindowsVersion()) {
CPropertyPage::EndDialog(IDCANCEL);
}
CPropertySheet* pSheet = (CPropertySheet*)GetParent();
ASSERT_KINDOF(CPropertySheet, pSheet);
if (m_FirstTime) {
m_FirstTime = FALSE;
// Disable everything until the user scrolls the license text
CButton *radio_all = (CButton *) GetDlgItem(IDC_DISAGREE);
radio_all->SetCheck(1);
CButton *understand = (CButton *) GetDlgItem(IDC_UNDERSTAND);
understand->SetCheck(BST_UNCHECKED);
OnUnderstand();
understand->EnableWindow(FALSE);
pSheet->SetWizardButtons(0);
UpdateData(FALSE); // write to screen
} else {
pSheet->SetWizardButtons(PSWIZB_NEXT);
}
return CPropertyPage::OnSetActive();
}