diff --git a/CSMQTT/CSMQTT.cpp b/CSMQTT/CSMQTT.cpp deleted file mode 100644 index 7b6586d..0000000 --- a/CSMQTT/CSMQTT.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// CSMQTT.cpp: 定义应用程序的类行为。 -// - -#include "pch.h" -#include "framework.h" -#include "CSMQTT.h" -#include "CSMQTTDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CCSMQTTApp - -BEGIN_MESSAGE_MAP(CCSMQTTApp, CWinApp) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CCSMQTTApp 构造 - -CCSMQTTApp::CCSMQTTApp() -{ - // 支持重新启动管理器 - m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; - - // TODO: 在此处添加构造代码, - // 将所有重要的初始化放置在 InitInstance 中 -} - - -// 唯一的 CCSMQTTApp 对象 - -CCSMQTTApp theApp; - - -// CCSMQTTApp 初始化 - -BOOL CCSMQTTApp::InitInstance() -{ - // 如果一个运行在 Windows XP 上的应用程序清单指定要 - // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, - //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。 - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // 将它设置为包括所有要在应用程序中使用的 - // 公共控件类。 - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - - AfxEnableControlContainer(); - - // 创建 shell 管理器,以防对话框包含 - // 任何 shell 树视图控件或 shell 列表视图控件。 - CShellManager *pShellManager = new CShellManager; - - // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题 - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); - - // 标准初始化 - // 如果未使用这些功能并希望减小 - // 最终可执行文件的大小,则应移除下列 - // 不需要的特定初始化例程 - // 更改用于存储设置的注册表项 - // TODO: 应适当修改该字符串, - // 例如修改为公司或组织名 - SetRegistryKey(_T("应用程序向导生成的本地应用程序")); - - CCSMQTTDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: 在此放置处理何时用 - // “确定”来关闭对话框的代码 - } - else if (nResponse == IDCANCEL) - { - // TODO: 在此放置处理何时用 - // “取消”来关闭对话框的代码 - } - else if (nResponse == -1) - { - TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n"); - TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n"); - } - - // 删除上面创建的 shell 管理器。 - if (pShellManager != nullptr) - { - delete pShellManager; - } - -#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS) - ControlBarCleanUp(); -#endif - - // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, - // 而不是启动应用程序的消息泵。 - return FALSE; -} - diff --git a/CSMQTT/CSMQTT.h b/CSMQTT/CSMQTT.h deleted file mode 100644 index edb80b1..0000000 --- a/CSMQTT/CSMQTT.h +++ /dev/null @@ -1,32 +0,0 @@ - -// CSMQTT.h: PROJECT_NAME 应用程序的主头文件 -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "在包含此文件之前包含 'pch.h' 以生成 PCH" -#endif - -#include "resource.h" // 主符号 - - -// CCSMQTTApp: -// 有关此类的实现,请参阅 CSMQTT.cpp -// - -class CCSMQTTApp : public CWinApp -{ -public: - CCSMQTTApp(); - -// 重写 -public: - virtual BOOL InitInstance(); - -// 实现 - - DECLARE_MESSAGE_MAP() -}; - -extern CCSMQTTApp theApp; diff --git a/CSMQTT/CSMQTT.rc b/CSMQTT/CSMQTT.rc deleted file mode 100644 index 98b7b4e..0000000 Binary files a/CSMQTT/CSMQTT.rc and /dev/null differ diff --git a/CSMQTT/CSMQTT.vcxproj b/CSMQTT/CSMQTT.vcxproj deleted file mode 100644 index aa95ac1..0000000 --- a/CSMQTT/CSMQTT.vcxproj +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {C76E066B-BE29-415E-8975-0107C4191EEF} - MFCProj - CSMQTT - 10.0 - - - - Application - true - v143 - Unicode - Static - - - Application - false - v143 - true - Unicode - Static - - - Application - true - v143 - Unicode - Static - - - Application - false - v143 - true - Unicode - Static - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - Use - Level3 - true - _WINDOWS;_DEBUG;%(PreprocessorDefinitions) - pch.h - - - Windows - - - false - true - _DEBUG;%(PreprocessorDefinitions) - - - 0x0804 - _DEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Use - Level3 - true - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - pch.h - - - Windows - - - false - true - _DEBUG;%(PreprocessorDefinitions) - - - 0x0804 - _DEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Use - Level3 - true - true - true - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - pch.h - - - Windows - true - true - - - false - true - NDEBUG;%(PreprocessorDefinitions) - - - 0x0804 - NDEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Use - Level3 - true - true - true - _WINDOWS;NDEBUG;%(PreprocessorDefinitions) - pch.h - - - Windows - true - true - - - false - true - NDEBUG;%(PreprocessorDefinitions) - - - 0x0804 - NDEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CSMQTT/CSMQTT.vcxproj.filters b/CSMQTT/CSMQTT.vcxproj.filters deleted file mode 100644 index f6a8ece..0000000 --- a/CSMQTT/CSMQTT.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - 头文件 - - - 头文件 - - - 头文件 - - - 头文件 - - - 头文件 - - - 头文件 - - - - - 源文件 - - - 源文件 - - - 源文件 - - - - - 资源文件 - - - - - 资源文件 - - - - - 资源文件 - - - \ No newline at end of file diff --git a/CSMQTT/CSMQTTDlg.cpp b/CSMQTT/CSMQTTDlg.cpp deleted file mode 100644 index b0d3250..0000000 --- a/CSMQTT/CSMQTTDlg.cpp +++ /dev/null @@ -1,144 +0,0 @@ - -// CSMQTTDlg.cpp: 实现文件 -// - -#include "pch.h" -#include "framework.h" -#include "CSMQTT.h" -#include "CSMQTTDlg.h" -#include "afxdialogex.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CCSMQTTDlg 对话框 - - - -CCSMQTTDlg::CCSMQTTDlg(CWnd* pParent /*=nullptr*/) - : CDialogEx(IDD_CSMQTT_DIALOG, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CCSMQTTDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialogEx::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CCSMQTTDlg, CDialogEx) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDOK, &CCSMQTTDlg::OnBnClickedOk) -END_MESSAGE_MAP() - - -// CCSMQTTDlg 消息处理程序 - -BOOL CCSMQTTDlg::OnInitDialog() -{ - CDialogEx::OnInitDialog(); - - // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动 - // 执行此操作 - SetIcon(m_hIcon, TRUE); // 设置大图标 - SetIcon(m_hIcon, FALSE); // 设置小图标 - - // TODO: 在此添加额外的初始化代码 - - server.SetFunc([this](SOCKET sock, int index, char* buf, short len) {CCSMQTTDlg::Process(sock, index, buf, len); }); - server.CreatServer(1995); - - - //clien[1].Create(); - //clien[1].Connect(_T("127.0.0.1"), 1883); - //clien[1].SetConnectFun([this](int i) {CCSMQTTDlg::Process(i); }); - //clien[1].SetFunc([this](int i) {CCSMQTTDlg::Proc(1); }, 1); - - file.Open(_T("D://1.txt"), CFile::modeCreate | CFile::modeReadWrite); - - file1.Open(_T("D://2.txt"), CFile::modeCreate | CFile::modeReadWrite); - return TRUE; // 除非将焦点设置到控件,否则返回 TRUE -} - -// 如果向对话框添加最小化按钮,则需要下面的代码 -// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序, -// 这将由框架自动完成。 - -void CCSMQTTDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // 用于绘制的设备上下文 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // 使图标在工作区矩形中居中 - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // 绘制图标 - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialogEx::OnPaint(); - } -} - -//当用户拖动最小化窗口时系统调用此函数取得光标 -//显示。 -HCURSOR CCSMQTTDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - - - -void CCSMQTTDlg::OnBnClickedOk() -{ - // TODO: 在此添加控件通知处理程序代码 - CDialogEx::OnOK(); -} - -VOID CCSMQTTDlg::Process(SOCKET sock, int index, char* buf, short len) -{ - if(clien.find(index)== clien.end()) - { - clien[index].Create(); - clien[index].Connect(_T("127.0.0.1"), 1883); - clien[index].SetConnectFun([this](int i) {CCSMQTTDlg::Process(i); }); - clien[index].SetFunc([this] (){CCSMQTTDlg::Proc(); }); - } - Sleep(100); - CStringA str; - str.Format("\r\n收到一条消息%d\r\n", index); - int l = clien[index].Send(buf, len, 0); - file.Write(str, str.GetLength()); - file.Write(buf, len); - //CStringA str = buf; -} - -VOID CCSMQTTDlg::Proc(int id) -{ - CStringA str; - str.Format("\r\n收到一条消息%d\r\n", id); - file1.Write(str, str.GetLength()); - char* buf; - int len; - clien[id].GetMsg(&buf,len); - len = server.SendTo(id, buf, len); - file1.Write(buf, len); - delete[]buf; -} - -VOID CCSMQTTDlg::Process(int type) -{ - int i = type; -} diff --git a/CSMQTT/CSMQTTDlg.h b/CSMQTT/CSMQTTDlg.h deleted file mode 100644 index 7666cc5..0000000 --- a/CSMQTT/CSMQTTDlg.h +++ /dev/null @@ -1,42 +0,0 @@ - -// CSMQTTDlg.h: 头文件 -// - -#pragma once - - -// CCSMQTTDlg 对话框 -class CCSMQTTDlg : public CDialogEx -{ -// 构造 -public: - CCSMQTTDlg(CWnd* pParent = nullptr); // 标准构造函数 - -// 对话框数据 -#ifdef AFX_DESIGN_TIME - enum { IDD = IDD_CSMQTT_DIALOG }; -#endif - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 - - -// 实现 -protected: - HICON m_hIcon; - - // 生成的消息映射函数 - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClickedOk(); - SocketServer server; - std::map clien; - CFile file,file1; - - VOID Process(SOCKET sock, int index, char* buf, short len); //处理Socket消息 - VOID Proc(int id); //处理Socket消息 - VOID Process(int type); //处理Socket消息 -}; diff --git a/CSMQTT/framework.h b/CSMQTT/framework.h deleted file mode 100644 index 5672fb5..0000000 --- a/CSMQTT/framework.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料 -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的 - -// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息 -#define _AFX_ALL_WARNINGS - -#include // MFC 核心组件和标准组件 -#include // MFC 扩展 - - -#include // MFC 自动化类 - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC 对 Internet Explorer 4 公共控件的支持 -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC 对 Windows 公共控件的支持 -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include // MFC 支持功能区和控制条 - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/CSMQTT/pch.cpp b/CSMQTT/pch.cpp deleted file mode 100644 index b6fb8f4..0000000 --- a/CSMQTT/pch.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// pch.cpp: 与预编译标头对应的源文件 - -#include "pch.h" - -// 当使用预编译的头时,需要使用此源文件,编译才能成功。 diff --git a/CSMQTT/pch.h b/CSMQTT/pch.h deleted file mode 100644 index e5d0237..0000000 --- a/CSMQTT/pch.h +++ /dev/null @@ -1,24 +0,0 @@ -// pch.h: 这是预编译标头文件。 -// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 -// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 -// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 -// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 - -#ifndef PCH_H -#define PCH_H - -// 添加要在此处预编译的标头 -#include "framework.h" - -// 添加要在此处预编译的标头 -#include "framework.h" - -#include "D:/代码/ToolsLib/ToolsLib/ToolsLib.h" - -#ifdef _DEBUG -#pragma comment(lib,"D:/代码/ToolsLib/x64/Debug/ToolsLib.lib") -#else -#pragma comment(lib,"D:/代码/ToolsLib/x64/Release/ToolsLib.lib") -#endif - -#endif //PCH_H diff --git a/CSMQTT/res/CSMQTT.ico b/CSMQTT/res/CSMQTT.ico deleted file mode 100644 index d56fbcd..0000000 Binary files a/CSMQTT/res/CSMQTT.ico and /dev/null differ diff --git a/CSMQTT/res/CSMQTT.rc2 b/CSMQTT/res/CSMQTT.rc2 deleted file mode 100644 index 87c7dff..0000000 Binary files a/CSMQTT/res/CSMQTT.rc2 and /dev/null differ diff --git a/CSMQTT/resource.h b/CSMQTT/resource.h deleted file mode 100644 index a35f286..0000000 --- a/CSMQTT/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ 生成的包含文件。 -// 供 CSMQTT.rc 使用 -// -#define IDD_CSMQTT_DIALOG 102 -#define IDR_MAINFRAME 128 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/CSMQTT/targetver.h b/CSMQTT/targetver.h deleted file mode 100644 index 79934a3..0000000 --- a/CSMQTT/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。 - -//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并 -// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。 - -#include diff --git a/aike.sln b/aike.sln index 1f3d871..811f234 100644 --- a/aike.sln +++ b/aike.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aike", "aike\aike.vcxproj", "{699789E1-D831-4727-88CF-81FB6F000FC8}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSMQTT", "CSMQTT\CSMQTT.vcxproj", "{C76E066B-BE29-415E-8975-0107C4191EEF}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -23,14 +21,6 @@ Global {699789E1-D831-4727-88CF-81FB6F000FC8}.Release|x64.Build.0 = Release|x64 {699789E1-D831-4727-88CF-81FB6F000FC8}.Release|x86.ActiveCfg = Release|Win32 {699789E1-D831-4727-88CF-81FB6F000FC8}.Release|x86.Build.0 = Release|Win32 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Debug|x64.ActiveCfg = Debug|x64 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Debug|x64.Build.0 = Debug|x64 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Debug|x86.ActiveCfg = Debug|Win32 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Debug|x86.Build.0 = Debug|Win32 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Release|x64.ActiveCfg = Release|x64 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Release|x64.Build.0 = Release|x64 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Release|x86.ActiveCfg = Release|Win32 - {C76E066B-BE29-415E-8975-0107C4191EEF}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/aike/StaffDlg.cpp b/aike/StaffDlg.cpp new file mode 100644 index 0000000..40bc6e0 --- /dev/null +++ b/aike/StaffDlg.cpp @@ -0,0 +1,64 @@ +// StaffDlg.cpp: 实现文件 +// + +#include "pch.h" +#include "aike.h" +#include "afxdialogex.h" +#include "StaffDlg.h" + + +// StaffDlg 对话框 + +IMPLEMENT_DYNAMIC(StaffDlg, CDialogEx) + +StaffDlg::StaffDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_STAFFDLG, pParent) +{ + +} + +StaffDlg::~StaffDlg() +{ +} + +void StaffDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); + DDX_Control(pDX, IDC_LIST1, m_Staff); +} + + +BEGIN_MESSAGE_MAP(StaffDlg, CDialogEx) + ON_BN_CLICKED(IDOK, &StaffDlg::OnBnClickedOk) +END_MESSAGE_MAP() + + +// StaffDlg 消息处理程序 + + +void StaffDlg::OnBnClickedOk() +{ + // TODO: 在此添加控件通知处理程序代码 +} + + +BOOL StaffDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + // TODO: 在此添加额外的初始化 + + //设置员工信息表格 + m_Staff.SetExtendedStyle(m_Staff.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); + int i = 0; + m_Staff.InsertColumn(i++, _T("工号"), LVCFMT_LEFT, 60); + m_Staff.InsertColumn(i++, _T("姓名"), LVCFMT_LEFT, 100); + m_Staff.InsertColumn(i++, _T("性别"), LVCFMT_LEFT, 50); + m_Staff.InsertColumn(i++, _T("职务"), LVCFMT_LEFT, 60); + m_Staff.InsertColumn(i++, _T("部门"), LVCFMT_LEFT, 60); + m_Staff.InsertColumn(i++, _T("状态"), LVCFMT_LEFT, 50); + m_Staff.InsertColumn(i++, _T("手机号"), LVCFMT_LEFT, 120); + m_Staff.InsertColumn(i++, _T("入职日期"), LVCFMT_LEFT, 120); + return TRUE; // return TRUE unless you set the focus to a control + // 异常: OCX 属性页应返回 FALSE +} diff --git a/aike/StaffDlg.h b/aike/StaffDlg.h new file mode 100644 index 0000000..cd83635 --- /dev/null +++ b/aike/StaffDlg.h @@ -0,0 +1,28 @@ +#pragma once +#include "afxdialogex.h" + + +// StaffDlg 对话框 + +class StaffDlg : public CDialogEx +{ + DECLARE_DYNAMIC(StaffDlg) + +public: + StaffDlg(CWnd* pParent = nullptr); // 标准构造函数 + virtual ~StaffDlg(); + +// 对话框数据 +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_STAFFDLG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnBnClickedOk(); + virtual BOOL OnInitDialog(); + CListCtrl m_Staff; +}; diff --git a/aike/aike.rc b/aike/aike.rc index b07f87c..89d0875 100644 Binary files a/aike/aike.rc and b/aike/aike.rc differ diff --git a/aike/aike.vcxproj b/aike/aike.vcxproj index b37fe0e..4779441 100644 --- a/aike/aike.vcxproj +++ b/aike/aike.vcxproj @@ -188,6 +188,7 @@ + @@ -195,6 +196,7 @@ + Create Create diff --git a/aike/aike.vcxproj.filters b/aike/aike.vcxproj.filters index da39dc1..514335b 100644 --- a/aike/aike.vcxproj.filters +++ b/aike/aike.vcxproj.filters @@ -33,6 +33,9 @@ 头文件 + + 头文件 + @@ -44,6 +47,9 @@ 源文件 + + 源文件 + diff --git a/aike/aikeDlg.cpp b/aike/aikeDlg.cpp index 178dbd1..239bccb 100644 --- a/aike/aikeDlg.cpp +++ b/aike/aikeDlg.cpp @@ -30,6 +30,7 @@ CaikeDlg::CaikeDlg(CWnd* pParent /*=nullptr*/) void CaikeDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); + //DDX_Control(pDX, IDC_LIST1, m_Staff); } BEGIN_MESSAGE_MAP(CaikeDlg, CDialogEx) @@ -87,17 +88,8 @@ BOOL CaikeDlg::PreTranslateMessage(MSG* pMsg) void CaikeDlg::OnSize(UINT nType, int cx, int cy) { __super::OnSize(nType, cx, cy); - CRect rt, tt; - GetWindowRect(rt); - tt = { 0,0,25,25 }; - tt.MoveToX(rt.Width() - 75); - MoveButton(1, tt); - tt.MoveToX(rt.Width() - 50); - MoveButton(2, tt); - MoveButton(3, tt); - tt.MoveToX(rt.Width() - 25); - MoveButton(4, tt); // TODO: 在此处添加消息处理程序代码 + MoveAllWin(); } //设置窗口最大和最小范围 @@ -105,6 +97,9 @@ void CaikeDlg::OnGetMinMaxInfo(MINMAXINFO* lpMMI) { // TODO: 在此添加消息处理程序代码和/或调用默认值 lpMMI->ptMaxSize.y = GetSystemMetrics(SM_CYFULLSCREEN) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYDLGFRAME); + lpMMI->ptMinTrackSize.x = 800; //x宽度 + lpMMI->ptMinTrackSize.y = 600; //y高度 + __super::OnGetMinMaxInfo(lpMMI); } @@ -149,7 +144,11 @@ VOID CaikeDlg::Initialize() GetModuleFileName(module, path, MAX_PATH); //获取本程序绝对路径 m_Path = path; m_Path = m_Path.Left(m_Path.ReverseFind('\\') + 1); - + GetPrivateProfileString(_T("SETTING"), _T("ServerName"), _T("127.0.0.1"), ServerIP.GetBuffer(MAX_PATH), MAX_PATH, m_Path + "system.ini"); + GetPrivateProfileString(_T("SETTING"), _T("PassWord"), _T("Ncsr88352518"), AdoPass.GetBuffer(MAX_PATH), MAX_PATH, m_Path + "system.ini"); + GetPrivateProfileString(_T("SETTING"), _T("UserName"), _T("sa"), UserName.GetBuffer(MAX_PATH), MAX_PATH, m_Path + "system.ini"); + GetPrivateProfileString(_T("SETTING"), _T("DataBase"), _T("aike"), DataBase.GetBuffer(MAX_PATH), MAX_PATH, m_Path + "system.ini"); + //ServerProt //添加按钮 CImage img, img1; img.Load(_T("../aike/res/background.jpg")); @@ -168,8 +167,7 @@ VOID CaikeDlg::Initialize() img.Destroy(); img.Load(_T("../aike/res/business.jpg")); img1.Load(_T("../aike/res/business1.jpg")); - AddButton(10, rt, img, img1, img1, img1); - SetLClick(10, [this](int i) {text(i); }); + AddButton(1000, rt, img, img1, img1, img1); rt.MoveToXY(300, 100); @@ -177,40 +175,48 @@ VOID CaikeDlg::Initialize() img1.Destroy(); img.Load(_T("../aike/res/member.jpg")); img1.Load(_T("../aike/res/member1.jpg")); - AddButton(11, rt, img, img1, img1, img1); + AddButton(2000, rt, img, img1, img1, img1); rt.MoveToXY(500, 100); img.Destroy(); img1.Destroy(); img.Load(_T("../aike/res/report.jpg")); img1.Load(_T("../aike/res/report1.jpg")); - AddButton(12, rt, img, img1, img1, img1); + AddButton(3000, rt, img, img1, img1, img1); rt.MoveToXY(100, 300); img.Destroy(); img1.Destroy(); img.Load(_T("../aike/res/Booking.jpg")); img1.Load(_T("../aike/res/Booking1.jpg")); - AddButton(13, rt, img, img1, img1, img1); - EnableButton(3, FALSE); + AddButton(4000, rt, img, img1, img1, img1); rt.MoveToXY(300, 300); img.Destroy(); img1.Destroy(); img.Load(_T("../aike/res/inventory.jpg")); img1.Load(_T("../aike/res/inventory1.jpg")); - AddButton(14, rt, img, img1, img1, img1); - EnableButton(3, FALSE); + AddButton(5000, rt, img, img1, img1, img1); rt.MoveToXY(500, 300); img.Destroy(); img1.Destroy(); img.Load(_T("../aike/res/basis.jpg")); img1.Load(_T("../aike/res/basis1.jpg")); - AddButton(15, rt, img, img1, img1, img1); + AddButton(6000, rt, img, img1, img1, img1); + SetLClick(6000, [this](int i) {SetUpClick(i); }); + + + EnableButton(3, FALSE); MaxClick(0); + + m_StaffDlg.Create(IDD_STAFFDLG, this); + + + //FixedSize(); + //连接服务器 //SClien.Create(); //SClien.SetConnectFun([this](int i) {TCPState(i); }); @@ -223,6 +229,7 @@ VOID CaikeDlg::Initialize() MessageBox(_T("数据库连接失败"), _T("温馨提示")); exit(0); } + MoveAllWin(); TrayMylcon(TRUE); } @@ -294,7 +301,7 @@ VOID CaikeDlg::MinClick(int id) VOID CaikeDlg::MaxClick(int id) { ShowWindow(SW_MAXIMIZE); - ShowButton(2,FALSE); + ShowButton(2, FALSE); ShowButton(3, TRUE); } @@ -302,6 +309,7 @@ VOID CaikeDlg::MaxClick(int id) VOID CaikeDlg::ReductionClick(int id) { ShowWindow(SW_RESTORE); + CenterWindow(NULL); ShowButton(2, TRUE); ShowButton(3, FALSE); } @@ -315,58 +323,151 @@ VOID CaikeDlg::CloseClick(int id) } } -//TCP连接状态 -VOID CaikeDlg::TCPState(int type) +VOID CaikeDlg::MoveAllWin() { - CStringA str = "nihao"; - switch (type) + if (m_StaffDlg.m_hWnd == NULL) { - case -1: //连接失败 - MessageBox(_T("连接失败")); - break; - case 0: //连接成功 - //SClien.Send(str, str.GetLength()); - break; - case 1: //连接中断 - - break; - default: - break; + return; + } + CRect rt, tt; + GetWindowRect(rt); + tt = { 0,0,25,25 }; + tt.MoveToX(rt.Width() - 75); + MoveButton(1, tt); + tt.MoveToX(rt.Width() - 50); + MoveButton(2, tt); + MoveButton(3, tt); + tt.MoveToX(rt.Width() - 25); + MoveButton(4, tt); + + GetWindowRect(rt); + rt.MoveToXY(-50, -50); + rt.left = 150; + rt.top = (50); + m_StaffDlg.MoveWindow(rt); +} + + +//隐藏所有按钮 +VOID CaikeDlg::HideAllBt(BOOL Hide) +{ + ShowButton(1000, !Hide); + ShowButton(2000, !Hide); + ShowButton(3000, !Hide); + ShowButton(4000, !Hide); + ShowButton(5000, !Hide); + ShowButton(6000, !Hide); +} + +//设置按钮 +VOID CaikeDlg::SetUpClick(int id) +{ + HideAllBt(); + CRect rt = { 0,0,100,30 }; + rt.MoveToXY(30, 50); + if (AddButton(1001, rt)) + { + SetLClick(1001, [this](int i) {HomepageClick(i); }); + + rt.MoveToXY(30, 90); + AddButton(6001, rt); + SetLClick(6001, [this](int i) {StaffClick(i); }); + } + ShowButton(1001, TRUE); + ShowButton(6001, TRUE); +} + +VOID CaikeDlg::StaffClick(int id) +{ + m_StaffDlg.ShowWindow(SW_SHOW); + ShowStaff(m_StaffDlg.m_Staff); +} + +//回到主页 +VOID CaikeDlg::HomepageClick(int id) +{ + m_StaffDlg.ShowWindow(SW_HIDE); + ShowButton(1001, FALSE); + ShowButton(6001, FALSE); + HideAllBt(FALSE); +} + +//显示员工信息 +VOID CaikeDlg::ShowStaff(CListCtrl& m_Staff) +{ + m_Staff.DeleteAllItems(); + CRect rt = { 0,0,100,30 }; + rt.MoveToXY(150, 50); + _RecordsetPtr m_pRecor; + _variant_t var; + CString str = (_T("select JobID,a.name,sex,b.name 'department', c.name 'category',workforce,phone,BeginDate from staff a,department b,category c")), tmp; + AdoSql.QuerySql(str, m_pRecor); + int i = 0; + while (!m_pRecor->GetadoEOF()) + { + var = m_pRecor->GetCollect("JobID"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + if (tmp == _T("")) + { + m_pRecor->MoveNext(); + continue; + } + m_Staff.InsertItem(i, tmp); + } + else + { + m_pRecor->MoveNext(); + continue; + } + var = m_pRecor->GetCollect("name"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 1, tmp); + } + var = m_pRecor->GetCollect("sex"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 2, tmp); + } + var = m_pRecor->GetCollect("department"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 3, tmp); + } + var = m_pRecor->GetCollect("category"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 4, tmp); + } + var = m_pRecor->GetCollect("workforce"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 5, tmp); + } + var = m_pRecor->GetCollect("phone"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 6, tmp); + } + var = m_pRecor->GetCollect("BeginDate"); + if (var.vt != VT_NULL) + { + tmp = (LPCTSTR)_bstr_t(var); + m_Staff.SetItemText(i, 7, tmp); + } + + m_pRecor->MoveNext(); + i++; } } -//处理SOCKET消息 -VOID CaikeDlg::Process() -{ - //CStringA str; - //CString tmp; - //SClien.GetMsg(str); - //Json json; - //int lenth = json.parse(str); - //while (lenth != -1) - //{ - // SClien.RemoveMsg(lenth); - // Process(json); - // if (str.GetLength() == lenth) - // { - // return; - // } - // SClien.GetMsg(str); - // lenth = json.parse(str); - //} - //return; -} - -//处理SOCKET消息 -VOID CaikeDlg::Process(Json json) -{ - -} - -VOID CaikeDlg::text(int id) -{ - -} - diff --git a/aike/aikeDlg.h b/aike/aikeDlg.h index 7c93349..f831226 100644 --- a/aike/aikeDlg.h +++ b/aike/aikeDlg.h @@ -3,6 +3,7 @@ // #pragma once +#include "StaffDlg.h" // CaikeDlg 对话框 class CaikeDlg : public CDialogEx,MyDialog @@ -32,13 +33,14 @@ protected: public: //变量 ADOSQL AdoSql; //连接数据库 - SocketClien SClien; //连接服务器 + //SocketClien SClien; //连接服务器 CString m_Path; //本程序路径 - CString ServerIP = _T("sr.nceissoft.com"); //服务器IP - UINT ServerProt = 1995; //服务器端口 - CString DataBase = _T("aike"); //数据库名称 - CString UserName = _T("sa"); //数据库用户名 - CString AdoPass = _T("Ncsr88352518"); //数据库密码 + CString ServerIP; //服务器IP + CString DataBase; //数据库名称 + CString UserName; //数据库用户名 + CString AdoPass; //数据库密码 + //CListCtrl m_Staff; + StaffDlg m_StaffDlg; //MFC回调函数 virtual BOOL PreTranslateMessage(MSG* pMsg); //截获窗口消息 @@ -57,8 +59,27 @@ public: VOID MaxClick(int id); //最大化窗口 VOID ReductionClick(int id); //还原窗口 VOID CloseClick(int id); //关闭窗口 - VOID TCPState(int type); //TCP连接状态 - VOID Process(); //处理SOCKET消息 - VOID Process(Json json); //处理SOCKET消息 - VOID text(int id); + VOID MoveAllWin(); //移动所有窗口和按钮 + VOID HideAllBt(BOOL Hide = TRUE); //隐藏所有按钮 + VOID SetUpClick(int id); //设置按钮 + VOID HomepageClick(int id); //回到主页 + VOID StaffClick(int id); + VOID ShowStaff(CListCtrl& m_Staff); //显示员工信息 }; + + +//按钮对照表 +/* +1 最小化 +2 最大化 +3 还原 +4 关闭 +1000 前台营业 +2000 会员管理 +3000 报表管理 +4000 预定管理 +5000 库存管理 +6000 基础设置 +1001 返回主页 +6001 员工信息 +*/ \ No newline at end of file diff --git a/aike/res/1.jpg b/aike/res/0 - 副本.jpg similarity index 75% rename from aike/res/1.jpg rename to aike/res/0 - 副本.jpg index 1c8dec2..4d318f0 100644 Binary files a/aike/res/1.jpg and b/aike/res/0 - 副本.jpg differ diff --git a/aike/resource.h b/aike/resource.h index 8f526d4..abbf395 100644 --- a/aike/resource.h +++ b/aike/resource.h @@ -5,6 +5,8 @@ #define IDR_TRAY_MENU 1 #define IDD_AIKE_DIALOG 102 #define IDR_MAINFRAME 128 +#define IDD_STAFFDLG 132 +#define IDC_LIST1 1000 #define ID_32771 32771 #define ID_32772 32772 #define ID_SHOW_MENU 32773 @@ -14,9 +16,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 132 +#define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_COMMAND_VALUE 32775 -#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif