添加项目文件。

This commit is contained in:
JasonYANG17 2023-02-16 14:28:10 +08:00
parent dd17c9713e
commit efec9ec661
15 changed files with 1440 additions and 0 deletions

31
YANG Remind.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YANG Remind", "YANG Remind\YANG Remind.vcxproj", "{3831DDB5-E774-41D8-9975-B48EEFF85AD0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Debug|x64.ActiveCfg = Debug|x64
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Debug|x64.Build.0 = Debug|x64
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Debug|x86.ActiveCfg = Debug|Win32
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Debug|x86.Build.0 = Debug|Win32
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Release|x64.ActiveCfg = Release|x64
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Release|x64.Build.0 = Release|x64
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Release|x86.ActiveCfg = Release|Win32
{3831DDB5-E774-41D8-9975-B48EEFF85AD0}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D8A9F736-2F29-4211-86AA-D35B203AF0E5}
EndGlobalSection
EndGlobal

107
YANG Remind/YANG Remind.cpp Normal file
View File

@ -0,0 +1,107 @@

// YANG Remind.cpp: 定义应用程序的类行为。
//
#include "pch.h"
#include "framework.h"
#include "YANG Remind.h"
#include "YANG RemindDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CYANGRemindApp
BEGIN_MESSAGE_MAP(CYANGRemindApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CYANGRemindApp 构造
CYANGRemindApp::CYANGRemindApp()
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的 CYANGRemindApp 对象
CYANGRemindApp theApp;
// CYANGRemindApp 初始化
BOOL CYANGRemindApp::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("应用程序向导生成的本地应用程序"));
CYANGRemindDlg 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;
}

32
YANG Remind/YANG Remind.h Normal file
View File

@ -0,0 +1,32 @@

// YANG Remind.h: PROJECT_NAME 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
#endif
#include "resource.h" // 主符号
// CYANGRemindApp:
// 有关此类的实现,请参阅 YANG Remind.cpp
//
class CYANGRemindApp : public CWinApp
{
public:
CYANGRemindApp();
// 重写
public:
virtual BOOL InitInstance();
// 实现
DECLARE_MESSAGE_MAP()
};
extern CYANGRemindApp theApp;

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{3831DDB5-E774-41D8-9975-B48EEFF85AD0}</ProjectGuid>
<Keyword>MFCProj</Keyword>
<RootNamespace>YANGRemind</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>YANG Auto Notice</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Users\qw200\Documents\json\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Users\qw200\Documents\json\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\Users\qw200\Documents\json\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Users\qw200\Documents\json\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>jsoncpp.lib</AdditionalDependencies>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>jsoncpp.lib</AdditionalDependencies>
<StackReserveSize>10240000</StackReserveSize>
<HeapReserveSize>
</HeapReserveSize>
<HeapCommitSize>
</HeapCommitSize>
<StackCommitSize>10240000</StackCommitSize>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="YANG Remind.h" />
<ClInclude Include="YANG RemindDlg.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="YANG Remind.cpp" />
<ClCompile Include="YANG RemindDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="YANGRemind.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\YANGRemind.rc2" />
</ItemGroup>
<ItemGroup>
<Image Include="res\YANG Remind.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="YANG Remind.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="YANG RemindDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="YANG Remind.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="YANG RemindDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="YANGRemind.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\YANGRemind.rc2">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\YANG Remind.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project>

View File

@ -0,0 +1,803 @@

// YANG RemindDlg.cpp: 实现文件
//
#include "pch.h"
#include "framework.h"
#include "YANG Remind.h"
#include "YANG RemindDlg.h"
#include "afxdialogex.h"
#include <json/json.h>
#include <fstream>
using namespace Json;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define WM_SHOWTASK (WM_USER+200) //注意n换成数字n的大小应大于100
#define TM_MSG 10000
#define TM_MSG1 50000
#include <shellapi.h>
int xz = 0;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
NOTIFYICONDATA nid;
BOOL isNotify;
CString num = _T("");
CString num2 = _T("");
CString num31 = _T("");
CString num313 = _T("");
CString net = _T("");
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
//执行延时操作的地方
void CYANGRemindDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
if (nIDEvent==TM_MSG)
{
//具体实现
SendMessage(WM_CLOSE);
CDialogEx::OnTimer(TM_MSG);
}else
if (nIDEvent==1)
{
if (xz == 1) {
OnBnClickedButton3();
}
else if (xz == 2) {
OnBnClickedButton2();
}
else if(xz==3)
{
OnBnClickedButton1();
}
else if (xz == 4) {
OnBnClickedButton12();
}
CDialogEx::OnTimer(1);
}
}
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButton1();
};
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON1, &CAboutDlg::OnBnClickedButton1)
END_MESSAGE_MAP()
// CYANGRemindDlg 对话框
CYANGRemindDlg::CYANGRemindDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_YANG_REMIND_DIALOG, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CYANGRemindDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, ID_POWERBOOT, PowerBootButton);
}
BEGIN_MESSAGE_MAP(CYANGRemindDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON5, &CYANGRemindDlg::OnBnClickedButton5)
ON_BN_CLICKED(IDC_BUTTON6, &CYANGRemindDlg::OnBnClickedButton6)
ON_BN_CLICKED(IDC_BUTTON1, &CYANGRemindDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CYANGRemindDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON8, &CYANGRemindDlg::OnBnClickedButton8)
ON_BN_CLICKED(IDC_BUTTON7, &CYANGRemindDlg::OnBnClickedButton7)
ON_BN_CLICKED(IDC_BUTTON4, &CYANGRemindDlg::OnBnClickedButton4)
ON_BN_CLICKED(ID_POWERBOOT, &CYANGRemindDlg::OnBnClickedPowerboot)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BUTTON9, &CYANGRemindDlg::OnBnClickedButton9)
ON_BN_CLICKED(IDC_BUTTON3, &CYANGRemindDlg::OnBnClickedButton3)
ON_BN_CLICKED(IDC_BUTTON10, &CYANGRemindDlg::OnBnClickedButton10)
ON_BN_CLICKED(IDC_CHECK1, &CYANGRemindDlg::OnBnClickedCheck1)
ON_BN_CLICKED(IDC_CHECK3, &CYANGRemindDlg::OnBnClickedCheck3)
ON_BN_CLICKED(IDC_BUTTON11, &CYANGRemindDlg::OnBnClickedButton11)
ON_BN_CLICKED(IDC_BUTTON12, &CYANGRemindDlg::OnBnClickedButton12)
ON_BN_CLICKED(IDC_BUTTON13, &CYANGRemindDlg::OnBnClickedButton13)
END_MESSAGE_MAP()
// CYANGRemindDlg 消息处理程序
BOOL CYANGRemindDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 将“关于...”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != nullptr)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
void CYANGRemindDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CYANGRemindDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(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();
}
num = AfxGetApp()->GetProfileString(_T("Settings"), _T("LocalRecPath"), _T("C:\\"));//_T("C:\\")为默认值
num2 = AfxGetApp()->GetProfileString(_T("Settings"), _T("LocalRecPath2"), _T("C:\\"));//_T("C:\\")为默认值
num31 = AfxGetApp()->GetProfileString(_T("Settings"), _T("LocalRecPath3"), _T("C:\\"));//_T("C:\\")为默认值
num313 = AfxGetApp()->GetProfileString(_T("Settings"), _T("LocalRecPath313"), _T("C:\\"));//_T("C:\\")为默认值
if (!isNotify)
{
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = IDR_MAINFRAME;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
nid.uCallbackMessage = WM_SHOWTASK;//自定义的消息名称,注意:这里的消息是用户自定义消息
nid.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
wcscpy_s(nid.szTip, _T("YANG Remind程序"));//信息提示条为"计划任务提醒"
wcscpy_s(nid.szInfo, num);
wcscpy_s(nid.szInfoTitle, num2);
nid.dwInfoFlags = NIIF_INFO;
//nid.uTimeout = 5;
Shell_NotifyIcon(NIM_ADD, &nid);//在托盘区添加图标
//AnimateWindow(5000, AW_HIDE | AW_BLEND); //可以缓慢消失窗口
Shell_NotifyIcon(NIM_DELETE, &nid);
//KillTimer(0);
//ToTray();
//ShowWindow(SW_HIDE);//隐藏主窗口
int num3;
num3 = _ttoi(num31);
int num31;
num31 = _ttoi(num313);
if (num3 == 1) {
if (num31 == 0)
{
SetTimer(TM_MSG, 5000, NULL);
KillTimer(TM_MSG);
}
else {
SetTimer(TM_MSG, 5000, NULL);
}
}
else if (num3 == 2)
{
if (num31 == 0) {
netlist();
SetTimer(TM_MSG, 5000, NULL);
KillTimer(TM_MSG);
}
else
{
netlist();
SetTimer(TM_MSG, 5000, NULL);
}
}
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CYANGRemindDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CYANGRemindDlg::TZ() {
if (!isNotify)
{
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = IDR_MAINFRAME;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
nid.uCallbackMessage = WM_SHOWTASK;//自定义的消息名称,注意:这里的消息是用户自定义消息
nid.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
wcscpy_s(nid.szTip, _T("YANG Remind程序"));//信息提示条为"计划任务提醒"
wcscpy_s(nid.szInfo, num);
wcscpy_s(nid.szInfoTitle, num2);
nid.dwInfoFlags = NIIF_INFO;
//nid.uTimeout = 5;
Shell_NotifyIcon(NIM_ADD, &nid);//在托盘区添加图标
//AnimateWindow(5000, AW_HIDE | AW_BLEND); //可以缓慢消失窗口
//ShowWindow(SW_HIDE);//隐藏主窗口
Shell_NotifyIcon(NIM_DELETE, &nid);
//KillTimer(0);
}
}
void CYANGRemindDlg::OnBnClickedButton1()
{
TZ();
xz = 3;
// TODO: 在此添加控件通知处理程序代码
}
#define TOOLTIPS_NAME_ "XXXX"
//最小化到托盘函数
void CYANGRemindDlg::ToTray()
{
NOTIFYICONDATA nid;
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = IDR_MAINFRAME;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_SHOWTASK;//自定义的消息名称
nid.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
wcscpy_s(nid.szTip, _T(TOOLTIPS_NAME_)); //信息提示条
Shell_NotifyIcon(NIM_ADD, &nid); //在托盘区添加图标
ShowWindow(SW_HIDE); //隐藏主窗口
}
#define TOOLTIPS_NAME_ "YANG Remind"
//删除托盘图标函数
void CYANGRemindDlg::DeleteTray()
{
NOTIFYICONDATA nid;
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = IDR_MAINFRAME;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_SHOWTASK; //自定义的消息名称
nid.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
wcscpy_s(nid.szTip, _T(TOOLTIPS_NAME_)); //信息提示条为“计划任务提醒”
Shell_NotifyIcon(NIM_DELETE, &nid); //在托盘区删除图标
}
afx_msg LRESULT CYANGRemindDlg::OnShowtask(WPARAM wParam, LPARAM lParam)
{
if (wParam != IDR_MAINFRAME)
return 1;
switch (lParam)
{
case WM_RBUTTONUP://右键起来时弹出快捷菜单,这里只有一个“关闭”
{
LPPOINT lpoint = new tagPOINT;
::GetCursorPos(lpoint);//得到鼠标位置
CMenu menu;
menu.CreatePopupMenu();//声明一个弹出式菜单
menu.AppendMenu(MF_STRING, WM_DESTROY, _T("关闭")); //增加菜单项“关闭”点击则发送消息WM_DESTROY给主窗口已隐藏将程序结束。
menu.TrackPopupMenu(TPM_LEFTALIGN, lpoint->x, lpoint->y, this); //确定弹出式菜单的位置
HMENU hmenu = menu.Detach();
menu.DestroyMenu(); //资源回收
delete lpoint;
} break;
case WM_LBUTTONDBLCLK: //双击左键的处理
{
this->ShowWindow(SW_SHOW);//简单的显示主窗口完事儿
DeleteTray();
} break;
default: break;
}
return 0;
}
void CYANGRemindDlg::OnBnClickedPowerboot()
{
// TODO: 在此添加控件通知处理程序代码
HKEY hKey;
//找到系统的启动项
CString lpRun = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
//打开启动项
long lRet = RegOpenKeyEx(HKEY_CURRENT_USER, lpRun, 0, KEY_ALL_ACCESS, &hKey);
if (lRet != ERROR_SUCCESS)
MessageBox(_T("打开启动项失败"));
//找到程序自身路径
TCHAR pFileName[MAX_PATH] = {};
GetModuleFileName(NULL, pFileName, MAX_PATH);
//判断是否已经设置开机启动
TCHAR PowerBoot[MAX_PATH] = {};
DWORD nLongth = MAX_PATH;
long result = RegGetValue(hKey, NULL, _T("PowerBoot"), RRF_RT_REG_SZ, 0, PowerBoot, &nLongth);
if (result == ERROR_SUCCESS)
{
//自启状态;
//取消自动启动
lRet = RegDeleteValue(hKey, _T("PowerBoot"));
if (lRet == ERROR_SUCCESS)
{
MessageBox(_T("关闭自启成功"));
PowerBootButton.SetWindowText(_T("未自启状态"));
}
}
else
{
//未自启状态
//设置自启
lRet = RegSetValueEx(hKey, _T("PowerBoot"), 0, REG_SZ, (LPBYTE)pFileName, (lstrlen(pFileName) + 1) * sizeof(TCHAR));
if (lRet == ERROR_SUCCESS)
{
MessageBox(_T("设置自启成功"));
PowerBootButton.SetWindowText(_T("自启状态"));
}
}
//关闭注册表
RegCloseKey(hKey);
}
void CYANGRemindDlg::OnBnClickedButton4()
{
// TODO: 在此添加控件通知处理程序代码
MessageBox(_T("已开启最小化,系统托盘中左键双击图标打开程序,右键图标关闭程序"));
ToTray();
}
void CYANGRemindDlg::OnBnClickedButton5()
{
//CString tonken1 = _T("");
GetDlgItem(IDC_EDIT2)->GetWindowText(num2);
//num == _ttoi(tonken1);
//CString tonken2 = _T("");
GetDlgItem(IDC_EDIT1)->GetWindowText(num);
//num2 == _ttoi(tonken2);
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath"), num);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath2"), num2);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
MessageBox(_T("保存成功,点击<预览>查看吧"), NULL, MB_OK);
// TODO: 在此添加控件通知处理程序代码
}
void CYANGRemindDlg::OnBnClickedButton6()
{
// TODO: 在此添加控件通知处理程序代码
// Delete_Value(_T("HKEY_CURRENT_USER\\Software\\应用程序向导生成的本地应用程序"), _T("YANG Remind"));
CRegKey mykey;
if (mykey.Open(HKEY_CURRENT_USER, _T("Software\\应用程序向导生成的本地应用程序")) != ERROR_SUCCESS)
{
MessageBox(_T("删除失败"));
}
else
{
if (mykey.RecurseDeleteKey(_T("YANG Remind")) != ERROR_SUCCESS)
{
MessageBox(_T("删除失败"));
}
MessageBox(_T("删除成功"));
}
mykey.Close();
}
//定义Timer事件
void CYANGRemindDlg::OnBnClickedButton7()
{
KillTimer(TM_MSG);
num313 = _T("0");
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath313"), num313);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
// TODO: 在此添加控件通知处理程序代码
MessageBox(_T("自动关闭程序设置已关闭"));
}
void CYANGRemindDlg::OnBnClickedButton8()
{
// TODO: 在此添加控件通知处理程序代码
num313 = _T("1");
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath313"), num313);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
MessageBox(_T("警告(重大操作提示):自动关闭程序设置已开启,下次打开程序会在弹窗结束后自动关闭程序,如需关闭请在程序关闭前点击<取消自动关闭>"));
}
//void CAboutDlg::OnBnClickedButton1()
//{
// TODO: 在此添加控件通知处理程序代码
//system("start https://github.com/JasonYANG170/YANG-Remind/releases");
//}
#include <afxinet.h>
CString CYANGRemindDlg::UTF8ToUnicode(char* UTF8)
{
DWORD dwUnicodeLen; //转换后Unicode的长度
TCHAR* pwText; //保存Unicode的指针
CString strUnicode; //返回值
//获得转换后的长度,并分配内存
dwUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, NULL, 0);
pwText = new TCHAR[dwUnicodeLen];
if (!pwText)
{
return strUnicode;
}
//转为Unicode
MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, pwText, dwUnicodeLen);
//转为CString
strUnicode.Format(_T("%s"), pwText);
//清除内存
delete[]pwText;
//返回转换好的Unicode字串
return strUnicode;
}
void CYANGRemindDlg::netlist()
{
// TODO: 在此添加控件通知处理程序代码
// TODO: 在此添加控件通知处理程序代码
CInternetSession session(_T("HttpClient"));
TCHAR* url = _T("https://v1.jinrishici.com/shuqing/shanggan");
CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
DWORD dwStatusCode;
pfile->QueryInfoStatusCode(dwStatusCode);
if (dwStatusCode == HTTP_STATUS_OK)
{
CString content4;
CString data;
while (pfile->ReadString(data))
{
content4 += data;
}
char* pch;
pch = new char[content4.GetLength() * sizeof(TCHAR) + 1];
memcpy(pch, content4, content4.GetLength() * sizeof(TCHAR));
content4 = UTF8ToUnicode(pch);//转换编码,不然就乱码了
CString str3 = content4;
str3.ReleaseBuffer();
Json::Reader reader23;
Json::Value root23;
CString temp23;
CString temp223;
CString temp323;
USES_CONVERSION;
//using namespace std;
//string str33(CW2A(str3.GetString()));
const char* cJson1 = T2A(str3.GetBuffer(0));
str3.ReleaseBuffer();
if (reader23.parse(cJson1, root23)) {
temp23 = root23["content"].asCString();
temp223 = root23["origin"].asCString();
temp323 = root23["author"].asCString();
}
temp223 = temp223 + " 作者:" + temp323;
num2 = temp23;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath2"), num2);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
num = temp223;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath"), num);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
}
pfile->Close();
delete pfile;
session.Close();
//char* str = "content春如旧。人空瘦。泪痕红浥鲛绡透。";
// "origin" : "钗头凤·红酥手",
// "author" : "陆游",
// "category" : "古诗文-抒情-伤感";
TZ();
}
void CYANGRemindDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
netlist();
num31 = _T("2");
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath3"), num31);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
xz = 2;
}
void CYANGRemindDlg::OnBnClickedButton9()
{
// TODO: 在此添加控件通知处理程序代码
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
void CYANGRemindDlg::OnBnClickedButton3()
{
// TODO: 在此添加控件通知处理程序代码
CInternetSession session(_T("HttpClient"));
TCHAR* url = _T("https://api.vvhan.com/api/en?type=sj");
CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
DWORD dwStatusCode;
pfile->QueryInfoStatusCode(dwStatusCode);
if (dwStatusCode == HTTP_STATUS_OK)
{
CString content;
CString data;
while (pfile->ReadString(data))
{
content += data;
}
char* pch;
pch = new char[content.GetLength() * sizeof(TCHAR) + 1];
memcpy(pch, content, content.GetLength() * sizeof(TCHAR));
content = UTF8ToUnicode(pch);//转换编码,不然就乱码了
//AfxMessageBox(content);
//CString content2;
// content2 = content.Left(content.Find('r'));
// content2 = content2.Right(content.GetLength() - 1 - content.ReverseFind(':'));
//CString contenta;
// contenta = content.Left(content.Find('a'));
//contenta = content.Right(content.GetLength() - 1 - content.ReverseFind(':'));
int start = content.Find(_T("zh\":\""));
int end = content.Find(_T("\",\"en\":"));
CString result = content.Mid(start + 5, end - start - 5);
int start1 = content.Find(_T("en\":\""));
int end1 = content.Find(_T("\",\"pic\":"));
CString result1 = content.Mid(start1 + 5, end1 - start1 - 5);
//temp2 = temp2 + "\r\n作者" + temp3;
//CString strLeftString;
//int nLengthLeft = 0;
//nLengthLeft = content.Find(_T("。"));//获取等号的位置
//AfxMessageBox(content2);
// strLeftString = content.Left(nLengthLeft);//获得等号左面的字符串
// CString strRightString;
//int nLength = strLeftString.GetLength();
//nLengthLeft = 0;
// nLength = strLeftString.Find(_T("origin"));
// strRightString = strLeftString.Right(nLength - nLengthLeft - 1);//获得等号右面的字符串
// AfxMessageBox(result);
// AfxMessageBox(result1);
//AfxMessageBox(strRightString);
num2 = result1;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath2"), num2);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
num = result;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath"), num);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
TZ();
//ssssssssssssssssdasd
}
pfile->Close();
delete pfile;
session.Close();
//char* str = "content春如旧。人空瘦。泪痕红浥鲛绡透。";
// "origin" : "钗头凤·红酥手",
// "author" : "陆游",
// "category" : "古诗文-抒情-伤感";
}
void CAboutDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
system("start https://github.com/JasonYANG170/YANG-Remind/releases");
}
int anjian = 0;
void CYANGRemindDlg::OnBnClickedButton10()
{
// TODO: 在此添加控件通知处理程序代码
// TODO: 在此添加控件通知处理程序代码
//CString tempPort;
//tempPort.Format(_T("%d"), xz); //Use Unicode Character Set
//MessageBox(tempPort);
int time;
CString time1;
GetDlgItem(IDC_EDIT3)->GetWindowText(time1);
time = _ttoi(time1);
if (anjian == 1) {
time = time * 3600000;
}
else
{
time = time * 60000;
}
SetTimer(1, time, NULL);
}
void CYANGRemindDlg::OnBnClickedCheck1()
{
// TODO: 在此添加控件通知处理程序代码
anjian == 1;
}
void CYANGRemindDlg::OnBnClickedCheck3()
{
// TODO: 在此添加控件通知处理程序代码
anjian == 0;
}
void CYANGRemindDlg::OnBnClickedButton11()
{
KillTimer(1);
// TODO: 在此添加控件通知处理程序代码
}
void CYANGRemindDlg::OnBnClickedButton12()
{
xz = 4;
// TODO: 在此添加控件通知处理程序代码
CInternetSession session(_T("HttpClient"));
TCHAR* url = _T("https://api.vvhan.com/api/weather");
CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
DWORD dwStatusCode;
pfile->QueryInfoStatusCode(dwStatusCode);
if (dwStatusCode == HTTP_STATUS_OK)
{
CString content;
CString data;
while (pfile->ReadString(data))
{
content += data;
}
char* pch;
pch = new char[content.GetLength() * sizeof(TCHAR) + 1];
memcpy(pch, content, content.GetLength() * sizeof(TCHAR));
content = UTF8ToUnicode(pch);//转换编码,不然就乱码了
//AfxMessageBox(content);
//CString content2;
// content2 = content.Left(content.Find('r'));
// content2 = content2.Right(content.GetLength() - 1 - content.ReverseFind(':'));
//CString contenta;
// contenta = content.Left(content.Find('a'));
//contenta = content.Right(content.GetLength() - 1 - content.ReverseFind(':'));
CString str = content;
Json::Reader reader;
Json::Value root;
CString temp;
CString temp2;
CString temp3;
CString temp4;
CString temp5;
CString temp6;
USES_CONVERSION;
char* cJson = T2A(str.GetBuffer(0));
str.ReleaseBuffer();
if (reader.parse(cJson, root)) {
temp = root["city"].asCString();
temp2 = root["info"]["type"].asCString();
temp3 = root["info"]["high"].asCString();
temp4 = root["info"]["low"].asCString();
temp5 = root["info"]["tip"].asCString();
temp6 = root["info"]["air"]["aqi_name"].asCString();
}
temp = temp + " " + temp2+" "+temp3+" "+temp4+" 空气质量 "+temp6;
//CString strLeftString;
//int nLengthLeft = 0;
//nLengthLeft = content.Find(_T("。"));//获取等号的位置
//AfxMessageBox(content2);
// strLeftString = content.Left(nLengthLeft);//获得等号左面的字符串
// CString strRightString;
//int nLength = strLeftString.GetLength();
//nLengthLeft = 0;
// nLength = strLeftString.Find(_T("origin"));
// strRightString = strLeftString.Right(nLength - nLengthLeft - 1);//获得等号右面的字符串
//MessageBox(temp);
num2 = temp5;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath2"), num2);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
num = temp;
AfxGetApp()->WriteProfileString(_T("Settings"), _T("LocalRecPath"), num);//_localRecPath就是要保存的信息Settings为注册表子键LocalRecPath即子键的键值名
}
pfile->Close();
delete pfile;
session.Close();
TZ();
}
void CYANGRemindDlg::OnBnClickedButton13()
{
// TODO: 在此添加控件通知处理程序代码
}

View File

@ -0,0 +1,59 @@

// YANG RemindDlg.h: 头文件
//
#pragma once
// CYANGRemindDlg 对话框
class CYANGRemindDlg : public CDialogEx
{
// 构造
public:
CYANGRemindDlg(CWnd* pParent = nullptr); // 标准构造函数
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_YANG_REMIND_DIALOG };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
void TZ();
DECLARE_MESSAGE_MAP()
public:
CButton PowerBootButton;
afx_msg void OnBnClickedButton5();
afx_msg void OnBnClickedButton6();
afx_msg void OnBnClickedButton1();
void ToTray();
void DeleteTray();
LRESULT OnShowtask(WPARAM wParam, LPARAM lParam);
afx_msg void OnBnClickedButton2();
afx_msg void OnBnClickedButton8();
CString UTF8ToUnicode(char* UTF8);
void netlist();
afx_msg void OnBnClickedButton7();
afx_msg void OnBnClickedButton4();
afx_msg void OnBnClickedPowerboot();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnBnClickedButton9();
afx_msg void OnBnClickedButton3();
afx_msg void OnBnClickedButton10();
afx_msg void OnBnClickedCheck1();
afx_msg void OnBnClickedCheck3();
afx_msg void OnBnClickedButton11();
afx_msg void OnBnClickedButton12();
afx_msg void OnBnClickedButton13();
};

BIN
YANG Remind/YANGRemind.rc Normal file

Binary file not shown.

49
YANG Remind/framework.h Normal file
View File

@ -0,0 +1,49 @@
#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 <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#include <afxdisp.h> // MFC 自动化类
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // 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

5
YANG Remind/pch.cpp Normal file
View File

@ -0,0 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

13
YANG Remind/pch.h Normal file
View File

@ -0,0 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

40
YANG Remind/resource.h Normal file
View File

@ -0,0 +1,40 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 YANGRemind.rc 使用
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_YANG_REMIND_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_EDIT1 1000
#define IDC_EDIT2 1001
#define IDC_BUTTON1 1002
#define IDC_BUTTON2 1003
#define ID_POWERBOOT 1004
#define IDC_BUTTON4 1005
#define IDC_BUTTON5 1006
#define IDC_BUTTON6 1007
#define IDC_BUTTON7 1008
#define IDC_BUTTON8 1009
#define IDC_BUTTON9 1010
#define IDC_BUTTON3 1011
#define IDC_BUTTON10 1012
#define IDC_EDIT3 1013
#define IDC_CHECK1 1015
#define IDC_CHECK3 1017
#define IDC_CHECK33 1017
#define IDC_BUTTON11 1018
#define IDC_BUTTON12 1019
#define IDC_BUTTON13 1020
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1020
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

8
YANG Remind/targetver.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>