コード例 #1
0
ファイル: TechsView.cpp プロジェクト: maerson/mystkproj
void CTechsView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here
	CTreeCtrl &treectrl = GetTreeCtrl();
	HTREEITEM	hItem	=	treectrl.GetSelectedItem();
	CString	strText	=	treectrl.GetItemText(hItem);
	
	if( NULL != hItem )
	{
		UINT	nTech	=	treectrl.GetItemData(hItem);
		if( (nTech >= STT_MIN && nTech <= STT_MAX) || nTech >= STT_USER_MIN )
		{
			AfxGetProfile().ShowGraphViewTech( nTech );
			CGraphView * pGraphView = AfxGetGraphView();
			CView * pActiveView = AfxGetStaticDoc()->GetActiveView();
			if( pGraphView )
				pGraphView->ResetClientRect( );
			if( pGraphView && pGraphView->GetSafeHwnd() == pActiveView->GetSafeHwnd() )
				pGraphView->Invalidate();
			else
				AfxSwitchToStaticView( RUNTIME_CLASS(CGraphView) );
			SetFocus( );
		}
	}
	
	*pResult = 0;
}
コード例 #2
0
ファイル: poker.cpp プロジェクト: angeldv95/pokerspot
bool CPokerApp::loginToLoungeServer(const CString& host,
                                    int            port,
                                    const CString& username,
                                    const CString& passwd)
{
  CWaitCursor wait;

  CView* pView = static_cast<CMainWnd*>(m_pMainWnd)->GetActiveView();

  if (!pLoungeServer_)
    pLoungeServer_ = Network::LoungeServer::ConnectToLounge(pView ? pView->GetSafeHwnd() : NULL,
                                                            (LPCTSTR)host, port);

  if (pLoungeServer_)
    pLoungeServer_->sendLoungeLoginPDU(username, passwd);

  return pLoungeServer_ != NULL;
}
コード例 #3
0
ファイル: SceneEdit.cpp プロジェクト: mavaL/MiniCraft
BOOL CSceneEditApp::InitInstance()
{
// 	// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
// 	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
// 	INITCOMMONCONTROLSEX InitCtrls;
// 	InitCtrls.dwSize = sizeof(InitCtrls);
// 	// 将它设置为包括所有要在应用程序中使用的
// 	// 公共控件类。
// 	InitCtrls.dwICC = ICC_WIN95_CLASSES;
// 	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();


//	EnableTaskbarInteraction(FALSE);

	// 使用 RichEdit 控件需要  AfxInitRichEdit2()	
	// AfxInitRichEdit2();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	//初始化OLE
	OleInitialize(NULL);

	//初始化GDI+
	Gdiplus::GdiplusStartupInput gdiplusStartupInput;
	GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL);

	CMainFrame* pFrame = new CMainFrame;
	if (!pFrame)
		return FALSE;
	m_pMainWnd = pFrame;
	// 创建并加载框架及其资源
	pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);

	///////////////////////////////////////////
	///////////////////////////初始化主程序
	CView* pView = pFrame->GetActiveView();
	RECT rect;
	pView->GetClientRect(&rect);

	m_app.Init(rect.right-rect.left, rect.bottom-rect.top, pView->GetSafeHwnd(), m_pMainWnd->GetSafeHwnd());

	///////////////////////////////////////////
	///////////////////////////初始化编辑器UI
	if(!pFrame->CreateEditorMainUI())
		return FALSE;

	///////////////////////////////////////////
	///////////////////////////初始化完毕,开始渲染...
	pFrame->ShowWindow(SW_SHOW);
	pFrame->UpdateWindow();
	//pFrame->SetForegroundWindow();

	pFrame->SetTimer(0, (UINT)TIME_PER_FRAME*1000, NULL);

	return TRUE;
}
コード例 #4
0
BOOL CBCGPRibbonBackstagePagePrint::OnInitDialog() 
{
	CBCGPDialog::OnInitDialog();

	for (int i = 0; i < sizeof(nLabelIDs) / sizeof(UINT); i++)
	{
		CWnd* pWnd = GetDlgItem (nLabelIDs[i]);
		if (pWnd->GetSafeHwnd () != NULL)
		{
			pWnd->SetFont (&globalData.fontCaption);
		}
	}

	if (globalData.DwmIsCompositionEnabled())
	{
		m_wndZoomNum.m_bOnGlass = TRUE;
	}

	BOOL bInitialized = FALSE;

	CView* pView = NULL;
	CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CFrameWnd, AfxGetApp ()->GetMainWnd ());
	if (pFrame != NULL)
	{
		if (pFrame->IsKindOf (RUNTIME_CLASS(CMDIFrameWnd)))
		{
			pFrame = ((CMDIFrameWnd*)pFrame)->GetActiveFrame ();
		}

		pView = pFrame->GetActiveView ();
		bInitialized = pView != NULL;
	}

	CRect rectWnd;

	CWnd* pWndLocation = GetDlgItem (IDC_BCGBARRES_PRINT_PREVIEW);
	ASSERT(pWndLocation);
	pWndLocation->GetWindowRect (rectWnd);
	ScreenToClient (rectWnd);
	pWndLocation->ShowWindow (SW_HIDE);
	pWndLocation->DestroyWindow ();

	if (bInitialized && pView->GetSafeHwnd () != NULL)
	{
		// Create the preview view object
		m_wndPreview = CreatePreviewWnd();
		if (m_wndPreview == NULL)
		{
			TRACE0("Error: Failed to create preview control.\n");
		}
		else if (!m_wndPreview->Create(WS_CHILD | WS_TABSTOP, CRect(0, 0, 0, 0), this, IDC_BCGBARRES_PRINT_PREVIEW))
		{
			TRACE0("Error: Failed to create preview control.\n");
			delete m_wndPreview;
			m_wndPreview = NULL;
		}
		else
		{
			m_wndPreview->SetNotifyPage (IDC_BCGBARRES_PRINT_PAGE_NUM);
			m_wndPreview->SetNotifyZoom (IDC_BCGBARRES_PRINT_ZOOM_NUM);

			InitializePrintInfo();

			if (!m_wndPreview->SetPrintView (pView, NULL))
			{
				TRACE0("Error: Failed to initialize preview control.\n");

				m_wndPreview->DestroyWindow ();
				delete m_wndPreview;
				m_wndPreview = NULL;
				bInitialized = FALSE;
			}
			else
			{
				m_wndPreview->ShowWindow (SW_SHOWNA);
				m_wndPreview->MoveWindow (rectWnd);
			}
		}
	}

	OnInitPrintControls();

	CBCGPStaticLayout* pLayout = (CBCGPStaticLayout*)GetLayout();
	ASSERT_VALID(pLayout);

	pLayout->AddAnchor(IDC_BCGBARRES_PRINT_SEPARATOR, CBCGPStaticLayout::e_MoveTypeNone, CBCGPStaticLayout::e_SizeTypeVert);
	if (m_wndPreview->GetSafeHwnd () != NULL)
	{
		pLayout->AddAnchor(m_wndPreview->GetSafeHwnd (), CBCGPStaticLayout::e_MoveTypeNone, CBCGPStaticLayout::e_SizeTypeBoth);
	}
	pLayout->AddAnchor(AFX_ID_PREVIEW_PREV, CBCGPStaticLayout::e_MoveTypeVert, CBCGPStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_BCGBARRES_PRINT_PAGE_NUM, CBCGPStaticLayout::e_MoveTypeVert, CBCGPStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(AFX_ID_PREVIEW_NEXT, CBCGPStaticLayout::e_MoveTypeVert, CBCGPStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_BCGBARRES_PRINT_ZOOM_NUM, CBCGPStaticLayout::e_MoveTypeBoth, CBCGPStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_BCGBARRES_PRINT_ZOOM_SLIDER, CBCGPStaticLayout::e_MoveTypeBoth, CBCGPStaticLayout::e_SizeTypeNone);

	PRINTDLG* dlgPrint = GetPrintDlg();
	if (!bInitialized || dlgPrint == NULL || dlgPrint->hDevMode == NULL || dlgPrint->hDevNames == NULL)
	{
		m_btnPrint.EnableWindow (FALSE);
		SetCopies(m_nCopies, FALSE);
	}

	OnPageChanged ();
	OnZoomChanged ();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}