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

📄 reporterdlg.cpp

📁 一个电视台专用的信息管理软件源代码
💻 CPP
字号:
// ReporterDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TVNews.h"
#include "ReporterDlg.h"
//#include "RepInfoDlg.h"
#include "RepUploadDlg.h"
#include "RepHistoryDlg.h"
#include "RepHInfoDlg.h"
#include "Message.h"
//#include "RepFeedBack.h"
#include "Users.h"
#include "TVNewsDlg.h"
#include "RepUploadDlg.h"
#include "RepHistoryDlg.h"
#include "RepTodayDlg.h"
#include "UserChannel.h"
#include "Channel.h"



#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WM_ICON_NOTIFY WM_USER+10
/////////////////////////////////////////////////////////////////////////////
// CReporterDlg dialog
extern CTVNewsApp theApp;

CReporterDlg::CReporterDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReporterDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReporterDlg)
	m_strDesc1 = _T("");
	m_strDesc2 = _T("");
	m_strDesc3 = _T("");
	m_strUserInf = _T("");
	m_strLogTime = _T("");
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
//	m_bBrowse=FALSE;
}


void CReporterDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReporterDlg)
	DDX_Control(pDX, IDC_TAB1, m_tab);
	DDX_Text(pDX, IDC_STATIC1, m_strDesc1);
	DDX_Text(pDX, IDC_STATIC2, m_strDesc2);
	DDX_Text(pDX, IDC_STATIC3, m_strDesc3);
	DDX_Text(pDX, IDC_STATIC_USERINF, m_strUserInf);
	DDX_Text(pDX, IDC_STATIC_LOGTIME, m_strLogTime);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReporterDlg, CDialog)
	//{{AFX_MSG_MAP(CReporterDlg)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
	ON_WM_TIMER()
	ON_WM_CLOSE()
	ON_COMMAND(IDR_DEMO, OnDemo)
	ON_MESSAGE(WM_ICON_NOTIFY, OnTrayNotification)
	ON_COMMAND(IDR_EXIT, OnExit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReporterDlg message handlers

BOOL CReporterDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CUsers User;
	int UserID=theApp.m_user.GetUID();
	User.GetData(UserID);
	CUserChannel userChannel;
	CChannel Channel;
	int ChannelID = userChannel.GetChannelIDByUserID(UserID);
	Channel.GetData(ChannelID);
	CString ChannelName ;
	ChannelName = Channel.GetName();

	SYSTEMTIME st;
	CString strDate;
	GetLocalTime(&st);
	strDate.Format("%4d-%2d-%2d %2d:%2d",st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute);


	m_strUserInf=User.GetName()+"您好!您现在处于"+ChannelName+"频道下的"+ColumnName+"栏目!!!";
	m_strLogTime="登陆时间:" + strDate;
	m_tab.InsertItem(0," 上传新闻"); 
	m_tab.InsertItem(1," 当天新闻列表"); 	
	m_tab.InsertItem(2," 历史新闻查询"); 

	//建立属性页各页 
	RepUploadDlg.ColumnName = ColumnName;
	RepUploadDlg.Create(IDD_REP_UPLOAD,GetDlgItem(IDC_TAB1)); 
	RepTodayDlg.Create(IDD_REP_TODAY,GetDlgItem(IDC_TAB1)); 
	RepHistoryDlg.Create(IDD_REP_HISTORY,GetDlgItem(IDC_TAB1)); 



	//设置页面的位置在m_tab控件范围内 
	CRect rs; 
	m_tab.GetClientRect(rs); 
	rs.top+=20; 
	rs.bottom-=4; 
	rs.left+=4; 
	rs.right-=4; 
    RepUploadDlg.MoveWindow(rs); 
	RepTodayDlg.MoveWindow(rs);
	RepHistoryDlg.MoveWindow(rs); 

	RepUploadDlg.ShowWindow(TRUE); 
	m_tab.SetCurSel(0); 

	CStringArray RepInf;
	CNews News;
	News.GetRepInf(RepInf);

	m_strDesc1=_T(RepInf.GetAt(0));
	m_strDesc2=_T(RepInf.GetAt(1));
	m_strDesc3=_T(RepInf.GetAt(2));

	UpdateData(false);

	SetTimer(1,5000,NULL); 

	m_TrayIcon.Create(this,WM_ICON_NOTIFY,"鼠标指向时显示",m_hIcon,IDR_MENU); //构造
    m_TrayIcon.SetIcon(IDI_MYICON);
	Flg=0;

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

void CReporterDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	int CurSel; 
	CurSel=m_tab.GetCurSel(); 
	switch(CurSel) 
	{ 
		case 0: 
			RepUploadDlg.ShowWindow(TRUE);
			RepTodayDlg.ShowWindow(FALSE);
			RepHistoryDlg.ShowWindow(FALSE);
			
			break; 
		case 1: 
			RepUploadDlg.ShowWindow(FALSE);
			RepTodayDlg.ShowWindow(TRUE);
			RepHistoryDlg.ShowWindow(FALSE);
			break; 
		
		case 2: 
			RepUploadDlg.ShowWindow(FALSE);
			RepTodayDlg.ShowWindow(FALSE);
			RepHistoryDlg.ShowWindow(TRUE);
		
			break; 	
	
		default: ; 
	} 
	
	*pResult = 0;
}

LRESULT CReporterDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
	return m_TrayIcon.OnTrayNotification(wParam,lParam);


}
void CReporterDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
 // if(m_bBrowse) return;

	CStringArray RepInf;
	CUIntArray allNewsItem;
	CNews News;
	News.GetRepInf(RepInf);

	m_strDesc1=_T(RepInf.GetAt(0));
	m_strDesc2=_T(RepInf.GetAt(1));
	m_strDesc3=_T(RepInf.GetAt(2));
	UpdateData(false);
	


	if((News.GetNewNews(allNewsItem))&&(Flg==0))
	{
		CMessage Message;
		int i;
		for( i=0;i<allNewsItem.GetSize();i++)
		{
			Flg=1;			
	    	Message.NewsItem.Add(allNewsItem.GetAt(i));

		}
			Message.m_Type=0;
			Message.DoModal();
			Flg=0;
	}
	
	
	CDialog::OnTimer(nIDEvent);
}

void CReporterDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
		ShowWindow(SW_HIDE); //隐藏窗口

}

void CReporterDlg::OnDemo() 
{
	// TODO: Add your command handler code here
	ShowWindow(SW_SHOW);
}

void CReporterDlg::OnExit() 
{
	// TODO: Add your command handler code here
	m_TrayIcon.RemoveIcon();

	KillTimer(1); 

	CUsers User;
	long iFlg;
	CString cMessage;

	int UserID=theApp.m_user.GetUID();

	User.LogOut(UserID,iFlg,cMessage);
	
	OnCancel();

	
}

BOOL CReporterDlg::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message   ==   WM_KEYDOWN)   
     {   
           if(pMsg->wParam   ==   VK_RETURN)   
           {   
			    
				return true;
            }   
       }

	
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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