示例#1
0
int CTabCtrlSSL::AddSSLPage (LPCTSTR pszTitle, int nPageID, LPCTSTR pszTemplateName) {
	// Verify that the dialog template is compatible with CTabCtrlSSL
	// (debug builds only). If your app asserts here, make sure the dialog
	// resource you're adding to the view is a borderless child window and
	// is not marked visible.
#ifdef _DEBUG
	if (pszTemplateName != NULL) {
		BOOL bResult = CheckDialogTemplate (pszTemplateName);
		ASSERT (bResult);
	}
#endif // _DEBUG

	// Add a page to the tab control.
	// Create a modeless dialog box.
	CTabPageSSL* pDialog = new CTabPageSSL;

	if (pDialog == NULL) {
		return -1;
	}

	if (!pDialog->Create (pszTemplateName, this)) {
		pDialog->DestroyWindow ();
		delete pDialog;
		return -1;
	}
    
    TabDelete tabDelete;
    tabDelete.pTabPage = pDialog;
    tabDelete.bDelete = TRUE;

    return AddPage (pszTitle, nPageID, tabDelete);
}
示例#2
0
BOOL COXSizeDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
							  UINT nStyle, UINT nID)
{
	ASSERT(pParentWnd != NULL);
	ASSERT(lpszTemplateName != NULL);
	ASSERT((nStyle & WS_THICKFRAME)==NULL);
	
// Alas, MFC doesn't export many of the debugg-only functions, but I've added
// the code for this safety net as it helps track down errors faster, and
// only has an overhead in debug code
#ifdef _DEBUG
// dialog template must exist and be invisible with WS_CHILD set
	if (!CheckDialogTemplate(lpszTemplateName, TRUE))
	{
		ASSERT(FALSE);          // invalid dialog template name
		PostNcDestroy();        // cleanup if Create fails too soon
		return FALSE;
	}
#endif //_DEBUG

	// allow chance to modify styles
#if _MFC_VER <= 0x0421
	m_dwStyle = nStyle;
#else
    m_dwStyle = nStyle&CBRS_ALL;
#endif
	CREATESTRUCT cs;
	memset(&cs, 0, sizeof(cs));
	cs.lpszClass = _afxWndControlBar;
	cs.style = (DWORD)nStyle | WS_CHILD;
	cs.hMenu = (HMENU)(UINT_PTR)nID;
	cs.hInstance = AfxGetInstanceHandle();
	cs.hwndParent = pParentWnd->GetSafeHwnd();
	if (!PreCreateWindow(cs))
		return FALSE;
	
	// create a modeless dialog
#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = lpszTemplateName;
#endif

	// initialize common controls
	//VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));

	BOOL bSuccess = CreateDlg(lpszTemplateName, pParentWnd);

#ifndef _AFX_NO_OCC_SUPPORT
	m_lpszTemplateName = NULL;
#endif

	if (!bSuccess)
		return FALSE;
	
	// dialog template MUST specify that the dialog
	//  is an invisible child window
	SetDlgCtrlID(nID);
	CRect rect;
	
	
	// force WS_CLIPSIBLINGS
	// I also remove the titlebar. This means the resource can include a caption, which
	// will be used when the frame is floating.
	ModifyStyle(WS_CAPTION, WS_CLIPSIBLINGS);		
	if (!ExecuteDlgInit(lpszTemplateName))
		return FALSE;
	
	// m_sizeDefault isn't actually used by the COXSizeDialogBar, but since it's public, it
	// seemed sensible to keep it available. Otherwise it might be difficult to get hold
	// of the original size of the dialog (as specified in the resource file). 
	
	//GetWindowRect(&rect);
	GetClientRect(&rect);
	m_sizeDefault = rect.Size();    // set fixed size
	
	// Move to position 0,0
	// NB: size not forced to zero, as this can affect resizing if bar is 
	// immediately docked
	SetWindowPos(NULL, 0, 0, 0, 0, 
		SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_FRAMECHANGED);
	
	// set all the sizes to be the default after the positioning done above
	m_VertDockSize 	= m_sizeDefault;
	m_HorzDockSize  = m_sizeDefault;
	m_FloatSize 	= m_sizeDefault;
	
	
	// if auto-sizing, store the rectangles of all the child windows.
	if(m_Style & SZBARF_DLGAUTOSIZE)	
	{
		m_GadgetResizeHandle = CreateGadgetResizeHandle(this);
	}

	return TRUE;
}