【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了yaDlg.cpp相关资料,希望对各位网友有所帮助!
// yaDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ya.h"
#include "yaDlg.h"
#include "shellapi.h"
#include"winuser.h"
#include"dbt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CYaDlg dialog
CYaDlg::CYaDlg(CWnd* pParent /*=NULL*/)
: CDialog(CYaDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CYaDlg)
m_papertime = 0;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
mouseflag=FALSE;
m_image.Create(16,16,ILC_COLOR,1,20);
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_curpaper=0;
m_currentdate=0;
}
void CYaDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CYaDlg)
DDX_Control(pDX, IDC_LIST1, m_list1);
DDX_Control(pDX, IDC_DISPMODE, m_dispmode);
DDX_Control(pDX, IDC_SPIN1, m_spin1);
DDX_Text(pDX, IDC_PAPERTIME, m_papertime);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CYaDlg, CDialog)
//{{AFX_MSG_MAP(CYaDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_ADDPAPER, OnAddpaper)
ON_BN_CLICKED(IDC_DELETEPAPER, OnDeletepaper)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_USER+1,OnStatusIcon)
ON_MESSAGE(WM_USER+2,OnHideWindow)
ON_COMMAND(ID_MENUABOUT,OnMenuAbout)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CYaDlg message handlers
BOOL CYaDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
PostMessage(WM_USER+2);
//system pane icon
HICON icon=AfxGetApp()->LoadIcon(IDI_ICON1);
data.cbSize=sizeof(NOTIFYICONDATA);
data.hIcon=icon;
data.hWnd=m_hWnd;
strcpy(data.szTip,"this is a really cry");
data.uCallbackMessage=WM_USER+1;
data.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP;
data.uID=88;
if(!Shell_NotifyIcon(NIM_ADD,&data))
MessageBox("wa,buxingyai");
//spin control
m_spin1.SetRange(1,30);
m_spin1.SetPos(1);
//add icon in imagelist
m_image.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
m_image.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
//initialize list box
m_list1.SetImageList(&m_image,LVSIL_SMALL);
m_list1.SetIconSpacing(40,80);
//////////////
/////////////read data from regedit
int nums=AfxGetApp()->GetProfileInt("paper","papernum",0);
if(nums!=0)
{
for(int i=0;i<=nums;i++)
{
CString string,getstring;
string.Format("wallpaper%d",i);
getstring=AfxGetApp()->GetProfileString("paper",string);