⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qqview.cpp

📁 VC++编写的论文管理系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// QQView.cpp : implementation of the CQQView class
//
#include "stdafx.h"
#include "QQ.h"
#include "CntrItem.h"
#include "QQDoc.h"
#include "QQView.h"
#include "DialogSetOther.h"
#include "msword9.h"
#include <AtlBase.h>
#include "ShowDialog.h"
#include "AddRecord.h"
#include "global.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////////////
#include "Tools.h"
#include "MainFrm.h"
#include "NameSel.h"
#include "ThesisSel.h"
#include "KeyWord.h"
#include "Lookup.h"
/////////////////////////////////////////////////////////////////////////////
// CQQView
extern SEL_TYPE showType;

IMPLEMENT_DYNCREATE(CQQView, CView)

BEGIN_MESSAGE_MAP(CQQView, CView)
	//{{AFX_MSG_MAP(CQQView)
	ON_WM_TIMER()
	ON_WM_ERASEBKGND()
	ON_WM_CREATE()
	ON_WM_LBUTTONDOWN()
	ON_WM_DESTROY()
	ON_WM_SETFOCUS()
	ON_WM_SIZE()
	ON_COMMAND(ID_OLE_INSERT_NEW, OnInsertObject)
	ON_COMMAND(ID_CANCEL_EDIT_CNTR, OnCancelEditCntr)
	ON_COMMAND(ID_SET_PATH, OnSetPath)
	ON_COMMAND(ID_INFO_IN, OnInfoIn)
	ON_COMMAND(ID_INFO_OUT, OnInfoOut)
	ON_COMMAND(ID_EXIT, OnExit)
	ON_COMMAND(ID_INFOLOOK_ALL, OnInfolookAll)
	ON_COMMAND(ID_INFOLOOK_KEY, OnInfolookKey)
	ON_COMMAND(ID_INFOLOOK_NONE, OnInfolookNone)
	ON_COMMAND(ID_INFOLOOK_STU, OnInfolookStu)
	ON_COMMAND(ID_INFOLOOK_THESIS, OnInfolookThesis)
	ON_COMMAND(ID_ADD_THESIS, OnAddThesis)
	ON_COMMAND(ID_DELETE_THESIS, OnDeleteThesis)
	ON_COMMAND(ID_MODIFY_THESIS, OnModifyThesis)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CQQView construction/destruction
HBITMAP CQQView::m_CurScreenBitmap=NULL;
BOOL CQQView::bFirstRun=TRUE;
int CQQView::nImgTypeInView=-1;//普通图像类型
CPoint CQQView::pnt=CPoint(0,0);

CQQView::CQQView()
{
	// TODO: add construction code here
	//赋初值
     strShowText="";
	 bFinish=false;
	 bFirst=true;
//	 InitStructData();
}

CQQView::~CQQView()
{
    m_List.RemoveAll();
}
CQQView * CQQView::GetView()
{//静态成员函数
	CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
	
	CView * pView = pFrame->GetActiveView();
	
	if ( !pView )
		return NULL;
	
	// Fail if view is of wrong kind
	// (this could occur with splitter windows, or additional
	// views on a single document
	if ( ! pView->IsKindOf( RUNTIME_CLASS(CQQView) ) )
		return NULL;
	
	return (CQQView*) pView;
	
}
BOOL CQQView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
//cs.style |= WS_MAXIMIZE;
	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CQQView drawing

void CQQView::OnDraw(CDC* pDC)
{
	CQQDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	LoadbgroundBitmap(pDC);//画背景
	if(bFirstRun)
	{
		nImgTypeInView=0;
        LoadWelocmeBmp(pDC);
	//	bFirstRun=FALSE;
	}
	
}

/////////////////////////////////////////////////////////////////////////////
// CQQView printing

BOOL CQQView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CQQView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CQQView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CQQView diagnostics

#ifdef _DEBUG
void CQQView::AssertValid() const
{
	CView::AssertValid();
}

void CQQView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CQQDoc* CQQView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CQQDoc)));
	return (CQQDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CQQView message handlers
//加载背景图
void CQQView::LoadbgroundBitmap(CDC *pDC)
{//加载视的背景图 
    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BKBMP);

	CDC m;
	m.CreateCompatibleDC(pDC);//创建一个于pDC兼容的DC
	m.SelectObject(&bitmap);
	CRect rect;
	this->GetClientRect(&rect);
	pDC->BitBlt(0,0,rect.Width(),rect.Height(),&m,0,0,SRCCOPY);
    m.DeleteDC();  
}
void CQQView::LoadWelocmeBmp(CDC* pDC)
{//加载启动时的欢迎图像 
	CBitmap bitmap;
    bitmap.LoadBitmap(IDB_HOTELTEXT);
	
	CDC m;
	m.CreateCompatibleDC(pDC);//创建一个于pDC兼容的DC
	m.SelectObject(&bitmap);
	CRect rect;
	this->GetClientRect(&rect);
////	long nStartX=rect.left;
//	long nStartY=rect.bottom-280;
    long nStartX=rect.left+rect.Width()/5;
	long nStartY=rect.top+rect.Height()/3;
	BITMAP m_bitmap;//定义位图结构体来保存位图信息
	bitmap.GetBitmap(&m_bitmap);//得到位图结构体,记录了位图的信息
	long nWidth=m_bitmap.bmWidth;//位图宽度
	long nHeight=m_bitmap.bmHeight;//位图高度
	pDC->BitBlt(nStartX,nStartY,nWidth,nHeight,&m,0,0,SRCCOPY);
    m.DeleteDC(); 
}
void CQQView::SetBitmapText(CPoint pnt,CDC*pDC, CString strText)
{//显示带有图像和文字的字符串
    CBitmap bitmap;
	bitmap.LoadBitmap(IDB_TEXT);
	CDC m;
	m.CreateCompatibleDC(pDC);
	m.SelectObject(&bitmap);
	pDC->SetBkMode(TRANSPARENT);//设置背景模式
	pDC->BitBlt(pnt.x,pnt.y,9,9,&m,0,0,SRCCOPY);//拷贝图像

	pDC->TextOut(pnt.x+15,pnt.y-5,strText);//输出文本
}
//###################################################################
/////////////////////信息管理模块
/////////////////////////////////////////////////////////////////////
int CQQView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	// TODO: Add your specialized creation code here
    return 0;
}
void CQQView::OnInitialUpdate()
{
	CView::OnInitialUpdate();


	// TODO: remove this code when final selection model code is written
	m_pSelection = NULL;    // initialize selection

}

void CQQView::OnDestroy()
{
	// Deactivate the item on destruction; this is important
	// when a splitter view is being used.
   CView::OnDestroy();
   COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
   if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
   {
      pActiveItem->Deactivate();
      ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
   }
}


/////////////////////////////////////////////////////////////////////////////
// OLE Client support and commands

BOOL CQQView::IsSelected(const CObject* pDocItem) const
{
	// The implementation below is adequate if your selection consists of
	//  only CWordCntrItem objects.  To handle different selection
	//  mechanisms, the implementation here should be replaced.

	// TODO: implement this function that tests for a selected OLE client item

	return pDocItem == m_pSelection;
}

void CQQView::OnInsertObject()
{
	// Invoke the standard Insert Object dialog box to obtain information
	//  for new CWordCntrItem object.
	COleInsertDialog dlg;
	if (dlg.DoModal() != IDOK)
		return;

	BeginWaitCursor();

	CQQCntrItem* pItem = NULL;
	TRY
	{
		// Create new item connected to this document.
		CQQDoc* pDoc = GetDocument();
		ASSERT_VALID(pDoc);
		pItem = new CQQCntrItem(pDoc);
		ASSERT_VALID(pItem);

		// Initialize the item from the dialog data.
		if (!dlg.CreateItem(pItem))
			AfxThrowMemoryException();  // any exception will do
		ASSERT_VALID(pItem);
		
        if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
			pItem->DoVerb(OLEIVERB_SHOW, this);

		ASSERT_VALID(pItem);

		// As an arbitrary user interface design, this sets the selection
		//  to the last item inserted.

		// TODO: reimplement selection as appropriate for your application

		m_pSelection = pItem;   // set selection to last inserted item
		pDoc->UpdateAllViews(NULL);
	}
	CATCH(CException, e)
	{
		if (pItem != NULL)
		{
			ASSERT_VALID(pItem);
			pItem->Delete();
		}
		AfxMessageBox(IDP_FAILED_TO_CREATE);
	}
	END_CATCH

	EndWaitCursor();
}

// The following command handler provides the standard keyboard
//  user interface to cancel an in-place editing session.  Here,
//  the container (not the server) causes the deactivation.
void CQQView::OnCancelEditCntr()
{
	// Close any in-place active item on this view.
	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
	if (pActiveItem != NULL)
	{
		pActiveItem->Close();
	}
	ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}

// Special handling of OnSetFocus and OnSize are required for a container
//  when an object is being edited in-place.
void CQQView::OnSetFocus(CWnd* pOldWnd)
{
	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
	if (pActiveItem != NULL &&
		pActiveItem->GetItemState() == COleClientItem::activeUIState)
	{
		// need to set focus to this item if it is in the same view
		CWnd* pWnd = pActiveItem->GetInPlaceWindow();
		if (pWnd != NULL)
		{
			pWnd->SetFocus();   // don't call the base class
			return;
		}
	}

	CView::OnSetFocus(pOldWnd);
}

void CQQView::OnSize(UINT nType, int cx, int cy)
{
	CView::OnSize(nType, cx, cy);
	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
	if (pActiveItem != NULL)
		pActiveItem->SetItemRects();
		
}



void CQQView::OnSetPath() 
{
	// TODO: Add your command handler code here
	CDialogSetOther m_Dlg;
	m_Dlg.DoModal();
//	
	
	
}
void CQQView::SaveToDb(CString str)
{
//	信息01-1@013501999@张三@李小梅@协同商务环境下的企业集成应用系统研究@协同商务@企业信息门户@ Web服务@@Collaborative Commerce@EIP@Web Services@@论文从协同商务理论入手,逐步探讨了协同商务对企业信息系统协同化的新要求,构建协同商务系统的关键技术,并提出了基于企业信息门户和EAI技术构建集成的企业信息系统的框架。最后以一个典型案例对提出的集成应用系统框架体系在连锁企业中的应用进行了研究。
//	班级、学号、姓名、指导教师、论文题目、中文关键字、英文关键字、内容简介 
	CString grade,StuNo,name,teacher,thesis,content;
	CString chKey1,chKey2,chKey3,chKey4,enKey1,enKey2,enKey3,enKey4;
	int nStart=0,nPos;
	int nLen = str.GetLength();
	

	nPos = str.Find("@",nStart);
   	grade = str.Mid(nStart,nPos-nStart);
//	AfxMessageBox(grade);
	nStart = nPos+1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -