📄 wincejobdlg.cpp
字号:
// WinCEJobDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WinCEJob.h"
#include "WinCEJobDlg.h"
#include "inireader.h"
#include "SortListCtrl.h"
#include "new.h"
#include "about.h"
#include "sysinfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWinCEJobDlg dialog
int m_global;
CWinCEJobDlg::CWinCEJobDlg(CWnd* pParent /*=NULL*/)
: CDialog(CWinCEJobDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CWinCEJobDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CWinCEJobDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWinCEJobDlg)
DDX_Control(pDX, IDC_LIST1, m_listctrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWinCEJobDlg, CDialog)
//{{AFX_MSG_MAP(CWinCEJobDlg)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
ON_COMMAND(ID_MENUITEM32779, OnMenuitem32779)
ON_COMMAND(ID_MENUITEM32783, OnMenuitem32783)
ON_COMMAND(ID_SYSTEM, OnSystem)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWinCEJobDlg message handlers
BOOL CWinCEJobDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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
CenterWindow(GetDesktopWindow()); // center to the hpc screen
//改变列表的背景色
m_listctrl.SetBkColor(COLORREF(RGB(251,251,249)));
m_listctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);//|LVS_EX_GRIDLINES);
//设置表头格式为Account/Name/Date
m_listctrl.SetHeadings(_T(",10;选项,60"));
//宽度设置
m_listctrl.SetColumnWidth(0,10);
m_listctrl.SetColumnWidth(1,160);
m_listctrl.AddItem(L"1",L"最近打开");
m_listctrl.AddItem(L"2",L"更新");
m_listctrl.AddItem(L"3",L"分类");//
m_listctrl.AddItem(L"4",L"我的文件夹");
m_listctrl.AddItem(L"5",L"资源管理器");
SHMENUBARINFO mbi;
ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = this->m_hWnd;
mbi.nToolBarId = IDR_MENUBAR1;
mbi.hInstRes = AfxGetInstanceHandle();
if(!SHCreateMenuBar(&mbi))
{
// Couldn't create the menu bar. Fail creation of the window.
MessageBox(L"Couldn't create the menu bar");
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CWinCEJobDlg::OnButton1()
{
m_reader = new CIniReader(L"Modeless");
if(m_reader->Load() == -1)
{
AfxMessageBox(L"not found");
}
else
AfxMessageBox(m_reader->m_Buffer);
}
void CWinCEJobDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// ShowFile(0, 0);
*pResult = 0;
}
void CWinCEJobDlg::ShowFile(int m, int n)
{
/* WIN32_FIND_DATA wfd;
HANDLE hand = FindFirstFile(L"*", &wfd);
if(hand == INVALID_HANDLE_VALUE )
{
MessageBox(L"sorry,no file");
return ;
}
if(wfd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
m_listctrl.AddItem(L"6", wfd.cFileName);
while(FindNextFile(hand, &wfd))
{
if(wfd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
m_listctrl.AddItem(L"6",wfd.cFileName);
}*/
}
//****************************************************************
//函数名: OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
//参数:
//功能: 双击List项时,实现打开子目录
//作者: 杨淑华
//实现日期: 05-3-14
/****************************************************************/
void CWinCEJobDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// ShowFile(0, 0);
int nItem;
POSITION pos = m_listctrl.GetFirstSelectedItemPosition();
if (pos == NULL)
TRACE0("No items were selected!\n");
else
{
while (pos)
{
nItem = m_listctrl.GetNextSelectedItem(pos);
}
}
m_value = nItem;
// 倒序查找'\' 当前目录
TCHAR buf[MAX_PATH];
GetModuleFileName(NULL, buf, MAX_PATH);
TCHAR * pPos = _tcsrchr(buf, L'\\');
*(pPos) = L'\0';
// str[2].Format(L"%s\\%s", buf, this->m_FileName);
m_global = nItem;
CNew cn;
cn.DoModal();
*pResult = 0;
}
void CWinCEJobDlg::OnMenuitem32779()
{
CDialog::OnOK();
}
void CWinCEJobDlg::OnMenuitem32783()
{
CAbout ca;
ca.DoModal();
}
void CWinCEJobDlg::OnSystem()
{
CSysinfo cs;
cs.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -