From b74171c468b395f4f385582bd9fe28e28d22cc19 Mon Sep 17 00:00:00 2001 From: zhongyang219 <380526481@qq.com> Date: Sun, 22 Aug 2021 09:35:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E4=BA=8E=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=9C=80=E5=90=8E=E7=BC=96=E8=AF=91=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + MusicPlayer2/AboutDlg.cpp | 7 +++---- MusicPlayer2/Common.cpp | 8 ++++++++ MusicPlayer2/Common.h | 3 +++ MusicPlayer2/Define.h | 2 +- MusicPlayer2/MusicPlayer2.rc | Bin 540872 -> 541012 bytes MusicPlayer2/MusicPlayer2.vcxproj | 13 +++++++++++++ MusicPlayer2/MusicPlayer2.vcxproj.filters | 1 + MusicPlayer2/print_compile_time.bat | 4 ++++ MusicPlayer2/resource.h | 4 +++- 10 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 MusicPlayer2/print_compile_time.bat diff --git a/.gitignore b/.gitignore index f6ca47ade..bf7d9f59c 100644 --- a/.gitignore +++ b/.gitignore @@ -289,3 +289,4 @@ __pycache__/ *.diagsession *.ini *.sf2 +/MusicPlayer2/compile_time.txt diff --git a/MusicPlayer2/AboutDlg.cpp b/MusicPlayer2/AboutDlg.cpp index 91bde7ad4..c4e159bb2 100644 --- a/MusicPlayer2/AboutDlg.cpp +++ b/MusicPlayer2/AboutDlg.cpp @@ -51,10 +51,9 @@ BOOL CAboutDlg::OnInitDialog() //设置最后编译日期 CString temp_str; GetDlgItemText(IDC_STATIC_COPYRIGHT, temp_str); - temp_str.Replace(_T(""), COMPILE_DATE); - CString year{ COMPILE_DATE }; - year = year.Left(4); - temp_str.Replace(_T(""), year); + CString compile_time = CCommon::GetLastCompileTime(); + temp_str.Replace(_T(""), compile_time); + temp_str.Replace(_T(""), COPY_RIGHT_YEAR); SetDlgItemText(IDC_STATIC_COPYRIGHT, temp_str); m_tool_tip.Create(this); diff --git a/MusicPlayer2/Common.cpp b/MusicPlayer2/Common.cpp index 6bee805bf..58b244102 100644 --- a/MusicPlayer2/Common.cpp +++ b/MusicPlayer2/Common.cpp @@ -1721,3 +1721,11 @@ POINT CCommon::CalculateWindowMoveOffset(CRect& check_rect, vector& scree } return mov; } + +CString CCommon::GetLastCompileTime() +{ + CString compile_time = GetTextResource(IDR_COMPILE_TIME, CodeType::ANSI); + compile_time.Replace(_T("\r\n"), _T("")); + compile_time.Delete(compile_time.GetLength() - 1, 1); + return compile_time; +} diff --git a/MusicPlayer2/Common.h b/MusicPlayer2/Common.h index 4a6ac06a5..e3585d48b 100644 --- a/MusicPlayer2/Common.h +++ b/MusicPlayer2/Common.h @@ -413,6 +413,9 @@ class CCommon //返回使窗口显示在一个监视器内所需移动距离最小的偏移量 (当check_rect在某方向上大于screen_rects时向左或向上对齐) static POINT CalculateWindowMoveOffset(CRect& check_rect, vector& screen_rects); + //从资源文件读取上次编译时间 + static CString GetLastCompileTime(); + }; template diff --git a/MusicPlayer2/Define.h b/MusicPlayer2/Define.h index 32b5a83e9..ba6a40fc0 100644 --- a/MusicPlayer2/Define.h +++ b/MusicPlayer2/Define.h @@ -65,7 +65,7 @@ using _tstring = std::string; #define MAX_SONG_NUM 99999 //播放列表中文件数量的最大值 #define VERSION L"2.73" //程序版本 -#define COMPILE_DATE L"2021/08/21" //最后编译日期 +#define COPY_RIGHT_YEAR L"2021" //任务栏图按钮 #define IDT_PLAY_PAUSE 1321 //任务栏缩略图“播放/暂停”按钮的ID diff --git a/MusicPlayer2/MusicPlayer2.rc b/MusicPlayer2/MusicPlayer2.rc index a8b9fd2aaa089b93faff79326b101c11976656ba..ea582b470b56eb6041643ebd13f7672b17f708d2 100644 GIT binary patch delta 89 zcmX@nsCcDGv7v>rg=q^jlk4;gI_w<0&J6wxz6=2jo(w(=uG9BUW0sz#%Wfo|%#hEJ o%TU0O$&ka4$`H>`0%YYfq_)3zVFqFrAZ7((w(aj-*l+#@0DrI>^Z)<= delta 37 ocmcc8qrg=q^jlWTjQD>D$Y05K~Nvu*ElWk2>C00~_DEBUG;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) + + print_compile_time.bat + @@ -136,6 +139,9 @@ _DEBUG;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) + + print_compile_time.bat + @@ -164,6 +170,9 @@ NDEBUG;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) + + print_compile_time.bat + @@ -192,8 +201,12 @@ NDEBUG;%(PreprocessorDefinitions) $(IntDir);%(AdditionalIncludeDirectories) + + print_compile_time.bat + + diff --git a/MusicPlayer2/MusicPlayer2.vcxproj.filters b/MusicPlayer2/MusicPlayer2.vcxproj.filters index 1de836b98..3cf2f0b0a 100644 --- a/MusicPlayer2/MusicPlayer2.vcxproj.filters +++ b/MusicPlayer2/MusicPlayer2.vcxproj.filters @@ -350,6 +350,7 @@ + diff --git a/MusicPlayer2/print_compile_time.bat b/MusicPlayer2/print_compile_time.bat new file mode 100644 index 000000000..07d8094c8 --- /dev/null +++ b/MusicPlayer2/print_compile_time.bat @@ -0,0 +1,4 @@ +REM ǰںʱ䣬浽compile_time.txtļ +del /F /Q compile_time.txt +echo %date:~0,10% >> compile_time.txt +echo %time:~0,8% >> compile_time.txt \ No newline at end of file diff --git a/MusicPlayer2/resource.h b/MusicPlayer2/resource.h index a98b4b7a7..8b7dad431 100644 --- a/MusicPlayer2/resource.h +++ b/MusicPlayer2/resource.h @@ -676,6 +676,8 @@ #define IDI_ICON19 540 #define IDI_RESTORE_D 540 #define IDS_LIGHT 540 +#define IDR_TEXT2 540 +#define IDR_COMPILE_TIME 540 #define IDS_SHOW_HIDE_PLAYER 541 #define IDC_STATIC_PATH 1001 #define IDC_LIST1 1002 @@ -1478,7 +1480,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 540 +#define _APS_NEXT_RESOURCE_VALUE 541 #define _APS_NEXT_COMMAND_VALUE 33343 #define _APS_NEXT_CONTROL_VALUE 1188 #define _APS_NEXT_SYMED_VALUE 101