Пример #1
0
void COptionsDlg::ClearCurrentPage ()
{
	CWnd * parentGroupBox = GetDlgItem (IDC_OPTIONGROUP);
	for (size_t i=0;i<m_currentPageControls.size ();i++)
	{
		CWnd *item = parentGroupBox->GetDlgItem  ( ((CWnd*)(m_currentPageControls[i].first))->GetDlgCtrlID ());
		if (item)
		{				
				if (m_currentPageControls[i].second.UIType == avocado::AvocadoOption::CHECKBOX)
				{
					CButton *obj = (CButton*)(m_currentPageControls[i].first);
					
				    bool ischek = (obj->GetCheck () > 0);

					m_currentPageControls[i].second.valueBool = ischek;

					item->DestroyWindow ();
					
					delete obj;
				}
				else if (m_currentPageControls[i].second.UIType == avocado::AvocadoOption::EDITBOX)
				{
					 int labelID = ((CWnd*)(m_currentPageControls[i].first))->GetDlgCtrlID () - 1100 + 2200;

					CWnd *labelitem = parentGroupBox->GetDlgItem  (labelID);
					
					if (labelitem)
					{
						labelitem->DestroyWindow ();
						CStatic *css = (CStatic*) labelitem;
						delete css;
					}
					CEdit *obj = (CEdit*)(m_currentPageControls[i].first);

					wchar_t buf[MAX_PATH];
					obj->GetWindowTextW (buf, MAX_PATH);
					char cbuf [MAX_PATH];
					::wcstombs (cbuf,buf,MAX_PATH);
					
					if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::STRING)
						m_currentPageControls[i].second.valueString = string (cbuf);
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::FLOAT)
					{
						stringstream ss ( cbuf);
						ss >> m_currentPageControls[i].second.valueFloat;
					}
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::BOOL)
					{
						string ss ( cbuf);
						bool bv = false;
						if (ss == "Yes")
							bv = true; else bv = false;
						m_currentPageControls[i].second.valueBool = bv;
					}
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::INT)
					{
						stringstream ss ( cbuf);
						ss >> m_currentPageControls[i].second.valueInt;
					}
Пример #2
0
BOOL CUIDialog::DestroyWindow()
{
	POSITION p = m_groups.GetHeadPosition();
	while(p)
	{
		__UIGroup *pGroup = m_groups.GetNext(p);

		// Somente deve se deletar se os controles forem
		// criados com 'new'...
		if(m_bHandleItemDelete)
		{
			POSITION p1 = pGroup->m_items.GetHeadPosition();
			while(p1)
			{
				CWnd *pItem = pGroup->m_items.GetNext(p1);
				pItem->DestroyWindow();
				delete pItem;	
			}

			pGroup->m_items.RemoveAll();
		}

		delete pGroup;
	}

	m_groups.RemoveAll();

	return CDialogEx::DestroyWindow();
}
Пример #3
0
BOOL CTaiChuQuanSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	UpdateData(FALSE);
	
	if( m_OperateID == 'M')
	   this->SetWindowText("修改除权信息");
	CWnd *pWnd = GetDlgItem(IDC_EDIT_CQDATE);
	if(!pWnd) return TRUE;

	CRect rc;
	pWnd->GetWindowRect(rc);
	pWnd->DestroyWindow(); 
	ScreenToClient(rc);
	m_DateTime.Create(WS_CHILD|WS_VISIBLE|DTS_LONGDATEFORMAT|DTS_UPDOWN,rc,this,IDC_DATETIME_1);
	
	CTime pMinRange = CTime(1988,9,1,1,1,1);
	CTime pMaxRange = CTime(2037,9,1,1,1,1);
	this->m_DateTime.SetRange( &pMinRange, &pMaxRange );


	if(m_timet!=0&&m_timet!=1)
	{
		CTime tm(m_timet);
		m_DateTime .SetTime(&tm);
	}
	GetDlgItem(IDC_RADIO_FIR)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_RADIO_SEC)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_RADIO_END)->ShowWindow(SW_HIDE);
	return TRUE;  
}
Пример #4
0
bool CDlgTKManage::InitGraphList()
{
	CWnd* pWnd = GetDlgItem(IDC_STATIC_BMP);
	if (NULL == pWnd)
	{
		return false;
	}

	DWORD dwStyle = pWnd->GetStyle();
	CRect rc;
	pWnd->GetWindowRect(rc);
	ScreenToClient(rc);

	pWnd->DestroyWindow();
	if (!m_gsView.Create(rc, this, IDC_STATIC_BMP, dwStyle))
	{
		return false;
	}

	m_gsView.SetCurDatabase(m_pDb);
	m_gsView.ShowItemCaption(false);
	m_gsView.EnableDefault(false);
	m_gsView.EnableSel(true);
	m_gsView.SetLayer(1, 1);

	m_gsView.InsertItem(0, ACDB_MODEL_SPACE);
	return true;
}
Пример #5
0
BOOL CGetURL::OnInitDialog() 
{
	CDialog::OnInitDialog();
	IUnknown *pUnk;
	
	CWnd *pWnd = GetDlgItem(IDC_EXPLORER);
	pUnk = NULL;
	if(pWnd)
		m_spBrowser = pWnd->GetControlUnknown();

	pWnd = NULL;
	CRect rcItem;
	pWnd = GetDlgItem(IDC_PHSTATIC);
	if(pWnd)
	{
		pWnd->GetClientRect(rcItem);
		pWnd->ClientToScreen(rcItem);
		pWnd->DestroyWindow();
		ScreenToClient(rcItem);
		rcItem.bottom += 150;
		if(m_AddrCombo.Create(WS_VSCROLL|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_AUTOHSCROLL,rcItem,this,IDC_ADDRCOMBO))
		{
			m_AddrCombo.SetCurSel(0);
			m_AddrCombo.GetWindowText(m_szCurAddr);
			if(m_spBrowser && m_szCurAddr.GetLength())
				m_spBrowser->Navigate(m_szCurAddr.AllocSysString(),NULL,NULL,NULL,NULL);
		}
	}
	return TRUE;
}
Пример #6
0
void PASCAL CAsyncSocket::DetachHandle(SOCKET hSocket, BOOL bDead)
{
	ASSERT(CAsyncSocket::LookupHandle(hSocket, bDead) != NULL);

	AFX_THREAD_STATE* pThreadState = AfxGetThreadState();

	if (!bDead)
	{
		pThreadState->m_mapSocketHandle.RemoveKey((void*)hSocket);
		if (pThreadState->m_mapSocketHandle.IsEmpty())
		{
			ASSERT(pThreadState->m_hSocketWindow != NULL);
			CWnd* pWnd =
				CWnd::FromHandlePermanent(pThreadState->m_hSocketWindow);
			ASSERT_VALID(pWnd);

			pWnd->DestroyWindow();
			delete pWnd;

			pThreadState->m_hSocketWindow = NULL;
			pThreadState->m_mapDeadSockets.RemoveAll();
		}
	}
	else
	{
		pThreadState->m_mapDeadSockets.RemoveKey((void*)hSocket);
	}
}
Пример #7
0
// Author & Date:   Almut Branner    12 May 2003
// Purpose: Replace this static control with this window
// Inputs:
//  rcParentWindow - the window this is going to be placed into
//  rcNewWindow - the window that is to be created
//  nControlID - the ID of the control (from the resource editor)
void ReplaceWindowControl(const CWnd &rcParentWindow, CWnd &rcNewWindow, int nControlID)
{
    CWnd *pStatic = rcParentWindow.GetDlgItem(nControlID);

    // For debug mode
    ASSERT(pStatic != 0);

    // For released code
    if (pStatic == 0)
        return;

    CRect rctWindowSize;

    DWORD frmstyle   = pStatic->GetStyle();
    DWORD frmexstyle = pStatic->GetExStyle();

    pStatic->GetWindowRect(rctWindowSize);      // Get window coord.
    rcParentWindow.ScreenToClient(rctWindowSize);              // change to client coord.
    pStatic->DestroyWindow();

    CWnd *pParent = const_cast<CWnd *>(&rcParentWindow);
    rcNewWindow.CreateEx(frmexstyle, NULL, NULL, frmstyle, rctWindowSize, pParent, nControlID);

    // Use for debugging
    // AllocConsole();
}
//@doc SECEditCtrl
//@mfunc This function should be called in the OnInitDialog handler
//for the dialog in which you want to place the SECEditCtrl.
//Note that this function destroys the window and replaces it, rather than
//just subclassing it. If you are replacing an Edit Control, you may use
//class wizard to map EN_SETFOCUS and EN_KILLFOCUS, and these notifications
//will be sent.
//@rdesc BOOL 
//@parm The ID of the control to replace
//@parm The parent window of SECEditCtrl
//@parm Extended style of the window (defaults to WS_EX_CLIENTEDGE)
//@comm dwExStyle defaults to WS_EX_CLIENTEDGE.
BOOL SECEditCtrl::Initialize(UINT nID, CWnd * pParentWnd, DWORD dwExStyle)
{
	CRect rect;
	CWnd* pWnd = pParentWnd->GetDlgItem(nID);
	pWnd->GetWindowRect(&rect);
	pParentWnd->ScreenToClient(&rect);

	// If creating dynamically, model your create call after this one
	BOOL bCreated = Create(NULL, _T("SECEdit"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 
						   rect, pParentWnd, nID);

	ASSERT(bCreated);
	if(!bCreated)
		return FALSE;

	// Set the Z-Order so this new control keeps the same tab order as the
	// control it is replacing
	SetWindowPos(pWnd, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

	// Destroy the control being replaced
	pWnd->DestroyWindow();

	// Add 3D border to control
	ModifyStyleEx(NULL, dwExStyle, SWP_FRAMECHANGED);

	return bCreated;
}
Пример #9
0
BOOL CDialogPartModify::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	UINT TargetCtrlID = IDC_STATIC;    
    CWnd *pWnd = this->GetDlgItem(IDC_STATIC);    
    CRect RectTargetCtrl;    
    pWnd->GetWindowRect(RectTargetCtrl);    
    pWnd->DestroyWindow();    
    this->ScreenToClient(RectTargetCtrl);    
  
    //在目标位置动态创建CScrollView    
    if (NULL==m_pPtModView)    
    {    
        return FALSE;    
    }   
    m_pPtModView = (CPartModifyView*)RUNTIME_CLASS(CPartModifyView)->CreateObject(); //这条语句不能少,有的教程中少了,会出错。  
    m_pPtModView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW|WS_VSCROLL|WS_HSCROLL, RectTargetCtrl, this, TargetCtrlID);    
    //使用CreateView创建的视图 不能自动调用OnInitialUpdate函数,需要人工调用OnInitialUpdate函数或者发送 WM_INITIALUPDATE消息  
    m_pPtModView->OnInitialUpdate();  
    // 使用CreateView创建的视图不会自动显示并且激活,需要人工操作   
    m_pPtModView->ShowWindow(SW_SHOW);    
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Пример #10
0
BOOL CExpBarContext::CreateControlWndEx(CWnd* pParent)
{
	if (!m_pDoc)
	{
		BOOL bSuccess = m_pExpBar->Create(CRect(0,0,50,100), pParent, 0);
		if (bSuccess)
		{
			m_EventManager.SetEvents(CEBCtrlEvents, ebLastEvent, "", CBLModule::GetExecutedModule(), this, m_pUDC);
		}
		return bSuccess;
	}else{
		CControlID* pControlID = m_pField->GetCtrlInfo();
		CWnd* pControlWnd = m_pDoc->GetFieldWnd(m_pField);
		CRect rect;
		pControlWnd->GetWindowRect(&rect);
		pParent->ScreenToClient(rect);
		
		BOOL bSuccess = m_pExpBar->Create(rect, pParent, m_pField->GetCtrlID());
		if (bSuccess)
		{
			pControlWnd->DestroyWindow();
			m_EventManager.SetEvents(CEBCtrlEvents, ebLastEvent, pControlID, m_pDoc->m_pBLModule, this, m_pUDC);
		}
		
		return bSuccess;
	}
}
Пример #11
0
/**
* \brief         Callback function which can be used to close windows during configuration switching
* \param[in]     HWND hwnd, LPARAM lParam
* \return        TRUE
* \authors       Arunkumar Karri
* \date          14.02.2013 Created
*/
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM /* lParam */)
{
    if ( hwnd )
    {
        CWnd* pWnd = CWnd::FromHandle(hwnd);
        if ( pWnd )
        {
            CRuntimeClass* pRunTimeClass = pWnd->GetRuntimeClass();

            if ( pRunTimeClass )
            {
                if ( pRunTimeClass == RUNTIME_CLASS(CEditFrameWnd) || pRunTimeClass == RUNTIME_CLASS(COutWnd) )
                {
                    /* If any function editor window is open */
                    if ( pRunTimeClass == RUNTIME_CLASS(CEditFrameWnd) )
                    {
                        CEditFrameWnd* pEditWnd = (CEditFrameWnd*)pWnd;
                        CFunctionEditorDoc* pDoc = (CFunctionEditorDoc*)pEditWnd->GetActiveDocument();

                        /* If a function editor window is modified */
                        if ( nullptr != pDoc && pDoc->IsModified() )
                        {
                            /* take confirmation from user for the first time only */
                            if ( g_bReqUserConfirmation )
                            {
                                g_bReqUserConfirmation = false;
                                INT nSelection = ::MessageBox( hwnd, _("Simulation files have been modified. Do You Want to save the Changes?"), _("Modified"), MB_YESNO | MB_ICONQUESTION);

                                switch(nSelection)
                                {
                                    case IDYES:
                                        g_bQueryConfirm = true;
                                        break;
                                    case IDNO:
                                        g_bQueryConfirm = false;
                                        break;
                                }
                            }
                            /* Based on user response, save the simulation files */
                            if ( g_bQueryConfirm )
                            {
                                if (pDoc != nullptr)
                                {
                                    pDoc->OnSaveDocument(pDoc->GetPathName());
                                }
                            }
                        }
                    }
                    /* Destroy the window */
                    pWnd->DestroyWindow();
                }
            }
        }
    }
    return TRUE;
}
BOOL CScheduleTableCfgDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // use the initial dialog size as the default minimum
    if ((m_AllowedSize.cx == 0) && (m_AllowedSize.cy == 0))
    {
        CRect rcWindow;
        GetWindowRect(rcWindow);
        m_AllowedSize = rcWindow.Size();
    }

    //AutoMove(IDCANCEL, 100.0, 100.0, 0.0, 0.0);
    // keep the initial size of the client area as a baseline for moving/sizing controls

    CRect rcTreeWnd;
    CWnd* pPlaceholderWnd = GetDlgItem(IDC_TREE_LIN_SCHEDULE);
    pPlaceholderWnd->GetWindowRect(&rcTreeWnd);
    ScreenToClient(&rcTreeWnd);

    pPlaceholderWnd->DestroyWindow();
    // create the multi-column tree window
    m_TreeWnd.CreateEx(WS_EX_CLIENTEDGE, NULL, NULL, WS_CHILD | WS_VISIBLE,
                       rcTreeWnd, this, IDC_TREE_LIN_SCHEDULE);
    CRect rect;
    m_TreeWnd.GetTreeCtrl().GetWindowRect(&rect);
    m_ouCheckTreeCtrl.Create(WS_CHILD | WS_VISIBLE | TVS_NOHSCROLL | TVS_NOTOOLTIPS,  rect, this, 1);
    m_ouCheckTreeCtrl.SubclassWindow(m_TreeWnd.GetTreeCtrl().GetSafeHwnd());

    DWORD dwStyle = GetWindowLong(m_ouCheckTreeCtrl, GWL_STYLE);
    dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_FULLROWSELECT | TVS_DISABLEDRAGDROP;
    SetWindowLong(m_ouCheckTreeCtrl, GWL_STYLE, dwStyle);
    /* Remove the style */
    m_ouCheckTreeCtrl.ModifyStyle( TVS_CHECKBOXES, 0 );
    /* Now explicitly set it */
    m_ouCheckTreeCtrl.ModifyStyle( 0, TVS_CHECKBOXES );

    if( NULL == m_ouCheckTreeCtrl )
    {
        return FALSE;
    }

    // 1. Set tree column headers
    vSetColumnHeaders();

    m_ouCheckTreeCtrl.nUpdateScheduleView();
    m_ouCheckTreeCtrl.Expand(m_ouCheckTreeCtrl.GetRootItem(), TVM_EXPAND);

    // keep the initial size of the client area as a baseline for moving/sizing controls
    CRect rcClient;
    GetClientRect(rcClient);
    m_DefaultSize = rcClient.Size();
    vMoveWindowPos(IDC_TREE_LIN_SCHEDULE, 0, 0, 100.0, 100.0);
    vMoveWindowPos(IDCLOSE, 100.0, 100.0, 0.0, 0.0);
    return TRUE;
}
Пример #13
0
CProfilerTabCtrl::~CProfilerTabCtrl()
{
	PROFILEBOXVEC::iterator listIter = m_InternalBoxes.begin();
	for (; listIter!=m_InternalBoxes.end(); listIter++)
	{
		CWnd *current = (*listIter);
		current->DestroyWindow();
		delete current;
	}
}
Пример #14
0
bool VBA::updateRenderMethod0(bool force)
{
    bool initInput = false;

    if( display != NULL) {
        if( force ) {
            toolsLoggingClose(); // close log dialog
            initInput = true;
            changingVideoSize = true;
            shutdownDisplay();
            if(input) {
                delete input;
                input = NULL;
            }
            CWnd *pWnd = m_pMainWnd;

            m_pMainWnd = NULL;
            pWnd->DragAcceptFiles(FALSE);
            pWnd->DestroyWindow();
            delete pWnd;

            display = NULL;
        }
    } else {
        display = newDirect3DDisplay();
    }

    if( preInitialize() ) {
        if( display->initialize( sizeX, sizeY ) ) {
            if( initInput ) {
                if( !this->initInput() ) {
                    changingVideoSize = false;
                    AfxPostQuitMessage(0);
                    return false;
                }
                input->checkKeys();
                updateMenuBar();
                changingVideoSize = false;
                updateWindowSize(videoOption);

                m_pMainWnd->ShowWindow(SW_SHOW);
                m_pMainWnd->UpdateWindow();
                m_pMainWnd->SetFocus();

                return true;
            } else {
                changingVideoSize = false;
                return true;
            }
        }
    }
    changingVideoSize = false;
    
    return true;
}
Пример #15
0
BOOL CQuestionnaireSettings::OnInitDialog() {
    BOOL bResult = CPropertySheet::OnInitDialog();

    DWORD dwIds[] = {IDOK,
        IDCANCEL,
        -1};

    MfcUtils::Localize(this, dwIds);

    CWnd *pApply = GetDlgItem(ID_APPLY_NOW);
    if (pApply != NULL)
        pApply->DestroyWindow();

    CWnd *pHelp = GetDlgItem(IDHELP);
    if (pHelp != NULL)
        pHelp->DestroyWindow();

    CRect rectBtn;
    int nSpacing = 6;        // space between two buttons...

    int ids [] = {IDOK, IDCANCEL};
    for (int i = 0; i < sizeof(ids)/sizeof(int); i++) {
        GetDlgItem (ids [i])->GetWindowRect (rectBtn);

        ScreenToClient (&rectBtn);
        int btnWidth = rectBtn.Width();
        rectBtn.left = rectBtn.left + (btnWidth + nSpacing)* 2;
        rectBtn.right = rectBtn.right + (btnWidth + nSpacing)* 2;

        GetDlgItem (ids [i])->MoveWindow(rectBtn);
    }

    CPropertyPage *pActivePage = GetActivePage();
    SetActivePage(m_pQuestionnaireQuestionPage);
    SetActivePage(m_pQuestionnaireOptionPage);
    SetActivePage(m_pQuestionnaireButtonPage);

    SetActivePage(pActivePage);

    return bResult;
}
Пример #16
0
void CDebuggerView::OnInitialUpdate()
{
    cdxCDynamicFormView::OnInitialUpdate();

    static bool firstTime = true;

    if (firstTime)
    {
        theApp.GetMainFrame()->Init();
        CWnd* tempWnd = GetDlgItem(IDC_DB_EDITOR);
        CRect editorRect;
        tempWnd->GetWindowRect(editorRect);

        CRect dialogRect;
        GetClientRect(dialogRect);
        ClientToScreen(dialogRect);

        editorRect.OffsetRect(-dialogRect.TopLeft());

        m_editor.Create(GetSafeHwnd(), editorRect);

//jj		m_localsGrid.CreateGrid(this, IDC_DB_LOCALS);
//jj		m_localsGrid.Init();
//jj		m_watchGrid.CreateGrid(this, IDC_DB_WATCH);
//jj		m_watchGrid.Init();
//jj		m_watchGrid.BuildWatch("Locals");

///////////		theApp.GetMainFrame()->GetWatchBar().GetGrid().BuildWatch("Locals");

//jj		AddSzControl(m_localsGrid, 100, 0, 100, 50);
//jj		AddSzControl(m_watchGrid, 100, 50, 100, 100);
//jj		AddSzControl(IDC_DB_LOCALSSTATIC, 100, 0, 100, 0);
//jj		AddSzControl(IDC_DB_WATCHSTATIC, 100, 50, 100, 50);
//		AddSzControl(m_actionList, 0, 0, 0, 50);
//		AddSzControl(m_generatedActionList, 0, 50, 0, 100);
        AddSzControl(m_editor.GetWindowHandle(), mdResize, mdResize);
//		AddSzControl(m_actionGrid->GetSafeHwnd(), mdResize, mdResize);

//		m_actionList.SetExtendedStyle(m_actionList.GetExtendedStyle() | LVS_EX_FULLROWSELECT);
//		m_actionList.InsertColumn(0, "Actions", LVCFMT_LEFT, 200);
//		m_generatedActionList.SetExtendedStyle(m_generatedActionList.GetExtendedStyle() | LVS_EX_FULLROWSELECT);
//		m_generatedActionList.InsertColumn(0, "Generated Actions", LVCFMT_LEFT, 200);

        firstTime = false;

//		m_gridActive = true;
//		::ShowWindow(m_editor.GetWindowHandle(), SW_HIDE);

        tempWnd->DestroyWindow();

        m_editor.SendEditor(SCI_SETFOCUS, 1);
    }
}
Пример #17
0
void MPCStatusBar::RemovePane(int nPaneID)
{
 SetRedraw(FALSE);
 CWnd * pwnd = NULL;
  int i;
 for( i = 0; i < m_aPans.GetSize(); i++ )
 {
  if( m_aPans[i]->m_nPaneID == nPaneID )
  {
   if( m_aPans[i]->m_bAutodelete )
    pwnd = m_aPans[i]->m_hWnd;
   delete m_aPans[i];
   m_aPans.RemoveAt(i);
   break;
  }
 }
 if( pwnd )
 {
  pwnd->DestroyWindow();
  delete pwnd;
 }

 CArray<MPCStatusBarPane,MPCStatusBarPane> arPanes;
 MPCStatusBarPane statusPane;
 i = 0;
 while( GetStatusPane(i,statusPane) )
 {
  if( statusPane.nID != (UINT)nPaneID )
   arPanes.Add( statusPane );
  i++;
 }
 // Now remove the indicator
 UINT * pIndicators = new UINT[arPanes.GetSize()];
 for(i=0;i<arPanes.GetSize();i++)
  pIndicators[i]=arPanes[i].nID;
 SetIndicators(pIndicators,arPanes.GetSize());

 // Replace infos of indicators ..
 for(i = 0; i < arPanes.GetSize(); i++ )
 {
  SetPaneInfo(i,arPanes[i].nID,arPanes[i].nStyle,arPanes[i].cxText);
  SetPaneText(i,arPanes[i].strText);
 }
 delete pIndicators;
 SetRedraw(TRUE);
 PositionControls();
 Invalidate(TRUE);

}
Пример #18
0
void CxViewExt::OnDestroy()
{
	if (m_pViewData == NULL) goto Label_CView_Destroy;

	CWnd * pWnd = reinterpret_cast < CWnd * > ( m_pViewData->m_dwExData );
	if ( pWnd == NULL ) goto Label_CView_Destroy;
	if ( ! ::IsWindow( pWnd->GetSafeHwnd() ) ) goto Label_CView_Destroy;

	pWnd->DestroyWindow();
	delete pWnd;
	m_pViewData->m_dwExData = NULL;

Label_CView_Destroy:
	CView::OnDestroy();
}
Пример #19
0
void CVCDlg::InitPropList()
{
	CRect rcPropList;
	CWnd* pWnd = GetDlgItem(IDC_OUTPUT_PROP_LIST);
	ASSERT(pWnd != NULL);
	pWnd->GetWindowRect(&rcPropList);
	ScreenToClient(&rcPropList);
	
	pWnd->DestroyWindow();
	
	if(!m_propListMgr.CreatePropList(rcPropList, this, IDC_OUTPUT_PROP_LIST))
	{
		return;
	}
}
void CVariablesGrid::CreateGrid(CWnd* parentWnd, UINT windowID)
{
	CWnd* tempWnd = parentWnd->GetDlgItem(windowID);
	CRect gridRect;
	tempWnd->GetWindowRect(gridRect);
	tempWnd->DestroyWindow();

	CRect dialogRect;
	parentWnd->GetClientRect(dialogRect);
	parentWnd->ClientToScreen(dialogRect);

	gridRect.OffsetRect(-dialogRect.TopLeft());

	Create(gridRect, parentWnd, windowID, WS_VISIBLE);
}
Пример #21
0
CMainFrame* CMainFrame::ReCreate()
{
    CWnd* pOldWnd = AfxGetApp()->m_pMainWnd;
    pOldWnd->ShowWindow(SW_HIDE);

    CMainFrame* pFrmWnd = new CMainFrame();
    pFrmWnd->LoadFrame(IDR_MAINFRAME);
    pFrmWnd->ShowWindow(SW_HIDE);
    AfxGetApp()->m_pMainWnd = pFrmWnd;

    // CAUTION: 这里会销毁 this 对象, 调用 ReCreate 后, 不要调用旧对象的方法, 而应使用 ReCreate 返回的新对象调用方法
    // CWnd::DestroyWindow 和 delete pOldWnd 有相同语义 (MFC 内部删除对象), 不要重复调用
    pOldWnd->DestroyWindow();

    return pFrmWnd;
}
Пример #22
0
CDocument* CMyDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
	if (lpszPathName == NULL)
	{
		TRACE(_T("Creating new documents is disabled.\n"));
		return NULL;
	}

	CWaitCursor wait;

	CDocument* pDocument = CreateNewDocument();
	if (pDocument == NULL)
	{
		TRACE(_T("CDocTemplate::CreateNewDocument returned NULL.\n"));
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return NULL;
	}
	ASSERT_VALID(pDocument);

	BOOL bAutoDelete = pDocument->m_bAutoDelete;
	pDocument->m_bAutoDelete = false;   // don't destroy if something goes wrong

	CWnd* pMDIChild = CreateNewMDIChild(pDocument);

	pDocument->m_bAutoDelete = bAutoDelete;
	if (pMDIChild == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return NULL;
	}
	ASSERT_VALID(pMDIChild);

	// open an existing document
	if (!pDocument->OnOpenDocument(lpszPathName))
	{
		// user has be alerted to what failed in OnOpenDocument
		TRACE(_T("CDocument::OnOpenDocument returned FALSE.\n"));
		pMDIChild->DestroyWindow();
		return NULL;
	}
	pDocument->SetPathName(lpszPathName);

	InitialUpdateMDIChild(pMDIChild, pDocument, bMakeVisible);
	return pDocument;
}
BOOL CMarmaladeNonModalOptionsDlg::OnInitDialog()
{
	__super::OnInitDialog();

	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	SetIcon(Icon16x16(IDI_MARMALADE), false);

	GetClientRect(m_rectClient);

	// Get the holder's rect and delete the frame placeholder.
	CWnd* pFrame = GetDlgItem(IDC_STATIC_FRAME);
	ASSERT(NULL != pFrame);
	pFrame->GetWindowRect(m_rectHolder);
	pFrame->DestroyWindow();
	ScreenToClient(m_rectHolder);

	if (NULL == m_pHolder)
		return FALSE;

	// Create the holder.
	m_pHolder->Create(_T(""), m_rectHolder, this);

	// Create section 1 and attach it to the holder.
	CRhRdkExpandingSection* pSection1 = new CMarmaladeOptionsSection1;
	pSection1->CreateAndAttachToHolder(m_pHolder);

	// Create section 2 and attach it to the holder.
	CRhRdkExpandingSection* pSection2 = new CMarmaladeOptionsSection2;
	pSection2->CreateAndAttachToHolder(m_pHolder);

	// Create section 3 and attach it to the holder.
	CRhRdkExpandingSection* pSection3 = new CMarmaladeOptionsSection1_Detailed;
	pSection3->CreateAndAttachToHolder(m_pHolder);

	// Create section 4 and attach it to the holder.
	CRhRdkExpandingSection* pSection4 = new CMarmaladeOptionsSection2_Detailed;
	pSection4->CreateAndAttachToHolder(m_pHolder);

	m_pHolder->SetExpertMode(false);

	const int iCheck = m_pHolder->ExpertMode();
	m_check_expert.SetCheck(iCheck);

	return FALSE;
}
Пример #24
0
BOOL CDlgCalcDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	//
	// Set the application's icon.
	//
	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	//
	// Remove the Size and Maximize commands from the system menu.
	//
	CMenu* pMenu = GetSystemMenu (FALSE);
	pMenu->DeleteMenu (SC_SIZE, MF_BYCOMMAND);
	pMenu->DeleteMenu (SC_MAXIMIZE, MF_BYCOMMAND);

	//
	// Initialize m_rect with the coordinates of the control representing
	// the calculator's output window. Then destroy the control.
	//
	CWnd* pWnd = GetDlgItem (IDC_DISPLAYRECT);
	pWnd->GetWindowRect (&m_rect);
	pWnd->DestroyWindow ();
	ScreenToClient (&m_rect);

	//
	// Initialize m_cxChar and m_cyChar with the average character width
	// and height.
	//
    TEXTMETRIC tm;
    CClientDC dc (this);
    dc.GetTextMetrics (&tm);
    m_cxChar = tm.tmAveCharWidth;
    m_cyChar = tm.tmHeight - tm.tmDescent;

	//
	// Initialize the calculator's output window and return.
	//
    DisplayXRegister ();
	return TRUE;
}
Пример #25
0
void CMlsSimpleBitmapButton::Initialize(UINT nID, CWnd* pParent)
{
	CString csText;
	TRY
	{
		CWnd* pControl = pParent->GetDlgItem(nID);
		if (pControl != NULL)
		{
			CRect crControl;
			pControl->GetWindowRect(crControl);
			pParent->ScreenToClient(crControl);
			pControl->GetWindowText(csText);
			Create(NULL, csText, pControl->GetStyle(), crControl, pParent, nID, NULL);
			SetWindowPos(pControl, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
			SetFont(pControl->GetFont());
			pControl->DestroyWindow();
		}
	}
	END_TRY
}
Пример #26
0
// ****************************************************************************
//
//  Function Name:	SubclassControl( )
//
//  Description:		Subclass control obtains the default style information
//                   from the control to subclass, and uses this to create
//                   a similar control based on CWnd, instead of the type
//                   of control in the dialog template.
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
BOOLEAN SubclassControl( CWnd* pParent, UINT nControlID, CWnd& ctlChild ) 
{
	// Get the control we're stealing...
	CWnd*	pCtl	= pParent->GetDlgItem( nControlID );
	
	CRect	rcCtl;
	CString strText ;

	//
	// Determine all the information of the control we're
	// stealing, so we can use it in the creation of the new control.
	//
	DWORD dwStyle   = pCtl->GetStyle() ;								// Style
	DWORD dwExStyle = pCtl->GetExStyle() ;								// Extended
	pCtl->GetWindowText( strText ) ;										// Window Text
	pCtl->GetWindowRect( rcCtl ) ;										// Screen Position	
	pParent->ScreenToClient( rcCtl ) ;


	BOOLEAN fResult = FALSE ;

	//
	// Create the new control with all the settings 
	// of the control we are replacing.
	//
	if (ctlChild.CreateEx( dwExStyle, NULL, strText, dwStyle, rcCtl.left, rcCtl.top, 
			rcCtl.Width(), rcCtl.Height(), pParent->m_hWnd, (HMENU) nControlID ) )
	{
		// Set the z order of the control
		ctlChild.SetWindowPos( pCtl, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE ) ;
	}

	//
	// Okay, we have everything we need so destroy 
	// the control that we are replacing.
	//
	pCtl->DestroyWindow();

	return fResult ;
}
Пример #27
0
BOOL CScriptDlg::OnInitDialog() 
{
	CExtResizableDialog::OnInitDialog();

	CRect WindowRect;
	CWnd* pSize = GetDlgItem(IDC_SCRIPT);
	pSize->GetWindowRect(&WindowRect);
	pSize->DestroyWindow();
	ScreenToClient(&WindowRect);

	m_Script.Create("Scintilla", 
					WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_BORDER, 
					WindowRect, this, 10000);
	m_Script.Init();

	SetAStyle(STYLE_DEFAULT, RGB(255, 255, 255), RGB(255, 255, 255), 10, "Courier New" );

	//////////////////////////
	// Setup Scintilla window
	//////////////////////////

	m_Script.SendMessage(SCI_SETCARETLINEBACK, RGB(240,240,255),0 ); 
	m_Script.SendMessage(SCI_SETCARETLINEVISIBLE, (long)true, 0);
	
	m_Script.ID = 0;
	m_Script.ModifyStyleEx(0,WS_EX_WINDOWEDGE,0);
	m_Script.SetFocus();

	SetPythonStyle(m_Script);

	// Remove margins to the left
	m_Help.SendMessage(SCI_SETMARGINWIDTHN, 0, 0);
	m_Help.SendMessage(SCI_SETMARGINWIDTHN, 1, 0);

	InitPythonInfo();

	m_Script.SetText(m_script);
		
	HelpMe();
	UpdateList();
	UpdateClassList();

	// Resizing
	dlgMan.Load(this->m_hWnd, "Software\\Construct\\ScriptDlg3a");
    dlgAnchor.Init(this->m_hWnd);

	dlgAnchor.Add(IDC_HELPLINE, ANCHOR_TOP | ANCHOR_LEFT | ANCHOR_RIGHT);
	dlgAnchor.Add(m_Script, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(m_Help, ANCHOR_LEFT | ANCHOR_BOTTOM | ANCHOR_RIGHT);
	dlgAnchor.Add(IDC_FUNCTIONS, ANCHOR_TOP | ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDC_CLASSES, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDOK, ANCHOR_RIGHT | ANCHOR_BOTTOM);
	dlgAnchor.Add(IDCANCEL, ANCHOR_RIGHT | ANCHOR_BOTTOM);

	// Toolbar
	m_wndToolBar.LoadToolBar(IDR_PYTHONTOOLBAR);

	CWnd::RepositionBars(0,0xFFFF,0);

	return TRUE;
}
Пример #28
0
//
// TODO: improve the performant by calculating the qep box size only one time.
void CvQueryExecutionPlanView::CalcQepBoxSize (CaSqlQueryExecutionPlanData* pTreeData)
{
	ASSERT (pTreeData);
	if (!pTreeData)
		return;
	BOOL bPreview = pTreeData->GetDisplayMode();
	if (bPreview && m_bCalSizeBoxPreview)
		return;
	if (!bPreview && m_bCalSizeBox)
		return;
	//
	// The test should be carried out to determine if it is a STAR or NORMAL.
	CWnd* pBox = NULL;
	CRect r;
	if (pTreeData->m_qepType == QEP_NORMAL)
	{
		if (bPreview)
		{
			pBox = (CuDlgQueryExecutionPlanBoxPreview*)new CuDlgQueryExecutionPlanBoxPreview ();
			((CuDlgQueryExecutionPlanBoxPreview*)pBox)->Create (IDD_QEPBOX_PREVIEW, this);
			pBox->GetWindowRect (r);
			pBox->DestroyWindow();
		}
		else
		{
			pBox = (CuDlgQueryExecutionPlanBox*)new CuDlgQueryExecutionPlanBox ();
			((CuDlgQueryExecutionPlanBox*)pBox)->Create (IDD_QEPBOX, this);
			pBox->GetWindowRect (r);
			pBox->DestroyWindow();
		}
	}
	else
	{
		if (bPreview)
		{
			pBox = (CuDlgQueryExecutionPlanBoxStarPreview*)new CuDlgQueryExecutionPlanBoxStarPreview ();
			((CuDlgQueryExecutionPlanBoxStar*)pBox)->Create (IDD_QEPBOX_STAR_PREVIEW, this);
			pBox->GetWindowRect (r);
			pBox->DestroyWindow();
		}
		else
		{
			pBox = (CuDlgQueryExecutionPlanBoxStar*)new CuDlgQueryExecutionPlanBoxStar ();
			((CuDlgQueryExecutionPlanBoxStar*)pBox)->Create (IDD_QEPBOX_STAR, this);
			pBox->GetWindowRect (r);
			pBox->DestroyWindow();
		}
	}
	if (bPreview)
	{
		pTreeData->m_sizeQepBoxPreview.cx = r.Width();
		pTreeData->m_sizeQepBoxPreview.cy = r.Height();
		m_bCalSizeBoxPreview = TRUE;
	}
	else
	{
		pTreeData->m_sizeQepBox.cx = r.Width();
		pTreeData->m_sizeQepBox.cy = r.Height();
		m_bCalSizeBox = TRUE;
	}
}
//*************************************************************************************
void CBCGPFullScreenImpl::RestoreState(CFrameWnd* pFrame) 
{
	ASSERT (m_uiFullScreenID != -1);

	if (m_uiFullScreenID == -1)
	{
		return;
	}

	// Destroy the toolbar
	CWnd*	pWnd	= m_pwndFullScreenBar->GetParentMiniFrame ();
	if (pWnd == NULL)
		pWnd	= m_pwndFullScreenBar;
	VERIFY (pWnd->DestroyWindow());

	delete m_pwndFullScreenBar; 
		
	m_pwndFullScreenBar = NULL;
	m_bFullScreen = FALSE;

	CBCGPMDIFrameWnd* pbcgMDIFrame = DYNAMIC_DOWNCAST (CBCGPMDIFrameWnd, pFrame);
		
	//Restore window pos
	pFrame->SetWindowPos (NULL, m_rectFramePrev.left, m_rectFramePrev.top,
		m_rectFramePrev.Width (), m_rectFramePrev.Height (), SWP_NOZORDER);

	//restore layout
	pFrame->SetRedraw (FALSE);

	g_pWorkspace->m_bLoadUserToolbars = FALSE;

	if (pbcgMDIFrame != NULL)
	{
		g_pWorkspace->LoadState (pbcgMDIFrame, m_strRegSection);
	}
	else
	{
		CBCGPFrameWnd* pbcgFrame = DYNAMIC_DOWNCAST (CBCGPFrameWnd, pFrame);
		if (pbcgFrame != NULL)
		{
			g_pWorkspace->LoadState (pbcgFrame, m_strRegSection);
		}
	}

	pFrame->SetRedraw (TRUE);
	pFrame->RedrawWindow (NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | 
								RDW_ERASE | RDW_ALLCHILDREN);

	if (!m_bShowMenu && m_bMenuBarWasVisible)
	{
		if (pbcgMDIFrame != NULL)
		{
			const CBCGPMenuBar* pMenuBar = pbcgMDIFrame->GetMenuBar ();

			if (pMenuBar != NULL)
			{
				pbcgMDIFrame->ShowControlBar ((CBCGPBaseControlBar*)pMenuBar, TRUE,FALSE, FALSE);
				if (pMenuBar->IsFloating ())
				{
					pbcgMDIFrame->SetFocus ();
				}
			}
		}
		else
		{
			CBCGPFrameWnd* pbcgFrame = DYNAMIC_DOWNCAST (CBCGPFrameWnd, pFrame);
			if (pbcgFrame != NULL)
			{
				const CBCGPMenuBar* pMenuBar = pbcgFrame->GetMenuBar ();
				if (pMenuBar != NULL)
				{
					pbcgFrame->ShowControlBar ((CBCGPBaseControlBar*)pMenuBar, TRUE,FALSE, FALSE);
					if (pMenuBar->IsFloating ())
					{
						pbcgFrame->SetFocus ();
					}
				}
			}
		}	
	}

	if (m_pImpl != NULL)
	{
		CBCGPMenuBar* pMenuBar = m_pImpl->GetMenuBar();
		if (pMenuBar != NULL && pMenuBar->IsPopupMode())
		{
			pMenuBar->ShowControlBar (FALSE, FALSE, FALSE);
		}
	}

	if (pbcgMDIFrame != NULL && pbcgMDIFrame->IsMDITabbedGroup ())
	{
		pbcgMDIFrame->AdjustClientArea ();
	}

	BOOL bDontCallChangeVM = FALSE;

#ifndef BCGP_EXCLUDE_RIBBON
	if (m_pImpl != NULL && 
		m_pImpl->m_pRibbonBar->GetSafeHwnd () != NULL)
	{
		if (m_pImpl->m_pRibbonBar->IsWindowVisible () &&
			m_pImpl->m_pRibbonBar->IsReplaceFrameCaption ())
		{
			m_pImpl->OnChangeVisualManager ();
			m_pImpl->m_pRibbonBar->DWMCompositionChanged ();
			
			bDontCallChangeVM = TRUE;
		}

		if (!m_pImpl->m_pRibbonBar->IsWindowVisible () &&
			pFrame->IsZoomed())
		{
			pFrame->SetWindowPos(NULL, -1, -1, -1, -1, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
		}
	}
#endif

	if (m_pImpl != NULL && !bDontCallChangeVM)
	{
		m_pImpl->OnChangeVisualManager ();
	}
}
Пример #30
0
// Create the help window.
BOOL CPmHelpWindow::Create(LPCSTR pszHelpFile, CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT uID, int nNavigationTabWidth) 
{
	// Save a pointer to the window we want to notify.
	m_hwndNotify = pParentWnd->GetSafeHwnd();

	// Create the dialog bar.
	BOOL fResult = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, uID);

	// Save our ID.
	m_uID = uID;

	// Save the width for the navigation tab.
	m_nNavigationTabWidth = nNavigationTabWidth;

	if (fResult)
	{
		// Hide the window by default. It will be shown later if needed.
		ShowWindow(SW_HIDE);

		// Clip children.
		ModifyStyle(0, WS_CLIPCHILDREN);

		// Set titlebar text (floating only)
		CString strTitle = "@@N Help";
		GetConfiguration()->ReplaceText(strTitle);
		SetWindowText(strTitle);

		// Replace the dummy control in the template with the Html Help control.
		CWnd* pOldControl = GetDlgItem(IDC_HELP_CONTROL);
		if (pOldControl != NULL)
		{
			fResult = TRUE;

			// Get the size and position of the dummy control.
			CRect crBounds;
			pOldControl->GetWindowRect(crBounds);
			ScreenToClient(crBounds);

			// Compute the sizes of the border area around the
			// help control within the dialog bar. As the dialog
			// bar is resizes, these borders sizes are retained.
			m_crBorder.left = crBounds.left;
			m_crBorder.top = crBounds.top;
			m_crBorder.right = m_sizeDefault.cx-crBounds.right;
			m_crBorder.bottom = m_sizeDefault.cy-crBounds.bottom;

			CRect crCloseButton;
			crCloseButton.SetRect(0, 0, 12, 12);	// size of bitmap
			m_btnClose.Create(crCloseButton, this, ID_VIEW_HELPWINDOW);
			m_btnClose.SetBitmaps("HELP_CLOSE_U", "HELP_CLOSE_D", pOurPal);
			m_btnClose.SetTransparentColor(RGB(255,0,255));

			// Restore the previous size of the help window.
			CRect crHelpWindow;
			CIniFile IniFile(GET_PMWAPP()->m_pszProfileName);

			// Restore the previous Expand/Contract state.
			m_fExpanded = IniFile.GetInteger("HelpWindow", "Expanded", FALSE);

			if (IniFile.GetWindowPosition("HelpWindow", NULL, NULL, crHelpWindow))
			{
				if (!crHelpWindow.IsRectEmpty())
				{
					m_sizeDefault.cx = crHelpWindow.Width();
					m_sizeDefault.cy = crHelpWindow.Height();
				}
			}

			m_czFloating = m_czDocked = m_sizeDefault;

			TRY
			{
				// Remember the name of the help.
				m_csHelpFile = pszHelpFile;
			}
			END_TRY

			if ((m_csHelpFile.IsEmpty()) || (!Util::FileExists(m_csHelpFile)))
			{
				// Can't use the help file.
				m_csHelpFile.Empty();
			}
			else
			{
				// Load the Html Help control.
				if (m_HtmlHelpControl.Load())
				{
					// Initialize all structure members to zero.
					HH_WINTYPE HHWinType;
					ZeroMemory(&HHWinType, sizeof(HHWinType));

					// Structure size in bytes.
					HHWinType.cbStruct = sizeof(HHWinType);

					// Properties of the HTML window.
					HHWinType.fsWinProperties =
						HHWIN_PROP_TRI_PANE |		// use a tri-pane window
						HHWIN_PROP_TAB_SEARCH |		// show a "Search" tab in navigation pane
						HHWIN_PROP_AUTO_SYNC |		// automatically sync contents and index
						HHWIN_PROP_TRACKING |		// send tracking notification messages
						HHWIN_PROP_NOTB_TEXT |		// no text on toolbar buttons
						HHWIN_PROP_NOTITLEBAR |		
						HHWIN_PROP_NODEF_STYLES |	// no default window styles (only HH_WINTYPE.dwStyles)
						HHWIN_PROP_NODEF_EXSTYLES;	// no default extended window styles (only HH_WINTYPE.dwExStyles)

					// Window styles.
					HHWinType.dwStyles =
						WS_VISIBLE |
						WS_CLIPSIBLINGS |
						WS_CHILD;

					// Extended window styles.
					HHWinType.dwExStyles =
						WS_EX_WINDOWEDGE;

					// Buttons on toolbar pane.
					HHWinType.fsToolBarFlags =
						HHWIN_BUTTON_EXPAND |		// expand/contract button
						HHWIN_BUTTON_BACK |			// back button
						HHWIN_BUTTON_HOME |			// home button
//						HHWIN_BUTTON_ZOOM |			// font button -- too flakey at the moment!
						HHWIN_BUTTON_PRINT;			// print button

					// Full Paths or CHM locations of various files.
					CString csInitialTopic;
					CString csHomePage;
					CString csTableOfContents;
					CString csIndex;

					TRY
					{
						csInitialTopic = "contents.htm";

						csHomePage = m_csHelpFile;
						csHomePage += "::/contents.htm";

						csTableOfContents = m_csHelpFile;
						csTableOfContents += "::/toc.hhc";

						csIndex = m_csHelpFile;
						csIndex += "::/index.hhk";
					}
					END_TRY

					HHWinType.pszFile = csInitialTopic;
					HHWinType.pszHome = csHomePage;
					HHWinType.pszToc = csTableOfContents;
					HHWinType.pszIndex = csIndex;
					
					// Expansion width of navigation pane (left pane).
					HHWinType.iNavWidth = m_nNavigationTabWidth;

					// Initial display state:
					HHWinType.nShowState = SW_RESTORE;

					// TOC should be activated.
					HHWinType.curNavType = HHWIN_NAVTYPE_TOC;

					// Position of navigation tabs.
					HHWinType.tabpos = HHWIN_NAVTAB_TOP;

					// ID to use in WPARAM in WM_NOTIFY.
					HHWinType.idNotify = m_uID;

					// Title of Help Window
					HHWinType.pszCaption= "PrintMaster 7.0 Help Window";

					// Initial state is not expanded.
					HHWinType.fNotExpanded = !m_fExpanded;

					// Indicate which fields in structure are valid.
					HHWinType.fsValidMembers =
						HHWIN_PARAM_STYLES |			// valid dwStyles
						HHWIN_PARAM_PROPERTIES |	// valid fsWinProperties
						HHWIN_PARAM_RECT |			// valid rcWindowPos
						HHWIN_PARAM_TB_FLAGS |		// valid fsToolBarFlags
						HHWIN_PARAM_NAV_WIDTH |		// valid iNavWidth
						HHWIN_PARAM_SHOWSTATE |		// valid nShowState
						HHWIN_PARAM_TABPOS |			// valid tabpos
						HHWIN_PARAM_EXPANSION |		// valid fNotExpanded
						HHWIN_PARAM_CUR_TAB;			// valid curNavType	

					// Specify the name of the new window type.
					HHWinType.pszType = PM_HELP_TYPE;

					// Allow any derived classes to modify the window type information.
					PreSetWinType(&HHWinType);

					// This call creates the new window type from the values in
					// the HH_WINTYPE structure.
					m_HtmlHelpControl.SetWinType(&HHWinType);

					// Display the default topic.
					HWND hWnd = NULL;

					CString csHelpFile;
					TRY
					{
						csHelpFile = m_csHelpFile;
						csHelpFile += ">" PM_HELP_TYPE;

						hWnd = m_HtmlHelpControl.DisplayContents(GetSafeHwnd(), csHelpFile);
					}
					END_TRY

					// If we have successfully created a new help window,
					// then get rid of the old window.
					if (hWnd != NULL)
					{
						// Get rid of the old control.
						if (pOldControl->DestroyWindow())
						{
#if 0
							// remove the "Flat" style in the toolbar
							CWnd HelpWindow;
							HelpWindow.Attach(hWnd);

							CToolBarCtrl* pToolBar = (CToolBarCtrl*)(HelpWindow.GetWindow(GW_CHILD));
							pToolBar->ModifyStyle(TBSTYLE_FLAT, 0);

							HelpWindow.Detach();
#endif
							// Signal that all the cached size information is accurate.
							m_fSizesValid = TRUE;

							fResult = TRUE;
						}
					}
				}
			}

			ASSERT(fResult);
			if (!fResult)
			{
				// We failed, clean up.
			}
		}