Esempio n. 1
0
void CGuiControlBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
	CRect rc;
	GetClientRect(rc);
	nDockBarAling = GetParent()->GetDlgCtrlID();
	//envie un recalculo del area cliente solo si el tamaño ha sido 
	//cambiado, de lo contrario permanezca igual
	lpwndpos->flags |= SWP_FRAMECHANGED;
	CControlBar::OnWindowPosChanged(lpwndpos);

	CWnd* pWnd = GetWindow(GW_CHILD);
	if (!m_bSupportMultiView)
	{
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(rc);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
		}
	}
	else
	{
		while (pWnd != NULL)
        {
            if (pWnd->IsWindowVisible())
			{
				pWnd->MoveWindow(rc);
				break;
			}
            pWnd=pWnd->GetWindow(GW_HWNDNEXT);
		}
	}
}
Esempio n. 2
0
void CGuiControlBar::OnSize(UINT nType, int cx, int cy)
{
//	CControlBar::OnSize(nType, cx, cy);
	CWnd* pWnd = GetWindow(GW_CHILD);
	if (!m_bSupportMultiView)
	{
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(0, 0, cx, cy);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
		}
	}
	else
	{
		while (pWnd != NULL)
        {
            if (pWnd->IsWindowVisible())
			{
				pWnd->MoveWindow(0, 0, cx, cy);
				break;
			}
            pWnd=pWnd->GetWindow(GW_HWNDNEXT);
		}
	}
	//m_pDockSite->RecalcLayout();
	// TODO: Add your message handler code here
}
Esempio n. 3
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	//if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT) ||
	//	!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	//{
	//	TRACE0("未能创建工具栏\n");
	//	return -1;      // 未能创建
	//}
	//if (!m_wndDlgBar.Create(this, IDR_MAINFRAME, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
	//{
	//	TRACE0("未能创建对话栏\n");
	//	return -1;		// 未能创建
	//}

	//if (!m_wndReBar.Create(this) || !m_wndReBar.AddBar(&m_wndToolBar) || !m_wndReBar.AddBar(&m_wndDlgBar))
	//{
	//	TRACE0("未能创建 Rebar\n");
	//	return -1;      // 未能创建
	//}

	m_wndReBar.Create(this);
	m_editUrlAddress.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 20), &m_wndReBar, 10050005);
	m_wndReBar.AddBar(&m_editUrlAddress);

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}
	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));

	// TODO: 如果不需要工具提示,则将此移除
//	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
	SetWindowText("HookCookieTest");
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE);
	SetProp(GetSafeHwnd(),"use_hook_cookie",HANDLE(1));
	CWnd * pDeskTopWnd = CWnd::GetDesktopWindow();
	CWnd *pFind = pDeskTopWnd->GetWindow(GW_CHILD);
	while(pFind)  //向所有Cookie提供者请求Cookie
	{
		if (::GetProp(pFind->GetSafeHwnd(),"hook_cookie"))
		{
			COPYDATASTRUCT stCopyData = {0};
			stCopyData.cbData = 0;
			stCopyData.lpData = NULL;
			stCopyData.dwData = WM_CD_GETCOOKIE;
			::SendMessage(pFind->GetSafeHwnd(), WM_COPYDATA, 
				reinterpret_cast<WPARAM>(GetSafeHwnd()),
				reinterpret_cast<LPARAM>(&stCopyData));
		}

		pFind = pFind->GetWindow(GW_HWNDNEXT);
	}
	SetProp(GetSafeHwnd(),"hook_cookie",HANDLE(1));
	return 0;
}
HWND FindPeraDeskClientLonginWindow( void )
{
	CWnd * pDeskTopWnd = CWnd::GetDesktopWindow();
	CWnd *pFind = pDeskTopWnd->GetWindow(GW_CHILD);
	while (pFind && pFind->m_hWnd)
	{
		if (::GetProp(pFind->m_hWnd,"PeraDeskClient_LoginWnd"))
			return pFind->m_hWnd;

		pFind = pFind->GetWindow(GW_HWNDNEXT);
	}
	return NULL;
}
Esempio n. 5
0
LRESULT CFileManagerDlg::OnNcHitTest(CPoint point)
{
  LRESULT hit = CDialogEx::OnNcHitTest(point);
  if (/*!m_bMaximized &&*/ hit == HTCLIENT) {
    CRect rtSysMenu;
    GetSysMenuRect(&rtSysMenu);
    if (rtSysMenu.PtInRect(point))
      hit = HTSYSMENU;
    else {
      CWnd *pChild = GetWindow(GW_CHILD);
      while (pChild) {
        CRect rtChild;
        pChild->GetWindowRect(&rtChild);
        if (rtChild.PtInRect(point))
          return hit;
        pChild = pChild->GetWindow(GW_HWNDNEXT);
      }
      hit = HTCAPTION;
      CRect rtClient;
      GetClientRect(&rtClient);
      ClientToScreen(&rtClient);
      CRect rtWindow;
      GetWindowRect(&rtWindow);
      if (point.x + point.y >= rtClient.right + rtClient.bottom - 10)
        hit = HTBOTTOMRIGHT;
//       else if (point.x >= rtClient.right - 5)
//         hit = HTRIGHT;

    }
  }
  return hit;
}
Esempio n. 6
0
void CPPageFileInfoClip::OnSize(UINT nType, int cx, int cy)
{
	int dx = cx - m_rCrt.Width();
	int dy = cy - m_rCrt.Height();
	GetClientRect(&m_rCrt);

	CRect r(0, 0, 0, 0);
	if (::IsWindow(m_desc.GetSafeHwnd())) {
		m_desc.GetWindowRect(&r);
		r.right += dx;
		r.bottom += dy;

		m_desc.SetWindowPos(NULL, 0, 0, r.Width(), r.Height(), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
	}

	HDWP hDWP = ::BeginDeferWindowPos(1);
	for (CWnd *pChild = GetWindow(GW_CHILD); pChild != NULL; pChild = pChild->GetWindow(GW_HWNDNEXT)) {
		if (pChild != GetDlgItem(IDC_EDIT7) && pChild != GetDlgItem(IDC_DEFAULTICON)) {
			pChild->GetWindowRect(&r);
			ScreenToClient(&r);
			r.right += dx;
			::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, 0, 0, r.Width(), r.Height(), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
		}
	}
	::EndDeferWindowPos(hDWP);
}
Esempio n. 7
0
BOOL CWizardSheet::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
	CWnd* pWnd = GetActivePage();

	if ( pWnd != NULL )
	{
		if ( GetWindowLongPtr( pWnd->GetSafeHwnd(), GWLP_USERDATA ) == TRUE )
		{
			pWnd = NULL;
		}
		else
		{
			SetWindowLongPtr( pWnd->GetSafeHwnd(), GWLP_USERDATA, TRUE );
			pWnd->SetFont( &theApp.m_gdiFont, FALSE );
			pWnd = pWnd->GetWindow( GW_CHILD );
		}
	}

	while ( pWnd != NULL )
	{
		TCHAR szName[32];

		GetClassName( pWnd->GetSafeHwnd(), szName, 32 );

		if ( _tcscmp( szName, L"Static" ) == 0 )
			pWnd->SetFont( &theApp.m_gdiFont, FALSE );
		else if ( _tcscmp( szName, L"RICHEDIT" ) != 0 )
			pWnd->SetFont( &theApp.m_gdiFont, TRUE );

		pWnd = pWnd->GetNextWindow();
	}

	return CPropertySheetAdv::OnChildNotify( message, wParam, lParam, pLResult );
}
Esempio n. 8
0
void CVendorAddView::OnInitialUpdate()
{
	CView::OnInitialUpdate();

	CString csMsg;
	csMsg.Format("%s-%s", APP_NAME, APP_MANAGER);
	AfxGetApp()->GetMainWnd()->SetWindowText(csMsg);

	CFont *pFont = g_theme.GetFont();
	if (pFont != NULL)
	{
		SetFont(pFont);
		CWnd *pw = GetWindow(GW_CHILD);
		while(pw != NULL)
		{
			pw->SetFont(pFont);
			pw = pw->GetWindow(GW_HWNDNEXT);
		};
	}

	CManagerDoc *pDoc = (CManagerDoc*)GetDocument();
	if (pDoc != NULL)
	{
		m_viewType = pDoc->m_viewType;
		if (m_viewType == VIEW_EDIT)
		{
			DisplayVendorInfo(pDoc->m_csVendorID.GetBuffer());
		}
	}

	GetDlgItem(IDC_EDIT_VENDOR_NAME)->SetFocus();
}
Esempio n. 9
0
void CPageDataReport::OnSize(UINT nType, int cx, int cy)
{
	CDialogEx::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
	if (nType == SIZE_MINIMIZED)
	{
		return;
	}

	CWnd *pWnd = NULL;
	pWnd = GetWindow(GW_CHILD);
	while (pWnd)
	{
		DWORD dwFlag = SIZE_NO_CHANGE;

		if (pWnd->GetDlgCtrlID() == IDC_LIST_QUERY)
		{
			dwFlag = SIZE_ELASTIC_X_EX | SIZE_ELASTIC_Y_EX;
		}
		else
		{
			dwFlag = SIZE_MOVE_X | SIZE_ELASTIC_X;
		}

		ChangeSize(pWnd,cx,cy,dwFlag);
		pWnd = pWnd->GetWindow(GW_HWNDNEXT);
	}

	GetClientRect(&m_rect);
}
Esempio n. 10
0
BOOL CSingleCtrl::Check()
{
	CWnd *pPrevWnd = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD);

	::CreateMutex(NULL, TRUE, m_sExeName.GetString());
	if (GetLastError() != ERROR_ALREADY_EXISTS)
		return TRUE;

	while (pPrevWnd)
	{
		if (::GetProp(pPrevWnd->GetSafeHwnd(), m_sExeName.GetString()))
		{
			TRACE("Check: %s found\r\n", m_sExeName.GetString());
			if (pPrevWnd->IsIconic()) {
				TRACE("Check: show it now\r\n");
				pPrevWnd->ShowWindow(SW_RESTORE);
			} else
				pPrevWnd->ShowWindow(SW_NORMAL);
			pPrevWnd->SetForegroundWindow();
			pPrevWnd->GetLastActivePopup()->SetForegroundWindow();
			return FALSE;
		}

		pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT);
	}

	TRACE("Could not find previous instance main window!\r\n");
	return FALSE;
}
Esempio n. 11
0
BOOL CChildToolTip::EnableToolTips(CWnd *pWnd, BOOL bEnable, BOOL UseDlgIDs)
{
	if (bEnable) {
		if (m_ToolTip != NULL)
			return(TRUE);		// already enabled, nothing to do
		m_ToolTip = new CToolTipCtrl;
		if (!m_ToolTip->Create(pWnd))
			return(FALSE);
		// iterate over our child controls, adding them to tooltip
		CWnd	*p = pWnd->GetWindow(GW_CHILD);
		while (p != NULL) {
			if (UseDlgIDs) {
				int	nID = p->GetDlgCtrlID();
				if (nID != -1) {
       				if (!m_ToolTip->AddTool(p, nID))
						return(FALSE);
				}
			} else {
       			if (!m_ToolTip->AddTool(p))
					return(FALSE);
			}	
			p = p->GetWindow(GW_HWNDNEXT);
		}
	} else {
		if (m_ToolTip == NULL)
			return(TRUE);		// already disabled, nothing to do
		delete m_ToolTip;
		m_ToolTip = NULL;
	}
	return(TRUE);
}
Esempio n. 12
0
void CPPageFileInfoRes::OnSize(UINT nType, int cx, int cy)
{
	int dx = cx - m_rCrt.Width();
	int dy = cy - m_rCrt.Height();
	GetClientRect(&m_rCrt);

	CRect r(0, 0, 0, 0);
	if (::IsWindow(m_list.GetSafeHwnd())) {
		m_list.GetWindowRect(&r);
		r.right += dx;
		r.bottom += dy;

		m_list.SetWindowPos(NULL, 0, 0, r.Width(), r.Height(), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
	}

	HDWP hDWP = ::BeginDeferWindowPos(1);
	for (CWnd *pChild = GetWindow(GW_CHILD); pChild != NULL; pChild = pChild->GetWindow(GW_HWNDNEXT)) {
		if (pChild->SendMessage(WM_GETDLGCODE) & DLGC_BUTTON) {
			pChild->GetWindowRect(&r);
			ScreenToClient(&r);
			r.top += dy;
			r.bottom += dy;
			::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, r.left, r.top, 0, 0, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
		} else if (pChild != GetDlgItem(IDC_LIST1) && pChild != GetDlgItem(IDC_DEFAULTICON)) {
			pChild->GetWindowRect(&r);
			ScreenToClient(&r);
			r.right += dx;
			::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, 0, 0, r.Width(), r.Height(), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
		}
	}
	::EndDeferWindowPos(hDWP);
}
Esempio n. 13
0
CWnd* CGuiMiniFrame::GetChildWnd()
{
	
	CWnd* pBar = GetWindow( GW_CHILD );
    if( pBar == NULL ) return NULL;
	pBar = pBar->GetWindow( GW_CHILD );
    if( pBar == NULL ) return NULL;
	return pBar;
}
Esempio n. 14
0
BOOL CConfigGeneral::OnInitDialog()
{
	char Text[64];

	CPropertyPage::OnInitDialog();

	m_bWrapCursor		= theApp.GetSettings()->General.bWrapCursor;
	m_bWrapFrames		= theApp.GetSettings()->General.bWrapFrames;
	m_bFreeCursorEdit	= theApp.GetSettings()->General.bFreeCursorEdit;
	m_bPreviewWAV		= theApp.GetSettings()->General.bWavePreview;
	m_bKeyRepeat		= theApp.GetSettings()->General.bKeyRepeat;
	m_bRowInHex			= theApp.GetSettings()->General.bRowInHex;
	m_iEditStyle		= theApp.GetSettings()->General.iEditStyle;
	m_bFramePreview		= theApp.GetSettings()->General.bFramePreview;
	m_bNoDPCMReset		= theApp.GetSettings()->General.bNoDPCMReset;
	m_bNoStepMove		= theApp.GetSettings()->General.bNoStepMove;
	m_iPageStepSize		= theApp.GetSettings()->General.iPageStepSize;
	m_bPullUpDelete		= theApp.GetSettings()->General.bPullUpDelete;
	m_bBackups			= theApp.GetSettings()->General.bBackups;
	m_bSingleInstance	= theApp.GetSettings()->General.bSingleInstance;

	m_iKeyNoteCut		= theApp.GetSettings()->Keys.iKeyNoteCut; 
	m_iKeyNoteRelease	= theApp.GetSettings()->Keys.iKeyNoteRelease; 
	m_iKeyClear			= theApp.GetSettings()->Keys.iKeyClear; 
	m_iKeyRepeat		= theApp.GetSettings()->Keys.iKeyRepeat;

	GetKeyNameText(MapVirtualKey(m_iKeyNoteCut, MAPVK_VK_TO_VSC) << 16, Text, 64);
	SetDlgItemText(IDC_KEY_NOTE_CUT, Text);
	GetKeyNameText(MapVirtualKey(m_iKeyNoteRelease, MAPVK_VK_TO_VSC) << 16, Text, 64);
	SetDlgItemText(IDC_KEY_NOTE_RELEASE, Text);
	GetKeyNameText(MapVirtualKey(m_iKeyClear, MAPVK_VK_TO_VSC) << 16, Text, 64);
	SetDlgItemText(IDC_KEY_CLEAR, Text);
	GetKeyNameText(MapVirtualKey(m_iKeyRepeat, MAPVK_VK_TO_VSC) << 16, Text, 64);
	SetDlgItemText(IDC_KEY_REPEAT, Text);

	EnableToolTips(TRUE);

	m_wndToolTip.Create(this, TTS_ALWAYSTIP);
	m_wndToolTip.Activate(TRUE);

	CWnd *pWndChild = GetWindow(GW_CHILD);
	CString strToolTip;

	while (pWndChild) {
		int nID = pWndChild->GetDlgCtrlID();
		if (strToolTip.LoadString(nID)) {
			m_wndToolTip.AddTool(pWndChild, strToolTip);
		}
		pWndChild = pWndChild->GetWindow(GW_HWNDNEXT);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 15
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_wndReBar.Create(this);
	m_editUrlAddress.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 20), &m_wndReBar, 10050005);
	m_wndReBar.AddBar(&m_editUrlAddress);


	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}
	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));

	SetWindowText("CookieUser");
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE);
	SetProp(GetSafeHwnd(),"use_hook_cookie",HANDLE(1));

	CWnd * pDeskTopWnd = CWnd::GetDesktopWindow();
	CWnd *pFind = pDeskTopWnd->GetWindow(GW_CHILD);
	while(pFind)  //向所有Cookie提供者请求Cookie
	{
		if (::GetProp(pFind->GetSafeHwnd(),"hook_cookie"))
		{
			COPYDATASTRUCT stCopyData = {0};
			stCopyData.cbData = 0;
			stCopyData.lpData = NULL;
			stCopyData.dwData = WM_CD_GETCOOKIE;
			::SendMessage(pFind->GetSafeHwnd(), WM_COPYDATA, 
				reinterpret_cast<WPARAM>(GetSafeHwnd()),
				reinterpret_cast<LPARAM>(&stCopyData));
		}

		pFind = pFind->GetWindow(GW_HWNDNEXT);
	}
	SetProp(GetSafeHwnd(),"hook_cookie",HANDLE(1));
	return 0;
}
Esempio n. 16
0
void CGuiListEdit::OnSize(UINT nType, int cx, int cy)
{
	CStatic::OnSize(nType, cx, cy);
	CWnd* pWnd = GetWindow(GW_CHILD);
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(0, 0, cx, cy);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
		}
	//m_Conta.MoveWindow(0,0,cx,cy);
	// TODO: Add your message handler code here
}
Esempio n. 17
0
CControlBar * CExtMiniDockFrameWnd::GetControlBar()
{
CWnd* pTempWnd = GetWindow( GW_CHILD );
    if( pTempWnd == NULL )
        return NULL;
	pTempWnd = pTempWnd->GetWindow( GW_CHILD );
    if( pTempWnd == NULL )
        return NULL;
    if( !pTempWnd->IsKindOf( RUNTIME_CLASS(CControlBar) ) )
        return NULL;
    return reinterpret_cast < CControlBar * >( pTempWnd );
}
Esempio n. 18
0
void CMainFrame::SyncAllRedlines( const CStdString& sDocID, const long lRow ) const
{
	for( CWnd* pChildWnd = MDIGetActive(); pChildWnd; pChildWnd = pChildWnd->GetWindow( GW_HWNDNEXT ) )
	{
		CChildFrame* const pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pChildWnd );
		if( !pChildFrame )
			continue;
		if( SyncMatchingOriginal( sDocID, lRow, pChildFrame ) )
			continue;
		if( SyncMatchingModified( sDocID, lRow, pChildFrame ) )
			continue;
	}
}
Esempio n. 19
0
void CPPageBase::CreateToolTip()
{
    m_wndToolTip.Create(this, TTS_NOPREFIX);
    m_wndToolTip.Activate(TRUE);
    m_wndToolTip.SetMaxTipWidth(300);
    m_wndToolTip.SetDelayTime(TTDT_AUTOPOP, 10000);
    for (CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT)) {
        CString strToolTip;
        if (strToolTip.LoadString(pChild->GetDlgCtrlID())) {
            m_wndToolTip.AddTool(pChild, strToolTip);
        }
    }
}
Esempio n. 20
0
//////////////////////////////////////////////////////////////////////////////////
//Function: MoveChildWindows
//
//Description: Moves all children of a parent window 
//			   by specified X and Y
//
//Paramaters:  pParent - parent window whose children are being moved.
//			   nDeltaX - amount to move children in the X direction
//			   nDeltaY - amount to move children in the Y direction
//			   fRedraw - redraw?
//
//Returns:	   VOID
//
//////////////////////////////////////////////////////////////////////////////////
void MoveChildWindows( CWnd* pParent, int nDeltaX, int nDeltaY, BOOL fRedraw )
{
	CWnd* pChild = pParent->GetWindow( GW_CHILD );
	while( pChild )
	{
		CRect	rcChild;
		pChild->GetWindowRect( &rcChild );
		pParent->ScreenToClient( &rcChild );
		rcChild.OffsetRect( nDeltaX, nDeltaY );
		pChild->MoveWindow( &rcChild, fRedraw );
		pChild = pChild->GetWindow( GW_HWNDNEXT );
	}
}
Esempio n. 21
0
int CMainFrame::GetCountMDIChildWnds() const
{
	int nCount = 0;
	CWnd* pChild = MDIGetActive();
	while( pChild )
	{
		if( dynamic_cast<CMDIChildWnd*>( pChild ) )
			nCount++;

		pChild = pChild->GetWindow( GW_HWNDNEXT );
	}
	return nCount;
}
Esempio n. 22
0
CCustomToolTipCtrl::CCustomToolTipCtrl(CWnd* pParentWnd)
  {
  ASSERT(pParentWnd);
  pParentWnd->EnableToolTips(TRUE);
  VERIFY(Create(pParentWnd));
  CWnd* w = pParentWnd->GetWindow(GW_CHILD);
  while (w)
    {
    AddTool(w);
    w = w->GetWindow(GW_HWNDNEXT);
    }
  if (GetToolCount()>0)
    Activate(TRUE);
  }
Esempio n. 23
0
CString CXTPMDIWndTab::GetChildWndText(HWND hWnd) const
{
	// Check to see if the user has defined a label for the tab first.
	CString strTitle;
	if (m_mapTabLabels.Lookup(hWnd, strTitle))
	{
		return strTitle;
	}

	// Get a pointer to the frame window.
	CMDIChildWnd* pChildFrame = (CMDIChildWnd*)CWnd::FromHandle(hWnd);
	if (!::IsWindow(pChildFrame->GetSafeHwnd()))
	{
		return _T("");
	}

	// Get the window text for the frame and use it for the tab label.
	pChildFrame->GetWindowText(strTitle);

	// If the string is empty the document's title.
	if (strTitle.IsEmpty())
	{
		CWnd* pChildWnd = pChildFrame->GetWindow(GW_CHILD);
		while (pChildWnd)
		{
			if (pChildWnd->IsKindOf(RUNTIME_CLASS(CView)))
			{
				// Get a pointer to the view's document.
				CDocument* pDoc = ((CView*)pChildWnd)->GetDocument();
				if (pDoc == NULL)
				{
					return _T("");
				}

				// Set the return string value
				strTitle = pDoc->GetTitle();

				// Reset the frames title
				pChildFrame->SetWindowText(strTitle);

				// Return the document title.
				return strTitle;
			}
			pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
		}
	}

	// Return the MDI frame window's title.
	return strTitle;
}
Esempio n. 24
0
void CPortDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);

    // TODO: 在此处添加消息处理程序代码
    CWnd *pWnd = GetWindow(GW_CHILD);
    while (pWnd)
    {
        ChangeSize(pWnd,cx,cy);
        pWnd = pWnd->GetWindow(GW_HWNDNEXT);
    }

    GetClientRect(&m_Rect);
}
Esempio n. 25
0
void CMainWindow::OnClose() {
	CWnd* child = GetWindow( GW_CHILD )->GetWindow( GW_CHILD );

	vector< CStudentEditWnd* > children;

	while ( child ) {
		if ( child->IsKindOf( RUNTIME_CLASS( CStudentEditWnd ) ) ) {
			children.push_back( (CStudentEditWnd*)child );
		}
		child = child->GetWindow( GW_HWNDNEXT );
	}

	for ( int i=0; i<children.size(); i++ ) {
		if ( !children[i]->AttemptClose() ) {
			return;
		}
	}

	if ( chooser->IsZoomed() ) {
		preferences.SetInt( "ChooserWindowState", SW_SHOWMAXIMIZED );
	} else {
		preferences.SetInt( "ChooserWindowState", SW_NORMAL );
	}
	chooser->ShowWindow( SW_NORMAL );

	if ( IsZoomed() ) {
		preferences.SetInt( "MainWindowState", SW_SHOWMAXIMIZED );
	} else {
		preferences.SetInt( "MainWindowState", SW_NORMAL );
	}
	ShowWindow( SW_NORMAL );

	CRect area;
	GetWindowRect( area );
	preferences.SetRect( "MainWindowRect", area );
	toolbar.ShowWindow( SW_HIDE );
	RecalcLayout();
	preferences.SetBool( "ShowStudentChooser", ( chooser->IsWindowVisible() ? true : false ) );
	CRect chooserArea;
	chooser->GetWindowRect( chooserArea );
	ScreenToClient( chooserArea );
	chooserArea.bottom-=2;
	chooserArea.left-=2;
	chooserArea.right-=2;
	chooserArea.top-=2;
	preferences.SetRect( "StudentChooserRect", chooserArea );
	preferences.SetInt( "CurrentSchoolYear", chooser->GetSchoolYearID() );

	CMDIFrameWnd::OnClose();
}
Esempio n. 26
0
void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
{
    UNUSED_ALWAYS(nType);
    
    if ((m_dwSCBStyle & SCBS_SIZECHILD) != 0)
    {
        // automatic child resizing - only one child is allowed
        CWnd* pWnd = GetWindow(GW_CHILD);
        if (pWnd != NULL)
        {
            pWnd->MoveWindow(0, 0, cx, cy);
            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
        }
    }
}
Esempio n. 27
0
CSizingControlBar* CSCBMiniDockFrameWnd::GetSizingControlBar()
{
    CWnd* pWnd = GetWindow(GW_CHILD); // get the dockbar
    if (pWnd == NULL)
        return NULL;
    
    pWnd = pWnd->GetWindow(GW_CHILD); // get the controlbar
    if (pWnd == NULL)
        return NULL;

    if (!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
        return NULL;

    return (CSizingControlBar*) pWnd;
}
Esempio n. 28
0
void CGuiBarOffice::UpdateChilds()
{
	CRect rc;
	GetClientRect(rc);
	CWnd* pWnd = GetWindow(GW_CHILD);
	while (pWnd != NULL)
    {
        if (pWnd->IsWindowVisible())
		{
			pWnd->MoveWindow(rc);
			break;
		}
            pWnd=pWnd->GetWindow(GW_HWNDNEXT);
	}
}
Esempio n. 29
0
void Comparisons::UpdateOpenList()
{
	CMainFrame* pMainFrame = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
	CWnd* pChild = pMainFrame->MDIGetActive();

	while (pChild)
	{
		CChildFrame* pChildFrame = DYNAMIC_DOWNCAST(CChildFrame, pChild);
		if (pChildFrame != NULL)
		{
			UpdateOpenDoc(pChildFrame->GetDocument());
		}
		pChild = pChild->GetWindow( GW_HWNDNEXT );
	}
}
Esempio n. 30
0
void common::SetWindowFont( HWND hWnd )
{
	HFONT hFont = CreateFont (16, 0, 0, 0, 0, 0, 0, 0, CHINESEBIG5_CHARSET, 0, 0, 0, 0,_T( "΢ÈíÑźÚ"));

	CFont *pFont = CFont::FromHandle(hFont);

	CWnd* pw = CWnd::FromHandle(hWnd);

	do
	{
		pw->SetFont(pFont);
		pw = pw->GetWindow(GW_HWNDNEXT);

	}while(pw != NULL);
}