meetingtree.cpp

来自「航空公司简单考勤系统:主要运用指纹管理深圳航空公司的会议签到管理系统」· C++ 代码 · 共 78 行

CPP
78
字号
// MeetingTree.cpp: implementation of the CMeetingTree class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Demo_airline.h"
#include "MeetingTree.h"
#include "Demo_airlineDlg.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern CDemo_airlineApp theApp;

CMeetingTree::CMeetingTree()
{

}

CMeetingTree::~CMeetingTree()
{

}

BOOL CMeetingTree::FillMeetingTree(CTreeCtrl *pTreeCtrl)
{
    _RecordsetPtr pRecordMeet;
	pRecordMeet.CreateInstance(__uuidof(Recordset));

	TVINSERTSTRUCT tvInsert;
	tvInsert.hParent = NULL;
	tvInsert.hInsertAfter = NULL;
	tvInsert.item.mask = TVIF_TEXT;
	tvInsert.item.pszText = _T("深航会议");

	HTREEITEM hTreeMeet = pTreeCtrl->InsertItem(&tvInsert);
    pTreeCtrl->Expand(hTreeMeet, TVE_EXPAND);

	try
	{
		
		CString strSql;
		strSql = "select * from Meeting order by MeetingNo asc";
		pRecordMeet->Open(strSql.AllocSysString(),
			theApp.m_pConnection.GetInterfacePtr(),
			adOpenDynamic,
			adLockOptimistic,
			adCmdText);

		pRecordMeet->MoveFirst();
		while(!pRecordMeet->adoEOF)
		{
			_variant_t var = pRecordMeet->GetCollect("MeetingNo");
			if(VT_NULL != var.vt)
			{
				pTreeCtrl->InsertItem((LPCSTR)_bstr_t(var),hTreeMeet,TVI_SORT);
			}
			else 
				continue;
			pRecordMeet->MoveNext();
		}

		pRecordMeet->Close();
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.ErrorMessage());
	}

	return TRUE;
}

⌨️ 快捷键说明

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