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 a8b9fd2aa..ea582b470 100644 Binary files a/MusicPlayer2/MusicPlayer2.rc and b/MusicPlayer2/MusicPlayer2.rc differ diff --git a/MusicPlayer2/MusicPlayer2.vcxproj b/MusicPlayer2/MusicPlayer2.vcxproj index d4449ff19..b0671d7ef 100644 --- a/MusicPlayer2/MusicPlayer2.vcxproj +++ b/MusicPlayer2/MusicPlayer2.vcxproj @@ -112,6 +112,9 @@ _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