├── DiskMark.rc ├── res ├── DiskMark.ico ├── DiskMark.rc2 ├── DiskMark16.ico ├── DiskMarkA.ico ├── DiskMarkA16.ico ├── DiskMarkM.ico ├── DiskMarkM16.ico ├── DiskMarkS.ico ├── DiskMarkS16.ico ├── DiskMarkT.ico └── DiskMarkT16.ico ├── .gitignore ├── Library ├── stdafx.cpp ├── stdafx.h └── Resource.h ├── DiskMark.h ├── Priscilla ├── DarkMode.h ├── FontComboBoxFx.h ├── md5.h ├── SystemInfoFx.h ├── HeaderCtrlFx.h ├── ListCtrlFx.h ├── MainDialogFx.h ├── UAHMenuBar.h ├── UtilityFx.h ├── EditFx.h ├── CommonFx.h ├── ButtonFx.h ├── IatHook.h ├── StaticFx.h ├── FontComboBoxFx.cpp ├── ComboBoxFx.h ├── DialogFx.h ├── HeaderCtrlFx.cpp ├── UAHMenuBar.cpp ├── md5.cpp ├── DarkMode.cpp ├── ListCtrlFx.cpp ├── OsInfoFx.h ├── EditFx.cpp └── DialogFx.cpp ├── DeclareDPIAware.manifest ├── FontSelectionDlg.h ├── AboutDlg.h ├── DiskBench.h ├── .gitattributes ├── DiskMark.cpp ├── SettingsDlg.h ├── DiskMark.vcxproj.filters ├── DiskMark.sln ├── DiskMarkDlg.h ├── FontSelectionDlg.cpp └── AboutDlg.cpp /DiskMark.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/DiskMark.rc -------------------------------------------------------------------------------- /res/DiskMark.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMark.ico -------------------------------------------------------------------------------- /res/DiskMark.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMark.rc2 -------------------------------------------------------------------------------- /res/DiskMark16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMark16.ico -------------------------------------------------------------------------------- /res/DiskMarkA.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkA.ico -------------------------------------------------------------------------------- /res/DiskMarkA16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkA16.ico -------------------------------------------------------------------------------- /res/DiskMarkM.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkM.ico -------------------------------------------------------------------------------- /res/DiskMarkM16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkM16.ico -------------------------------------------------------------------------------- /res/DiskMarkS.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkS.ico -------------------------------------------------------------------------------- /res/DiskMarkS16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkS16.ico -------------------------------------------------------------------------------- /res/DiskMarkT.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkT.ico -------------------------------------------------------------------------------- /res/DiskMarkT16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hiyohiyo/CrystalDiskMark/HEAD/res/DiskMarkT16.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | Build/ 3 | DiskMark.vcxproj.user 4 | DiskMark.aps 5 | Priscilla/ScrollBarFx.cpp 6 | Priscilla/ScrollBarFx.h 7 | Priscilla/SliderCtrlFx.cpp 8 | Priscilla/SliderCtrlFx.h 9 | Priscilla/xpxlh4em.dva~ 10 | -------------------------------------------------------------------------------- /Library/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // DiskInfo.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | -------------------------------------------------------------------------------- /DiskMark.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "resource.h" 11 | 12 | class CDiskMarkApp : public CWinApp 13 | { 14 | public: 15 | CDiskMarkApp(); 16 | 17 | public: 18 | virtual BOOL InitInstance(); 19 | 20 | 21 | DECLARE_MESSAGE_MAP() 22 | }; 23 | 24 | extern CDiskMarkApp theApp; -------------------------------------------------------------------------------- /Priscilla/DarkMode.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : Richard Yu 3 | // Web : https://github.com/ysc3839/win32-darkmode 4 | // License : MIT License 5 | // https://github.com/ysc3839/win32-darkmode/blob/master/LICENSE 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | BOOL SetDarkMode(HWND hWnd); 11 | void UnsetDarkMode(HWND hWnd); 12 | void SetDarkModeControl(HWND hWnd, BOOL bDarkMode); 13 | 14 | void FixDarkScrollBar(); 15 | bool AllowDarkModeForWindow(HWND hWnd, bool allow); 16 | 17 | // BOOL InitDarkMode(); 18 | // void RefreshTitleBarThemeColor(HWND hWnd); 19 | -------------------------------------------------------------------------------- /Priscilla/FontComboBoxFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "ComboBoxFx.h" 11 | 12 | class CFontComboBox : public CComboBoxFx 13 | { 14 | DECLARE_DYNAMIC(CFontComboBox) 15 | 16 | public: 17 | CFontComboBox(); 18 | virtual ~CFontComboBox(); 19 | 20 | protected: 21 | DECLARE_MESSAGE_MAP() 22 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 23 | 24 | HBRUSH m_Brush; 25 | }; 26 | 27 | 28 | -------------------------------------------------------------------------------- /Priscilla/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5_H 2 | #define MD5_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | typedef signed char int8_t; 9 | typedef short int16_t; 10 | typedef int int32_t; 11 | typedef long long int64_t; 12 | 13 | typedef unsigned char uint8_t; 14 | typedef unsigned short uint16_t; 15 | typedef unsigned int uint32_t; 16 | typedef unsigned long long uint64_t; 17 | 18 | typedef struct{ 19 | uint64_t size; // Size of input in bytes 20 | uint32_t buffer[4]; // Current accumulation of hash 21 | uint8_t input[64]; // Input to be used in the next step 22 | uint8_t digest[16]; // Result of algorithm 23 | }MD5Context; 24 | 25 | void md5Init(MD5Context *ctx); 26 | void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len); 27 | void md5Finalize(MD5Context *ctx); 28 | void md5Step(uint32_t *buffer, uint32_t *input); 29 | 30 | void md5String(char *input, uint8_t *result); 31 | // void md5File(FILE *file, uint8_t *result); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /DeclareDPIAware.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | True/PM 19 | PerMonitorV2, PerMonitor 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Priscilla/SystemInfoFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | //------------------------------------------------ 13 | // System Info 14 | //------------------------------------------------ 15 | 16 | void GetCpuInfo(CString& cpuInfo, CString& cpuName, int* clock, int* cores, int* threads); 17 | void GetGpuInfo(CString& gpuInfo); 18 | void GetBaseBoardInfo(CString& baseBoardInfo); 19 | void GetComputerSystemInfo(CString& computerSystemInfo); 20 | void GetScreenInfo(CString& screenInfo, int* width, int* height, int* color, CString& smoothing); 21 | void GetMemoryInfo(CString& screenInfo, int* size = NULL); 22 | 23 | #if defined(_M_IX86) || defined(_M_X64) 24 | void GetCpuid(unsigned int param, unsigned int* _eax, unsigned int* _ebx, unsigned int* _ecx, unsigned int* _edx); 25 | void GetHypervisorVendorString(char* vendorString); 26 | #endif 27 | 28 | #if _MSC_VER <= 1310 29 | /// https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/124207 30 | BOOL IsCoProcessorPresent(); 31 | BOOL IsFMTOWNS(); 32 | #endif -------------------------------------------------------------------------------- /FontSelectionDlg.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "afxwin.h" 11 | #include "ButtonFx.h" 12 | #include "ComboBoxFx.h" 13 | #include "FontComboBoxFx.h" 14 | 15 | class CFontSelectionDlg : public CDialogFx 16 | { 17 | DECLARE_DYNAMIC(CFontSelectionDlg) 18 | 19 | static const int SIZE_X = 480; 20 | static const int SIZE_Y = 204; 21 | enum { IDD = IDD_FONT }; 22 | 23 | public: 24 | CFontSelectionDlg(CWnd* pParent = NULL); 25 | virtual ~CFontSelectionDlg(); 26 | 27 | protected: 28 | virtual void DoDataExchange(CDataExchange* pDX); 29 | virtual BOOL OnInitDialog(); 30 | virtual void UpdateDialogSize(); 31 | 32 | void SetDefaultFont(CString fontFace); 33 | 34 | DECLARE_MESSAGE_MAP() 35 | afx_msg void OnSetDefault(); 36 | afx_msg void OnOk(); 37 | 38 | CStaticFx m_LabelFontFace; 39 | CStaticFx m_LabelFontScale; 40 | CStaticFx m_LabelFontRender; 41 | CButtonFx m_CtrlOk; 42 | CButtonFx m_CtrlDefault; 43 | 44 | CFontComboBox m_CtrlFontFace; 45 | CComboBoxFx m_CtrlFontScale; 46 | CComboBoxFx m_CtrlFontRender; 47 | 48 | }; 49 | -------------------------------------------------------------------------------- /Priscilla/HeaderCtrlFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | 12 | class CHeaderCtrlFx : public CHeaderCtrl 13 | { 14 | DECLARE_DYNAMIC(CHeaderCtrlFx) 15 | 16 | public: 17 | CHeaderCtrlFx(); 18 | virtual ~CHeaderCtrlFx(); 19 | void InitControl(int x, int y, double zoomRatio, CDC* bkDC, CBitmap* ctrlBitmap, COLORREF textColor, COLORREF bkColor, COLORREF lineColor, int renderMode, BOOL bHighContrast, BOOL bDarkMode); 20 | void SetFontEx(CString face, int size, double zoomRatio, double fontRatio, LONG fontWeight, BYTE fontRender); 21 | 22 | protected: 23 | // Draw Control 24 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 25 | 26 | DECLARE_MESSAGE_MAP() 27 | afx_msg void OnPaint(); 28 | afx_msg LRESULT OnLayout(WPARAM wParam, LPARAM lParam); 29 | 30 | int m_X; 31 | int m_Y; 32 | COLORREF m_TextColor; 33 | COLORREF m_BkColor; 34 | COLORREF m_LineColor; 35 | double m_ZoomRatio; 36 | double m_FontRatio; 37 | int m_RenderMode; 38 | BOOL m_bHighContrast; 39 | BOOL m_bDarkMode; 40 | 41 | CFont m_Font; 42 | int m_FontSize; 43 | CDC* m_BkDC; 44 | CBitmap* m_CtrlBitmap; 45 | }; 46 | 47 | 48 | -------------------------------------------------------------------------------- /AboutDlg.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | #include "DialogFx.h" 10 | #include "StaticFx.h" 11 | #include "ButtonFx.h" 12 | 13 | class CAboutDlg : public CDialogFx 14 | { 15 | DECLARE_DYNCREATE(CAboutDlg) 16 | 17 | #ifdef SUISHO_AOI_SUPPORT 18 | static const int SIZE_X = 640; 19 | static const int SIZE_Y = 640; 20 | #elif MSI_MEI_SUPPORT 21 | static const int SIZE_X = 640; 22 | static const int SIZE_Y = 640; 23 | #elif SUISHO_SHIZUKU_SUPPORT 24 | static const int SIZE_X = 640; 25 | static const int SIZE_Y = 660; 26 | #else 27 | static const int SIZE_X = 540; 28 | static const int SIZE_Y = 168; 29 | #endif 30 | 31 | public: 32 | CAboutDlg(CWnd* pParent = NULL); 33 | virtual ~CAboutDlg(); 34 | 35 | enum { IDD = IDD_ABOUT }; 36 | 37 | protected: 38 | virtual void DoDataExchange(CDataExchange* pDX); 39 | virtual BOOL OnInitDialog(); 40 | virtual void UpdateDialogSize(); 41 | 42 | DECLARE_MESSAGE_MAP() 43 | afx_msg void OnLogo(); 44 | afx_msg void OnVersion(); 45 | afx_msg void OnLicense(); 46 | afx_msg void OnProjectSite1(); 47 | afx_msg void OnProjectSite2(); 48 | afx_msg void OnProjectSite3(); 49 | afx_msg void OnProjectSite4(); 50 | afx_msg void OnProjectSite5(); 51 | 52 | CButtonFx m_CtrlLogo; 53 | CButtonFx m_CtrlSecretVoice; 54 | CButtonFx m_CtrlProjectSite1; 55 | CButtonFx m_CtrlProjectSite2; 56 | CButtonFx m_CtrlProjectSite3; 57 | CButtonFx m_CtrlProjectSite4; 58 | CButtonFx m_CtrlProjectSite5; 59 | CButtonFx m_CtrlVersion; 60 | CButtonFx m_CtrlLicense; 61 | 62 | CStaticFx m_CtrlEdition; 63 | CStaticFx m_CtrlRelease; 64 | CStaticFx m_CtrlCopyright1; 65 | CStaticFx m_CtrlCopyright2; 66 | CStaticFx m_CtrlCopyright3; 67 | }; 68 | -------------------------------------------------------------------------------- /DiskBench.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #define TIMER_ID 5963 11 | 12 | // Common Message 13 | #define ALL_0X00_0FILL L"<0Fill>" 14 | 15 | // Benchmark 16 | #define BENCHMARK_READ 1 17 | #define BENCHMARK_WRITE 2 18 | #define BENCHMARK_READ_WRITE 3 19 | 20 | enum TEST_DATA_TYPE 21 | { 22 | TEST_DATA_RANDOM = 0, 23 | TEST_DATA_ALL0X00, 24 | TEST_DATA_ALL0XFF, 25 | }; 26 | 27 | enum AFFINITY_MODE 28 | { 29 | AFFINITY_DISABLED = 0, 30 | AFFINITY_ENABLED, 31 | }; 32 | 33 | enum PROFILE 34 | { 35 | PROFILE_DEFAULT = 0, 36 | PROFILE_PEAK, 37 | PROFILE_REAL, 38 | PROFILE_DEMO, 39 | PROFILE_DEFAULT_MIX, 40 | PROFILE_PEAK_MIX, 41 | PROFILE_REAL_MIX, 42 | }; 43 | 44 | enum DISK_SPD_CMD 45 | { 46 | TEST_CREATE_FILE = 0, 47 | TEST_DELETE_FILE, 48 | TEST_READ_0, 49 | TEST_READ_1, 50 | TEST_READ_2, 51 | TEST_READ_3, 52 | TEST_READ_4, 53 | TEST_READ_5, 54 | TEST_READ_6, 55 | TEST_READ_7, 56 | TEST_READ_8, 57 | TEST_WRITE_0, 58 | TEST_WRITE_1, 59 | TEST_WRITE_2, 60 | TEST_WRITE_3, 61 | TEST_WRITE_4, 62 | TEST_WRITE_5, 63 | TEST_WRITE_6, 64 | TEST_WRITE_7, 65 | TEST_WRITE_8, 66 | TEST_MIX_0, 67 | TEST_MIX_1, 68 | TEST_MIX_2, 69 | TEST_MIX_3, 70 | TEST_MIX_4, 71 | TEST_MIX_5, 72 | TEST_MIX_6, 73 | TEST_MIX_7, 74 | TEST_MIX_8, 75 | }; 76 | 77 | UINT ExecDiskBenchAll(LPVOID dlg); 78 | UINT ExecDiskBenchAllPeak(LPVOID dlg); 79 | UINT ExecDiskBenchAllReal(LPVOID dlg); 80 | UINT ExecDiskBenchAllDemo(LPVOID dlg); 81 | UINT ExecDiskBench0(LPVOID dlg); 82 | UINT ExecDiskBench1(LPVOID dlg); 83 | UINT ExecDiskBench2(LPVOID dlg); 84 | UINT ExecDiskBench3(LPVOID dlg); 85 | UINT ExecDiskBench4(LPVOID dlg); 86 | UINT ExecDiskBench5(LPVOID dlg); 87 | UINT ExecDiskBench6(LPVOID dlg); 88 | UINT ExecDiskBench7(LPVOID dlg); 89 | -------------------------------------------------------------------------------- /Priscilla/ListCtrlFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include "HeaderCtrlFx.h" 12 | #include 13 | #include 14 | #pragma comment(lib, "Gdiplus.lib") 15 | using namespace Gdiplus; 16 | 17 | class CListCtrlFx : public CListCtrl 18 | { 19 | DECLARE_DYNAMIC(CListCtrlFx) 20 | 21 | public: 22 | CListCtrlFx(); 23 | virtual ~CListCtrlFx(); 24 | 25 | void SetTextColor1(COLORREF color); 26 | void SetTextColor2(COLORREF color); 27 | void SetTextSelected(COLORREF color); 28 | void SetBkColor1(COLORREF color); 29 | void SetBkColor2(COLORREF color); 30 | void SetBkSelected(COLORREF color); 31 | void SetLineColor1(COLORREF color); 32 | void SetLineColor2(COLORREF color); 33 | void SetGlassColor(COLORREF glassColor, BYTE glassAlpha); 34 | 35 | COLORREF GetTextColor1(); 36 | COLORREF GetTextColor2(); 37 | COLORREF GetTextSelected(); 38 | COLORREF GetBkColor1(); 39 | COLORREF GetBkColor2(); 40 | COLORREF GetBkSelected(); 41 | COLORREF GetLineColor1(); 42 | COLORREF GetLineColor2(); 43 | 44 | BOOL InitControl(int x, int y, int width, int height, int maxWidth, int maxHeight, double zoomRatio, CDC* bkDC, int renderMode, BOOL bHighContrast, BOOL bDarkMode); 45 | void SetFontEx(CString face, int size, double zoomRatio, double fontRatio, LONG fontWeight, BYTE fontRender); 46 | void EnableHeaderOwnerDraw(BOOL bOwnerDraw); 47 | 48 | protected: 49 | virtual void PreSubclassWindow(); 50 | 51 | void SetupControlImage(CBitmap& bkBitmap, CBitmap& ctrlBitmap); 52 | 53 | DECLARE_MESSAGE_MAP() 54 | afx_msg void OnCustomdraw(NMHDR* pNMHDR, LRESULT* pResult); 55 | 56 | int m_X; 57 | int m_Y; 58 | BOOL m_bNT6orLater; 59 | CSize m_CtrlSize; 60 | CRect m_Margin; 61 | int m_RenderMode; 62 | BOOL m_bHighContrast; 63 | BOOL m_bDarkMode; 64 | CHeaderCtrlFx m_Header; 65 | 66 | COLORREF m_TextColor1; 67 | COLORREF m_TextColor2; 68 | COLORREF m_TextSelected; 69 | COLORREF m_BkColor1; 70 | COLORREF m_BkColor2; 71 | COLORREF m_BkSelected; 72 | COLORREF m_LineColor1; 73 | COLORREF m_LineColor2; 74 | 75 | CFont m_Font; 76 | CImageList m_Image; 77 | CDC* m_BkDC; 78 | 79 | // Glass 80 | COLORREF m_GlassColor; 81 | BYTE m_GlassAlpha; 82 | 83 | // Image 84 | CBitmap m_BkBitmap; 85 | CBitmap m_CtrlBitmap; 86 | CImage m_CtrlImage; 87 | }; 88 | 89 | 90 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | *.lang working-tree-encoding=UTF-16LE-BOM eol=CRLF 15 | 16 | ############################################################################### 17 | # Set the merge driver for project and solution files 18 | # 19 | # Merging from the command prompt will add diff markers to the files if there 20 | # are conflicts (Merging from VS is not affected by the settings below, in VS 21 | # the diff markers are never inserted). Diff markers may cause the following 22 | # file extensions to fail to load in VS. An alternative would be to treat 23 | # these files as binary and thus will always conflict and require user 24 | # intervention with every merge. To do so, just uncomment the entries below 25 | ############################################################################### 26 | #*.sln merge=binary 27 | #*.csproj merge=binary 28 | #*.vbproj merge=binary 29 | #*.vcxproj merge=binary 30 | #*.vcproj merge=binary 31 | #*.dbproj merge=binary 32 | #*.fsproj merge=binary 33 | #*.lsproj merge=binary 34 | #*.wixproj merge=binary 35 | #*.modelproj merge=binary 36 | #*.sqlproj merge=binary 37 | #*.wwaproj merge=binary 38 | 39 | ############################################################################### 40 | # behavior for image files 41 | # 42 | # image files are treated as binary by default. 43 | ############################################################################### 44 | #*.jpg binary 45 | #*.png binary 46 | #*.gif binary 47 | 48 | ############################################################################### 49 | # diff behavior for common document formats 50 | # 51 | # Convert binary document formats to text before diffing them. This feature 52 | # is only available from the command line. Turn it on by uncommenting the 53 | # entries below. 54 | ############################################################################### 55 | #*.doc diff=astextplain 56 | #*.DOC diff=astextplain 57 | #*.docx diff=astextplain 58 | #*.DOCX diff=astextplain 59 | #*.dot diff=astextplain 60 | #*.DOT diff=astextplain 61 | #*.pdf diff=astextplain 62 | #*.PDF diff=astextplain 63 | #*.rtf diff=astextplain 64 | #*.RTF diff=astextplain 65 | -------------------------------------------------------------------------------- /DiskMark.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "DiskMark.h" 10 | #include "DiskMarkDlg.h" 11 | 12 | #include 13 | #pragma comment(lib, "winmm.lib") 14 | 15 | #include 16 | 17 | #ifdef _DEBUG 18 | #define new DEBUG_NEW 19 | #endif 20 | 21 | BEGIN_MESSAGE_MAP(CDiskMarkApp, CWinApp) 22 | ON_COMMAND(ID_HELP, &CWinApp::OnHelp) 23 | END_MESSAGE_MAP() 24 | 25 | CDiskMarkApp::CDiskMarkApp() 26 | { 27 | } 28 | 29 | CDiskMarkApp theApp; 30 | 31 | //----------------------------------------------------------------------------- 32 | // Prototypes 33 | //----------------------------------------------------------------------------- 34 | static BOOL IsFileExistEx(const TCHAR* path, const TCHAR* fileName); 35 | static BOOL RunAsRestart(); 36 | 37 | BOOL CDiskMarkApp::InitInstance() 38 | { 39 | INITCOMMONCONTROLSEX InitCtrls; 40 | InitCtrls.dwSize = sizeof(InitCtrls); 41 | InitCtrls.dwICC = ICC_WIN95_CLASSES; 42 | InitCommonControlsEx(&InitCtrls); 43 | 44 | CWinApp::InitInstance(); 45 | 46 | #ifndef UWP 47 | if (! IsUserAnAdmin()) 48 | { 49 | if (RunAsRestart()) 50 | { 51 | return FALSE; 52 | } 53 | } 54 | #endif 55 | 56 | // Multimedia Timer Setting 57 | TIMECAPS tc; 58 | timeGetDevCaps(&tc,sizeof(TIMECAPS)); 59 | timeBeginPeriod(tc.wPeriodMin); 60 | 61 | BOOL flagReExec = FALSE; 62 | 63 | CDiskMarkDlg dlg; 64 | m_pMainWnd = &dlg; 65 | 66 | if (dlg.DoModal() == RE_EXEC) 67 | { 68 | flagReExec = TRUE; 69 | } 70 | 71 | timeEndPeriod(tc.wPeriodMin); 72 | 73 | if(flagReExec) 74 | { 75 | TCHAR str[MAX_PATH]; 76 | ::GetModuleFileName(NULL, str, MAX_PATH); 77 | ShellExecute(NULL, NULL, str, NULL, NULL, SW_SHOWNORMAL); 78 | } 79 | 80 | return FALSE; 81 | } 82 | 83 | BOOL IsFileExistEx(const TCHAR* path, const TCHAR* fileName) 84 | { 85 | if(! IsFileExist(path)) 86 | { 87 | CString cstr; 88 | cstr.Format(L"Not Found \"%s\".", fileName); 89 | AfxMessageBox(cstr); 90 | return FALSE; 91 | } 92 | return TRUE; 93 | } 94 | 95 | BOOL RunAsRestart() 96 | { 97 | int count; 98 | 99 | TCHAR** cmd = ::CommandLineToArgvW(::GetCommandLine(), &count); 100 | 101 | if (count < 2 || _tcscmp(cmd[1], L"runas") != 0) 102 | { 103 | TCHAR path[MAX_PATH]; 104 | ::GetModuleFileName(NULL, path, MAX_PATH); 105 | if (::ShellExecute(NULL, L"runas", path, L"runas", NULL, SW_SHOWNORMAL) > (HINSTANCE)32) 106 | { 107 | return TRUE; 108 | } 109 | } 110 | return FALSE; 111 | } -------------------------------------------------------------------------------- /Priscilla/MainDialogFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | #include "DialogFx.h" 10 | #include "UtilityFx.h" 11 | #include "OsInfoFx.h" 12 | #include "UAHMenuBar.h" 13 | 14 | class CMainDialogFx : public CDialogFx 15 | { 16 | public: 17 | CMainDialogFx(UINT dlgResouce, CWnd* pParent = NULL); 18 | virtual ~CMainDialogFx(); 19 | 20 | // Zoom 21 | DWORD GetZoomType(); 22 | void SetZoomType(DWORD zoomType); 23 | 24 | // Getter 25 | CString GetCurrentLangPath(); 26 | CString GetDefaultLangPath(); 27 | CString GetThemeDir(); 28 | CString GetCurrentTheme(); 29 | CString GetDefaultTheme(); 30 | CString GetParentTheme1(); 31 | CString GetParentTheme2(); 32 | CString GetIniPath(); 33 | 34 | void SaveImage(); 35 | 36 | protected: 37 | void InitMenu(); 38 | void InitThemeLang(); 39 | void ChangeTheme(CString themeName); 40 | void SetWindowTitle(CString message); 41 | void UpdateThemeInfo(); 42 | COLORREF GetControlColor(CString name, BYTE defaultColor, CString theme); 43 | COLORREF GetBackgroundColor(CString name, CString theme); 44 | BYTE GetControlAlpha(CString name, BYTE defaultAlpha, CString theme); 45 | BYTE GetCharacterPosition(CString theme); 46 | CString GetParentTheme(int i, CString theme); 47 | CString GetRandomTheme(); 48 | void SaveImageDlg(CImage* image); 49 | 50 | virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); 51 | virtual BOOL OnInitDialog(); 52 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 53 | virtual BOOL CheckThemeEdition(CString name); 54 | virtual CString GetDefaultFont(); 55 | 56 | virtual void SaveWindowPosition(); 57 | virtual void RestoreWindowPosition(); 58 | 59 | DECLARE_MESSAGE_MAP() 60 | afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos); 61 | afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI); 62 | 63 | // Common 64 | BOOL m_bStartup; 65 | BOOL m_bWindowMinimizeOnce; 66 | BOOL m_bResident; 67 | BOOL m_bResidentMinimize; 68 | 69 | // Theme 70 | CString m_ThemeKeyName; 71 | CString m_RecommendTheme; 72 | CStringArray m_MenuArrayTheme; 73 | 74 | // Language 75 | CStringArray m_MenuArrayLang; 76 | 77 | #ifdef OPTION_TASK_TRAY 78 | // Task Tray 79 | static UINT wmTaskbarCreated; 80 | BOOL AddTaskTray(UINT id, UINT callback, HICON icon, CString tip); 81 | BOOL RemoveTaskTray(UINT id); 82 | BOOL ModifyTaskTray(UINT id, HICON icon, CString tip); 83 | BOOL ModifyTaskTrayIcon(UINT id, HICON icon); 84 | BOOL ModifyTaskTrayTip(UINT id, CString tip); 85 | BOOL ShowBalloon(UINT id, DWORD infoFlag, CString infoTitle, CString info); 86 | #endif 87 | 88 | }; -------------------------------------------------------------------------------- /Priscilla/UAHMenuBar.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : adzm 3 | // Web : https://github.com/adzm/win32-custom-menubar-aero-theme 4 | // License : MIT License 5 | // https://github.com/adzm/win32-custom-menubar-aero-theme/blob/main/LICENSE 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | // processes messages related to UAH / custom menubar drawing. 11 | // return true if handled, false to continue with normal processing in your wndproc 12 | bool UAHWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lr); 13 | 14 | // window messages related to menu bar drawing 15 | #define WM_UAHDESTROYWINDOW 0x0090 // handled by DefWindowProc 16 | #define WM_UAHDRAWMENU 0x0091 // lParam is UAHMENU 17 | #define WM_UAHDRAWMENUITEM 0x0092 // lParam is UAHDRAWMENUITEM 18 | #define WM_UAHINITMENU 0x0093 // handled by DefWindowProc 19 | #define WM_UAHMEASUREMENUITEM 0x0094 // lParam is UAHMEASUREMENUITEM 20 | #define WM_UAHNCPAINTMENUPOPUP 0x0095 // handled by DefWindowProc 21 | 22 | // describes the sizes of the menu bar or menu item 23 | typedef union tagUAHMENUITEMMETRICS 24 | { 25 | // cx appears to be 14 / 0xE less than rcItem's width! 26 | // cy 0x14 seems stable, i wonder if it is 4 less than rcItem's height which is always 24 atm 27 | struct { 28 | DWORD cx; 29 | DWORD cy; 30 | } rgsizeBar[2]; 31 | struct { 32 | DWORD cx; 33 | DWORD cy; 34 | } rgsizePopup[4]; 35 | } UAHMENUITEMMETRICS; 36 | 37 | // not really used in our case but part of the other structures 38 | typedef struct tagUAHMENUPOPUPMETRICS 39 | { 40 | DWORD rgcx[4]; 41 | DWORD fUpdateMaxWidths : 2; // from kernel symbols, padded to full dword 42 | } UAHMENUPOPUPMETRICS; 43 | 44 | // hmenu is the main window menu; hdc is the context to draw in 45 | typedef struct tagUAHMENU 46 | { 47 | HMENU hmenu; 48 | HDC hdc; 49 | DWORD dwFlags; // no idea what these mean, in my testing it's either 0x00000a00 or sometimes 0x00000a10 50 | } UAHMENU; 51 | 52 | // menu items are always referred to by iPosition here 53 | typedef struct tagUAHMENUITEM 54 | { 55 | int iPosition; // 0-based position of menu item in menubar 56 | UAHMENUITEMMETRICS umim; 57 | UAHMENUPOPUPMETRICS umpm; 58 | } UAHMENUITEM; 59 | 60 | // the DRAWITEMSTRUCT contains the states of the menu items, as well as 61 | // the position index of the item in the menu, which is duplicated in 62 | // the UAHMENUITEM's iPosition as well 63 | typedef struct UAHDRAWMENUITEM 64 | { 65 | DRAWITEMSTRUCT dis; // itemID looks uninitialized 66 | UAHMENU um; 67 | UAHMENUITEM umi; 68 | } UAHDRAWMENUITEM; 69 | 70 | // the MEASUREITEMSTRUCT is intended to be filled with the size of the item 71 | // height appears to be ignored, but width can be modified 72 | typedef struct tagUAHMEASUREMENUITEM 73 | { 74 | MEASUREITEMSTRUCT mis; 75 | UAHMENU um; 76 | UAHMENUITEM umi; 77 | } UAHMEASUREMENUITEM; 78 | 79 | -------------------------------------------------------------------------------- /Priscilla/UtilityFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | ////------------------------------------------------ 11 | // Debug 12 | ////------------------------------------------------ 13 | 14 | void SetDebugMode(DWORD mode); 15 | void DebugPrint(CString cstr); 16 | 17 | ////------------------------------------------------ 18 | // File Information 19 | ////------------------------------------------------ 20 | 21 | int GetFileVersion(const TCHAR* fileName, TCHAR* version = NULL); 22 | void GetFileVersionEx(const TCHAR* file, CString& version); 23 | BOOL IsFileExist(const TCHAR* fileName); 24 | BOOL CanWriteFile(const TCHAR* fileName); 25 | 26 | ////------------------------------------------------ 27 | // Utility 28 | ////------------------------------------------------ 29 | 30 | ULONGLONG GetTickCountFx(); 31 | 32 | ULONG64 B8toB64(BYTE b0, BYTE b1 = 0, BYTE b2 = 0, BYTE b3 = 0, BYTE b4 = 0, BYTE b5 = 0, BYTE b6 = 0, BYTE b7 = 0); 33 | DWORD B8toB32(BYTE b0, BYTE b1 = 0, BYTE b2 = 0, BYTE b3 = 0); 34 | void SplitCString(const CString& str, const CString& delimiter, CStringArray& arr); 35 | 36 | ////------------------------------------------------ 37 | // .ini support function 38 | ////------------------------------------------------ 39 | 40 | DWORD GetPrivateProfileStringFx(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString,DWORD nSize,LPCTSTR lpFileName); 41 | UINT GetPrivateProfileIntFx(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nDefault, LPCTSTR lpFileName); 42 | BOOL WritePrivateProfileStringFx(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName); 43 | 44 | ////------------------------------------------------ 45 | // Check CodeSign 46 | ////------------------------------------------------ 47 | 48 | #if _MSC_VER > 1310 49 | BOOL CheckCodeSign(LPCWSTR certName, LPCWSTR filePath); 50 | #endif 51 | 52 | ////------------------------------------------------ 53 | // Play Sound 54 | ////------------------------------------------------ 55 | 56 | BOOL AlertSound(const CString& alertSoundPath, int volume); 57 | 58 | ////------------------------------------------------ 59 | // Hash 60 | ////------------------------------------------------ 61 | 62 | CStringA MD5(const CStringA& str); 63 | 64 | ////------------------------------------------------ 65 | // Character Converter 66 | ////------------------------------------------------ 67 | 68 | CStringW UTF8toUTF16(const CStringA& utf8str); 69 | CStringA UTF16toUTF8(const CStringW& utf16str); 70 | CStringA URLEncode(const CStringA& str); 71 | CStringA UE(const CStringW& utf16str); 72 | CStringA UE(const CStringA& ansiStr); 73 | 74 | ////------------------------------------------------ 75 | // Clipboard 76 | ////------------------------------------------------ 77 | 78 | void SetClipboardText(CString clip); -------------------------------------------------------------------------------- /Priscilla/EditFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include 12 | #include 13 | #pragma comment(lib, "Gdiplus.lib") 14 | using namespace Gdiplus; 15 | 16 | class CEditFx : public CEdit 17 | { 18 | DECLARE_DYNAMIC(CEditFx); 19 | 20 | public: 21 | // Constructors 22 | CEditFx(); 23 | virtual ~CEditFx(); 24 | 25 | // Control 26 | BOOL InitControl(int x, int y, int width, int height, double zoomRatio, CDC* bkDC, LPCTSTR imagePath, 27 | int imageCount, DWORD textAlign, int renderMode, BOOL bHighContrast, BOOL bDarkMode, BOOL bDrawFrame, BOOL bMultiLine = FALSE); 28 | void SetMargin(int top, int left, int bottom, int right, double zoomRatio); 29 | CSize GetSize(void); 30 | void SetDrawFrame(BOOL bDrawFrame); 31 | void SetGlassColor(COLORREF glassColor, BYTE glassAlpha); 32 | void SetBkColor(COLORREF bkColor); 33 | void Adjust(); 34 | 35 | // Font 36 | void SetFontEx(CString face, int size, int sizeToolTip, double zoomRatio, double fontRatio = 1.0, 37 | COLORREF textColor = RGB(0, 0, 0), LONG fontWeight = FW_NORMAL, BYTE fontRender = CLEARTYPE_NATURAL_QUALITY); 38 | 39 | // ToolTip 40 | void SetToolTipText(LPCTSTR text); 41 | void SetToolTipActivate(BOOL bActivate = TRUE); 42 | void SetToolTipWindowText(LPCTSTR text); 43 | CString GetToolTipText(); 44 | 45 | protected: 46 | // Image 47 | BOOL LoadBitmap(LPCTSTR fileName); 48 | BOOL LoadBitmap(HBITMAP hBitmap); 49 | void SetBkReload(void); 50 | BOOL SetBitmap(CBitmap& bitmap); 51 | void LoadCtrlBk(CDC* drawDC); 52 | void SetupControlImage(CBitmap& bkBitmap, CBitmap& ctrlBitmap); 53 | 54 | // ToolTip 55 | void InitToolTip(); 56 | virtual BOOL PreTranslateMessage(MSG* pMsg); 57 | 58 | // MessageMap 59 | DECLARE_MESSAGE_MAP() 60 | afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); 61 | afx_msg void OnEnChange(); 62 | afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 63 | 64 | protected: 65 | // Control 66 | int m_X; 67 | int m_Y; 68 | CSize m_CtrlSize; 69 | CRect m_Margin; 70 | int m_RenderMode; 71 | BOOL m_bHighContrast; 72 | BOOL m_bDarkMode; 73 | BOOL m_bDrawFrame; 74 | COLORREF m_FrameColor; 75 | BOOL m_bMultiLine; 76 | COLORREF m_BkColor; 77 | 78 | // Glass 79 | COLORREF m_GlassColor; 80 | BYTE m_GlassAlpha; 81 | 82 | // Image 83 | CString m_ImagePath; 84 | int m_ImageCount; 85 | CDC* m_BkDC; 86 | CBitmap m_BkBitmap; 87 | CBrush m_BkBrush; 88 | BOOL m_bBkBitmapInit; 89 | BOOL m_bBkLoad; 90 | CBitmap m_CtrlBitmap; 91 | CImage m_CtrlImage; 92 | 93 | // Font 94 | DWORD m_TextAlign; 95 | CFont m_Font; 96 | CFont m_FontToolTip; 97 | COLORREF m_TextColor; 98 | 99 | // ToolTip 100 | CToolTipCtrl m_ToolTip; 101 | CString m_ToolTipText; 102 | }; 103 | -------------------------------------------------------------------------------- /SettingsDlg.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "DialogFx.h" 11 | #include "StaticFx.h" 12 | #include "ButtonFx.h" 13 | #include "ComboBoxFx.h" 14 | 15 | class CSettingsDlg : public CDialogFx 16 | { 17 | DECLARE_DYNCREATE(CSettingsDlg) 18 | 19 | #ifdef SUISHO_SHIZUKU_SUPPORT 20 | static const int SIZE_X = 680; 21 | static const int SIZE_Y = 416; 22 | #else 23 | static const int SIZE_X = 440; 24 | static const int SIZE_Y = 356; 25 | #endif 26 | 27 | public: 28 | CSettingsDlg(CWnd* pParent = NULL); 29 | virtual ~CSettingsDlg(); 30 | 31 | enum { IDD = IDD_SETTINGS }; 32 | 33 | protected: 34 | virtual void DoDataExchange(CDataExchange* pDX); 35 | virtual BOOL OnInitDialog(); 36 | virtual void OnCancel(); 37 | 38 | void UpdateDialogSize(); 39 | int GetBlockSize(CString text); 40 | int GetType(CString text); 41 | 42 | CStaticFx m_LabelType; 43 | CStaticFx m_LabelSize; 44 | CStaticFx m_LabelQueues; 45 | CStaticFx m_LabelThreads; 46 | CStaticFx m_LabelDefault; 47 | CStaticFx m_LabelPeak; 48 | CStaticFx m_LabelDemo; 49 | CStaticFx m_LabelMeasureTime; 50 | CStaticFx m_LabelIntervalTime; 51 | 52 | CComboBoxFx m_ComboBenchType0; 53 | CComboBoxFx m_ComboBenchType1; 54 | CComboBoxFx m_ComboBenchType2; 55 | CComboBoxFx m_ComboBenchType3; 56 | CComboBoxFx m_ComboBenchType4; 57 | CComboBoxFx m_ComboBenchType5; 58 | CComboBoxFx m_ComboBenchType8; 59 | CComboBoxFx m_ComboBenchSize0; 60 | CComboBoxFx m_ComboBenchSize1; 61 | CComboBoxFx m_ComboBenchSize2; 62 | CComboBoxFx m_ComboBenchSize3; 63 | CComboBoxFx m_ComboBenchSize4; 64 | CComboBoxFx m_ComboBenchSize5; 65 | CComboBoxFx m_ComboBenchSize8; 66 | CComboBoxFx m_ComboBenchQueues0; 67 | CComboBoxFx m_ComboBenchQueues1; 68 | CComboBoxFx m_ComboBenchQueues2; 69 | CComboBoxFx m_ComboBenchQueues3; 70 | CComboBoxFx m_ComboBenchQueues4; 71 | CComboBoxFx m_ComboBenchQueues5; 72 | CComboBoxFx m_ComboBenchQueues8; 73 | CComboBoxFx m_ComboBenchThreads0; 74 | CComboBoxFx m_ComboBenchThreads1; 75 | CComboBoxFx m_ComboBenchThreads2; 76 | CComboBoxFx m_ComboBenchThreads3; 77 | CComboBoxFx m_ComboBenchThreads4; 78 | CComboBoxFx m_ComboBenchThreads5; 79 | CComboBoxFx m_ComboBenchThreads8; 80 | 81 | // CComboBoxFx m_ComboAffinity; 82 | // CComboBoxFx m_ComboData; 83 | CComboBoxFx m_ComboMeasureTime; 84 | CComboBoxFx m_ComboIntervalTime; 85 | 86 | CButtonFx m_ButtonSetDefault; 87 | CButtonFx m_ButtonSetNVMe8; 88 | CButtonFx m_ButtonSetFlashMemory; 89 | CButtonFx m_ButtonOk; 90 | 91 | void OnSetDefault(); 92 | void OnSetNVMe8(); 93 | void OnSetFlashMemory(); 94 | void OnOk(); 95 | void InitComboBox(); 96 | 97 | int m_BenchType[9]; 98 | int m_BenchSize[9]; 99 | int m_BenchQueues[9]; 100 | int m_BenchThreads[9]; 101 | 102 | int m_TestData; 103 | int m_MeasureTime; 104 | int m_IntervalTime; 105 | DWORD m_Profile; 106 | 107 | DECLARE_MESSAGE_MAP() 108 | }; 109 | -------------------------------------------------------------------------------- /Priscilla/CommonFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | //------------------------------------------------ 11 | // Naming Conventions 12 | //------------------------------------------------ 13 | // BOOL bXxxxYyyy 14 | // HANDLE hXxxxYyyy 15 | // Pointer pXxxxYyyy 16 | // Function SampleFunction 17 | // Variable sampleVariable 18 | // Const Value ConstVaiable 19 | // Member Variable m_XxxxYyyy 20 | 21 | //------------------------------------------------ 22 | // Order for C*****Fx Control 23 | //------------------------------------------------ 24 | // Control > Draw Control > Image > Font > Mouse > ToolTip 25 | // 26 | 27 | //------------------------------------------------ 28 | // Utility Macros 29 | //------------------------------------------------ 30 | 31 | #define SAFE_DELETE(p) {if(p){delete (p);(p)=NULL;}} 32 | 33 | #if _MSC_VER > 1310 34 | #define MENU_MODIFY_MENU menu->ModifyMenu 35 | #define SUBMENU_MODIFY_MENU subMenu.ModifyMenu 36 | #else 37 | #define MENU_MODIFY_MENU if(!IsNT3())menu->ModifyMenu 38 | #define SUBMENU_MODIFY_MENU if(!IsNT3())subMenu.ModifyMenu 39 | #endif 40 | 41 | //------------------------------------------------ 42 | // WM_APP 43 | //------------------------------------------------ 44 | // WM_APP + 0x0000-0x0BFF: User Application 45 | // WM_APP + 0x0C00-0x0FFF: Project Priscilla 46 | // WM_APP + 0x0C00-0x0CFF: Theme 47 | // WM_APP + 0x0D00-0x0DFF: Language 48 | // WP_APP + 0x0E00-0x0FFF: Reserved 49 | // WM_APP + 0x1000-0x3FFF: User Application 50 | 51 | #define WM_THEME_ID (WM_APP + 0x0C00) 52 | #define WM_LANGUAGE_ID (WM_APP + 0x0D00) 53 | 54 | //------------------------------------------------ 55 | // TIMER ID 56 | //------------------------------------------------ 57 | // 0x0000 - 0x0FFF: Project Priscilla 58 | // 0x1000 - : User Application 59 | 60 | static const int TimerUpdateDialogSizeDpiChanged = 0x0001; 61 | static const int TimerUpdateDialogSizeDisplayChange = 0x0002; 62 | static const int TimerUpdateDialogSizeSysColorChange = 0x0003; 63 | static const int TimerUpdateDialogSizeSettingChange = 0x0004; 64 | 65 | //------------------------------------------------ 66 | // Const Values 67 | //------------------------------------------------ 68 | 69 | static const int ControlImageNormal = 0x0000; 70 | static const int ControlImageHover = 0x0001; 71 | static const int ControlImageFocus = 0x0002; 72 | static const int ControlImageSelected = 0x0003; 73 | static const int ControlImageDisabled = 0x0004; 74 | 75 | static const int SystemDraw = 0x0001; 76 | static const int OwnerDrawImage = 0x0002; 77 | static const int OwnerDrawGlass = 0x0004; 78 | static const int OwnerDrawTransparent = 0x0008; 79 | 80 | static const int ZoomTypeAuto = 0; 81 | static const int ZoomType050 = 50; 82 | static const int ZoomType064 = 64; 83 | static const int ZoomType075 = 75; 84 | static const int ZoomType100 = 100; 85 | static const int ZoomType125 = 125; 86 | static const int ZoomType150 = 150; 87 | static const int ZoomType200 = 200; 88 | static const int ZoomType250 = 250; 89 | static const int ZoomType300 = 300; -------------------------------------------------------------------------------- /Priscilla/ButtonFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include 12 | #include 13 | #include 14 | #pragma comment(lib, "Gdiplus.lib") 15 | using namespace Gdiplus; 16 | 17 | class CButtonFx : public CButton 18 | { 19 | DECLARE_DYNAMIC(CButtonFx); 20 | 21 | public: 22 | // Constructors 23 | CButtonFx(); 24 | virtual ~CButtonFx(); 25 | 26 | // Control 27 | BOOL InitControl(int x, int y, int width, int height, double zoomRatio, HPALETTE hPal, CDC* bkDC, 28 | LPCTSTR imagePath, int imageCount, DWORD textAlign, int renderMode, BOOL bHighContrast, BOOL bDarkMode, BOOL bDrawFrame); 29 | BOOL ReloadImage(LPCTSTR imagePath, UINT imageCount); 30 | void SetMargin(int top, int left, int bottom, int right, double zoomRatio); 31 | CSize GetSize(void); 32 | void SetDrawFrame(BOOL bDrawFrame); 33 | void SetGlassColor(COLORREF glassColor, BYTE glassAlpha); 34 | void SetMeter(BOOL bMeter, double meterRatio); 35 | void SetLabelUnit(CString label, CString unit); 36 | void SetLabelUnitFormat(UINT labelFormat, UINT unitFormat); 37 | void SetTextFormat(UINT format); 38 | 39 | // Font 40 | void SetFontEx(CString face, int size, int sizeToolTip, double zoomRatio, double fontRatio = 1.0, 41 | COLORREF textColor = RGB(0, 0, 0), LONG fontWeight = FW_NORMAL, BYTE fontRender = CLEARTYPE_NATURAL_QUALITY); 42 | 43 | // Mouse 44 | void SetHandCursor(BOOL bHandCuror = TRUE); 45 | void SetSelected(BOOL bSelected = TRUE); 46 | 47 | // ToolTip 48 | void SetToolTipText(LPCTSTR text); 49 | void SetToolTipActivate(BOOL bActivate = TRUE); 50 | void SetToolTipWindowText(LPCTSTR text); 51 | CString GetToolTipText(); 52 | 53 | protected: 54 | // Draw Control 55 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 56 | virtual void DrawControl(CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct, CBitmap& ctrlBitmap, CBitmap& bkBitmap, int no); 57 | virtual void DrawString(CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct); 58 | 59 | // Image 60 | BOOL LoadBitmap(LPCTSTR pFileName); 61 | BOOL LoadBitmap(HBITMAP hBitmap); 62 | void SetBkReload(void); 63 | BOOL SetBitmap(CBitmap& bitmap); 64 | void LoadCtrlBk(CDC* drawDC); 65 | 66 | // ToolTip 67 | void InitToolTip(); 68 | virtual BOOL PreTranslateMessage(MSG* pMsg); 69 | 70 | // Message Map 71 | DECLARE_MESSAGE_MAP() 72 | afx_msg BOOL OnEraseBkgnd(CDC* pDC); 73 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 74 | afx_msg void OnMouseHover(UINT nFlags, CPoint point); 75 | afx_msg void OnMouseLeave(); 76 | afx_msg void OnKillfocus(); 77 | afx_msg void OnSetfocus(); 78 | afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); 79 | 80 | protected: 81 | // Control 82 | int m_X; 83 | int m_Y; 84 | CSize m_CtrlSize; 85 | CRect m_Margin; 86 | int m_RenderMode; 87 | BOOL m_bHighContrast; 88 | BOOL m_bDarkMode; 89 | BOOL m_bDrawFrame; 90 | COLORREF m_FrameColor; 91 | HPALETTE m_hPal; 92 | 93 | CString m_Label; 94 | CString m_Unit; 95 | 96 | UINT m_TextFormat; 97 | UINT m_LabelFormat; 98 | UINT m_UnitFormat; 99 | 100 | // Glass 101 | COLORREF m_GlassColor; 102 | BYTE m_GlassAlpha; 103 | 104 | // Meter 105 | BOOL m_bMeter; 106 | double m_MeterRatio; 107 | 108 | // Image 109 | CString m_ImagePath; 110 | int m_ImageCount; 111 | CDC* m_BkDC; 112 | CBitmap m_BkBitmap; 113 | BOOL m_bBkBitmapInit; 114 | BOOL m_bBkLoad; 115 | CBitmap m_CtrlBitmap; 116 | CImage m_CtrlImage; 117 | 118 | // Font 119 | DWORD m_TextAlign; 120 | CFont m_Font; 121 | CFont m_FontToolTip; 122 | COLORREF m_TextColor; 123 | 124 | // ToolTip 125 | CToolTipCtrl m_ToolTip; 126 | CString m_ToolTipText; 127 | 128 | // Mouse 129 | BOOL m_bHover; 130 | BOOL m_bFocas; 131 | BOOL m_bTrackingNow; 132 | BOOL m_bHandCursor; 133 | BOOL m_bSelected; 134 | }; 135 | -------------------------------------------------------------------------------- /Priscilla/IatHook.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : Richard Yu 3 | // Web : https://github.com/ysc3839/win32-darkmode 4 | // License : The MIT License 5 | // https://github.com/ysc3839/win32-darkmode/blob/master/LICENSE 6 | /*---------------------------------------------------------------------------*/ 7 | // This file contains code from 8 | // https://github.com/stevemk14ebr/PolyHook_2_0/blob/master/sources/IatHook.cpp 9 | // which is licensed under the MIT License. 10 | // See PolyHook_2_0-LICENSE for more information. 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | template 17 | constexpr T RVA2VA(T1 base, T2 rva) 18 | { 19 | return reinterpret_cast(reinterpret_cast(base) + rva); 20 | } 21 | 22 | template 23 | constexpr T DataDirectoryFromModuleBase(void *moduleBase, size_t entryID) 24 | { 25 | auto dosHdr = reinterpret_cast(moduleBase); 26 | auto ntHdr = RVA2VA(moduleBase, dosHdr->e_lfanew); 27 | auto dataDir = ntHdr->OptionalHeader.DataDirectory; 28 | return RVA2VA(moduleBase, dataDir[entryID].VirtualAddress); 29 | } 30 | 31 | PIMAGE_THUNK_DATA FindAddressByName(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, const char *funcName) 32 | { 33 | for (; impName->u1.Ordinal; ++impName, ++impAddr) 34 | { 35 | if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal)) 36 | continue; 37 | 38 | auto import = RVA2VA(moduleBase, impName->u1.AddressOfData); 39 | if (strcmp(import->Name, funcName) != 0) 40 | continue; 41 | return impAddr; 42 | } 43 | return nullptr; 44 | } 45 | 46 | PIMAGE_THUNK_DATA FindAddressByOrdinal(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, uint16_t ordinal) 47 | { 48 | for (; impName->u1.Ordinal; ++impName, ++impAddr) 49 | { 50 | if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal) && IMAGE_ORDINAL(impName->u1.Ordinal) == ordinal) 51 | return impAddr; 52 | } 53 | return nullptr; 54 | } 55 | 56 | PIMAGE_THUNK_DATA FindIatThunkInModule(void *moduleBase, const char *dllName, const char *funcName) 57 | { 58 | auto imports = DataDirectoryFromModuleBase(moduleBase, IMAGE_DIRECTORY_ENTRY_IMPORT); 59 | for (; imports->Name; ++imports) 60 | { 61 | if (_stricmp(RVA2VA(moduleBase, imports->Name), dllName) != 0) 62 | continue; 63 | 64 | auto origThunk = RVA2VA(moduleBase, imports->OriginalFirstThunk); 65 | auto thunk = RVA2VA(moduleBase, imports->FirstThunk); 66 | return FindAddressByName(moduleBase, origThunk, thunk, funcName); 67 | } 68 | return nullptr; 69 | } 70 | 71 | PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, const char *funcName) 72 | { 73 | auto imports = DataDirectoryFromModuleBase(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT); 74 | for (; imports->DllNameRVA; ++imports) 75 | { 76 | if (_stricmp(RVA2VA(moduleBase, imports->DllNameRVA), dllName) != 0) 77 | continue; 78 | 79 | auto impName = RVA2VA(moduleBase, imports->ImportNameTableRVA); 80 | auto impAddr = RVA2VA(moduleBase, imports->ImportAddressTableRVA); 81 | return FindAddressByName(moduleBase, impName, impAddr, funcName); 82 | } 83 | return nullptr; 84 | } 85 | 86 | PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, uint16_t ordinal) 87 | { 88 | auto imports = DataDirectoryFromModuleBase(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT); 89 | for (; imports->DllNameRVA; ++imports) 90 | { 91 | if (_stricmp(RVA2VA(moduleBase, imports->DllNameRVA), dllName) != 0) 92 | continue; 93 | 94 | auto impName = RVA2VA(moduleBase, imports->ImportNameTableRVA); 95 | auto impAddr = RVA2VA(moduleBase, imports->ImportAddressTableRVA); 96 | return FindAddressByOrdinal(moduleBase, impName, impAddr, ordinal); 97 | } 98 | return nullptr; 99 | } 100 | -------------------------------------------------------------------------------- /Priscilla/StaticFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include 12 | #include 13 | #pragma comment(lib, "Gdiplus.lib") 14 | using namespace Gdiplus; 15 | 16 | class CStaticFx : public CStatic 17 | { 18 | DECLARE_DYNAMIC(CStaticFx); 19 | 20 | enum Border 21 | { 22 | NO_BORDER = 0, // FALSE 23 | SYSTEM_BORDER = 1, // TRUE 24 | UNDERLINE = 2, 25 | }; 26 | 27 | public: 28 | // Constructors 29 | CStaticFx(); 30 | virtual ~CStaticFx(); 31 | 32 | // Control 33 | BOOL InitControl(int x, int y, int width, int height, double zoomRatio, HPALETTE hPal, CDC* bkDC, 34 | LPCTSTR imagePath, int imageCount, DWORD textAlign, int renderMode, BOOL bHighContrast, BOOL bDarkMode, DWORD drawFrame); 35 | void SetMargin(int top, int left, int bottom, int right, double zoomRatio); 36 | CSize GetSize(void); 37 | void SetDrawFrame(BOOL bDrawFrame); 38 | void SetDrawFrameEx(BOOL bDrawFrame, COLORREF frameColor = RGB(128, 128, 128)); 39 | void SetGlassColor(COLORREF glassColor, BYTE glassAlpha); 40 | void SetMeter(BOOL bMeter, double meterRatio); 41 | void SetLabelUnit(CString label, CString unit); 42 | void SetLabelUnitFormat(UINT labelFormat, UINT unitFormat); 43 | void SetTextFormat(UINT format); 44 | 45 | // Font 46 | void SetFontEx(CString face, int size, int sizeToolTip, double zoomRatio, double fontRatio = 1.0, 47 | COLORREF textColor = RGB(0, 0, 0), LONG fontWeight = FW_NORMAL, BYTE fontRender = CLEARTYPE_NATURAL_QUALITY); 48 | 49 | // ToolTip 50 | void SetToolTipText(LPCTSTR pText); 51 | void SetToolTipActivate(BOOL bActivate = TRUE); 52 | void SetToolTipWindowText(LPCTSTR pText); 53 | CString GetToolTipText(); 54 | 55 | // Mouse 56 | void SetHandCursor(BOOL bHandCuror = TRUE); 57 | 58 | protected: 59 | // Draw Control 60 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 61 | virtual void DrawControl(CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct, CBitmap& ctrlBitmap, CBitmap& bkBitmap, int no); 62 | virtual void DrawString(CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct); 63 | 64 | // Image 65 | BOOL LoadBitmap(LPCTSTR fileName); 66 | BOOL LoadBitmap(HBITMAP hBitmap); 67 | void SetBkReload(void); 68 | BOOL SetBitmap(CBitmap& bitmap); 69 | void LoadCtrlBk(CDC* drawDC); 70 | 71 | // ToolTip 72 | void InitToolTip(); 73 | virtual BOOL PreTranslateMessage(MSG* pMsg); 74 | 75 | // Message Map 76 | DECLARE_MESSAGE_MAP() 77 | afx_msg BOOL OnEraseBkgnd(CDC* pDC); 78 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 79 | afx_msg void OnMouseHover(UINT nFlags, CPoint point); 80 | afx_msg void OnMouseLeave(); 81 | afx_msg void OnKillfocus(); 82 | afx_msg void OnSetfocus(); 83 | afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); 84 | 85 | protected: 86 | // Control 87 | int m_X; 88 | int m_Y; 89 | CSize m_CtrlSize; 90 | CRect m_Margin; 91 | int m_RenderMode; 92 | BOOL m_bHighContrast; 93 | BOOL m_bDarkMode; 94 | DWORD m_DrawFrame; 95 | BOOL m_bDrawFrameEx; 96 | COLORREF m_FrameColor; 97 | HPALETTE m_hPal; 98 | 99 | CString m_Label; 100 | CString m_Unit; 101 | 102 | UINT m_TextFormat; 103 | UINT m_LabelFormat; 104 | UINT m_UnitFormat; 105 | 106 | // Glass 107 | COLORREF m_GlassColor; 108 | BYTE m_GlassAlpha; 109 | 110 | // Meter 111 | BOOL m_bMeter; 112 | double m_MeterRatio; 113 | 114 | // Image 115 | CString m_ImagePath; 116 | int m_ImageCount; 117 | CDC* m_BkDC; 118 | CBitmap m_BkBitmap; 119 | BOOL m_bBkBitmapInit; 120 | BOOL m_bBkLoad; 121 | CBitmap m_CtrlBitmap; 122 | CImage m_CtrlImage; 123 | 124 | // Font 125 | DWORD m_TextAlign; 126 | CFont m_Font; 127 | CFont m_FontToolTip; 128 | COLORREF m_TextColor; 129 | 130 | // ToolTip 131 | CToolTipCtrl m_ToolTip; 132 | CString m_ToolTipText; 133 | 134 | // Mouse 135 | BOOL m_bHover; 136 | BOOL m_bFocas; 137 | BOOL m_bTrackingNow; 138 | BOOL m_bHandCursor; 139 | }; 140 | -------------------------------------------------------------------------------- /Priscilla/FontComboBoxFx.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "FontComboBoxFx.h" 10 | 11 | ////------------------------------------------------ 12 | // CFontComboBox 13 | ////------------------------------------------------ 14 | 15 | IMPLEMENT_DYNAMIC(CFontComboBox, CComboBoxFx) 16 | 17 | CFontComboBox::CFontComboBox() 18 | { 19 | m_Brush = NULL; 20 | } 21 | 22 | CFontComboBox::~CFontComboBox() 23 | { 24 | m_BkBrush.DeleteObject(); 25 | } 26 | 27 | BEGIN_MESSAGE_MAP(CFontComboBox, CComboBoxFx) 28 | END_MESSAGE_MAP() 29 | 30 | void CFontComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 31 | { 32 | if (lpDrawItemStruct->itemID == -1) { return; } 33 | 34 | static COLORREF textColor; 35 | static COLORREF textColorSelected; 36 | static COLORREF bkColor; 37 | static COLORREF bkColorSelected; 38 | 39 | if (m_bHighContrast) 40 | { 41 | textColor = GetTextColor(lpDrawItemStruct->hDC); 42 | textColorSelected = RGB(0, 0, 0); 43 | bkColor = GetBkColor(lpDrawItemStruct->hDC); 44 | bkColorSelected = RGB(0, 255, 255); 45 | 46 | if (bkColor <= RGB(0x80, 0x80, 0x80)) { textColor = RGB(255, 255, 255); } 47 | else { textColor = RGB(0, 0, 0); } 48 | } 49 | else if (m_bDarkMode) 50 | { 51 | textColor = RGB(255, 255, 255); 52 | textColorSelected = RGB(255, 255, 255); 53 | bkColor = RGB(32, 32, 32); 54 | bkColorSelected = RGB(77, 77, 77); 55 | } 56 | else 57 | { 58 | textColor = m_TextColor; 59 | textColorSelected = m_TextColorSelected; 60 | bkColor = m_BkColor; 61 | bkColorSelected = m_BkColorSelected; 62 | } 63 | 64 | CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); 65 | LoadCtrlBk(pDC); 66 | CString title; 67 | GetLBText(lpDrawItemStruct->itemID, title); 68 | 69 | CFont font; 70 | LOGFONT logfont; 71 | memset(&logfont, 0, sizeof(logfont)); 72 | logfont.lfHeight = m_FontHeight; 73 | logfont.lfWidth = 0; 74 | logfont.lfWeight = FW_NORMAL; 75 | logfont.lfQuality = m_FontRender; 76 | logfont.lfCharSet = DEFAULT_CHARSET; 77 | 78 | #if _MSC_VER <= 1310 79 | _tcscpy(logfont.lfFaceName, (LPCTSTR)title); 80 | #else 81 | _tcscpy_s(logfont.lfFaceName, 32, (LPCTSTR)title); 82 | #endif 83 | font.CreateFontIndirect(&logfont); 84 | HGDIOBJ oldFont = pDC->SelectObject(&font); 85 | 86 | CBrush Brush; 87 | CBrush* pOldBrush; 88 | if (lpDrawItemStruct->rcItem.left != 0 && !m_bHighContrast) 89 | { 90 | DrawControl(title, pDC, lpDrawItemStruct, m_CtrlBitmap, m_BkBitmap, ControlImageNormal); 91 | Brush.CreateSolidBrush(bkColorSelected); 92 | pOldBrush = pDC->SelectObject(&Brush); 93 | if (lpDrawItemStruct->itemState & ODS_SELECTED) 94 | { 95 | RECT rc = lpDrawItemStruct->rcItem; 96 | // rc.top = (LONG)(rc.bottom - 2 * m_ZoomRatio); 97 | rc.right = (LONG)(rc.left + 3 * m_ZoomRatio); 98 | FillRect(lpDrawItemStruct->hDC, &rc, (HBRUSH)Brush); 99 | } 100 | DrawString(title, pDC, lpDrawItemStruct, textColor); 101 | 102 | #if _MSC_VER <= 1310 103 | if (IsNT3() && IsWindowEnabled()) 104 | { 105 | DWORD oldTextAlign = m_TextAlign; 106 | HGDIOBJ myoldFont = pDC->SelectStockObject(SYSTEM_FONT); 107 | m_TextAlign = ES_RIGHT; 108 | DrawString(_T("v"), pDC, lpDrawItemStruct, textColor); 109 | m_TextAlign = oldTextAlign; 110 | pDC->SelectObject(myoldFont); 111 | } 112 | #endif 113 | } 114 | else 115 | { 116 | if (lpDrawItemStruct->itemState & ODS_SELECTED) 117 | { 118 | Brush.CreateSolidBrush(bkColorSelected); 119 | pOldBrush = pDC->SelectObject(&Brush); 120 | FillRect(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, (HBRUSH)Brush); 121 | DrawString(title, pDC, lpDrawItemStruct, textColorSelected); 122 | } 123 | else 124 | { 125 | Brush.CreateSolidBrush(bkColor); 126 | pOldBrush = pDC->SelectObject(&Brush); 127 | FillRect(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, (HBRUSH)Brush); 128 | DrawString(title, pDC, lpDrawItemStruct, textColor); 129 | } 130 | } 131 | pDC->SelectObject(pOldBrush); 132 | Brush.DeleteObject(); 133 | pDC->SelectObject(oldFont); 134 | } 135 | -------------------------------------------------------------------------------- /Priscilla/ComboBoxFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include 12 | #include 13 | #pragma comment(lib, "Gdiplus.lib") 14 | using namespace Gdiplus; 15 | 16 | class CComboBoxFx : public CComboBox 17 | { 18 | DECLARE_DYNAMIC(CComboBoxFx); 19 | 20 | // Constructors 21 | public: 22 | CComboBoxFx(); 23 | virtual ~CComboBoxFx(); 24 | 25 | // Control 26 | public: 27 | BOOL InitControl(int x, int y, int width, int height, double zoomRatio, CDC* bkDC, 28 | LPCWSTR imagePath, int imageCount, DWORD textAlign, int renderMode, BOOL bHighContrast, BOOL m_bDarkMode, 29 | COLORREF bkColor, COLORREF bkColorSelected, COLORREF glassColor, BYTE glassAlpha 30 | ); 31 | void SetFontHeight(int height, double zoomRatio, double fontRatio = 1.0); 32 | void SetItemHeightEx(int nIndex, int height, double zoomRatio, double fontRatio = 1.0); 33 | void SetItemHeightAll(int height, double zoomRatio, double fontRatio = 1.0); 34 | void SetMargin(int top, int left, int bottom, int right, double zoomRatio); 35 | CSize GetSize(void); 36 | void SetGlassColor(COLORREF glassColor, BYTE glassAlpha); 37 | void SetAlpha(BYTE alpha); 38 | HWND GetListHwnd(); 39 | 40 | // Font 41 | void SetFontEx(CString face, int size, int sizeToolTip, double zoomRatio, double fontRatio = 1.0, 42 | COLORREF textColor = RGB(0, 0, 0), COLORREF textColorSelected = RGB(0, 0, 0), LONG fontWeight = FW_NORMAL, BYTE fontRender = CLEARTYPE_NATURAL_QUALITY); 43 | 44 | // ToolTip 45 | void SetToolTipText(LPCTSTR pText); 46 | void SetToolTipActivate(BOOL bActivate = TRUE); 47 | void SetToolTipWindowText(LPCTSTR pText); 48 | CString GetToolTipText(); 49 | 50 | // Mouse 51 | void SetHandCursor(BOOL bHandCuror = TRUE); 52 | 53 | protected: 54 | // Draw Control 55 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 56 | virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); 57 | virtual void DrawControl(CString title, CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct, CBitmap& ctrlBitmap, CBitmap& bkBitmap, int no); 58 | virtual void DrawString(CString title, CDC* drawDC, LPDRAWITEMSTRUCT lpDrawItemStruct, COLORREF textColor); 59 | 60 | // Image 61 | BOOL LoadBitmap(LPCTSTR fileName); 62 | BOOL LoadBitmap(HBITMAP hBitmap); 63 | void SetBkReload(void); 64 | BOOL SetBitmap(CBitmap& bitmap); 65 | void LoadCtrlBk(CDC* drawDC); 66 | 67 | // ToolTip 68 | void InitToolTip(); 69 | virtual BOOL PreTranslateMessage(MSG* pMsg); 70 | 71 | // Message Map 72 | DECLARE_MESSAGE_MAP() 73 | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 74 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 75 | afx_msg void OnMouseHover(UINT nFlags, CPoint point); 76 | afx_msg void OnMouseLeave(); 77 | afx_msg void OnKillfocus(); 78 | afx_msg void OnSetfocus(); 79 | afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); 80 | 81 | protected: 82 | // Control 83 | int m_X; 84 | int m_Y; 85 | double m_ZoomRatio; 86 | CSize m_CtrlSize; 87 | CRect m_Margin; 88 | int m_RenderMode; 89 | BOOL m_bHighContrast; 90 | BOOL m_bDarkMode; 91 | BYTE m_FontRender; // For FontComboBoxFx 92 | 93 | // Alpha/Glass 94 | BYTE m_Alpha; 95 | COLORREF m_GlassColor; 96 | BYTE m_GlassAlpha; 97 | 98 | // Image 99 | CString m_ImagePath; 100 | int m_ImageCount; 101 | CDC* m_BkDC; 102 | CBitmap m_BkBitmap; 103 | BOOL m_bBkBitmapInit; 104 | BOOL m_bBkLoad; 105 | CBitmap m_CtrlBitmap; 106 | CImage m_CtrlImage; 107 | 108 | // Font 109 | DWORD m_TextAlign; 110 | CFont m_Font; 111 | CFont m_FontToolTip; 112 | COLORREF m_TextColor; 113 | COLORREF m_TextColorSelected; 114 | COLORREF m_BkColor; 115 | COLORREF m_BkColorSelected; 116 | COLORREF m_TextColorHc; 117 | COLORREF m_TextColorSelectedHc; 118 | COLORREF m_BkColorHc; 119 | COLORREF m_BkColorSelectedHc; 120 | LONG m_FontHeight; 121 | 122 | // ToolTip 123 | CToolTipCtrl m_ToolTip; 124 | CString m_ToolTipText; 125 | 126 | // Mouse 127 | BOOL m_bHover; 128 | BOOL m_bFocas; 129 | BOOL m_bTrackingNow; 130 | BOOL m_bHandCursor; 131 | 132 | // Brush 133 | CBrush m_BkBrush; 134 | }; 135 | -------------------------------------------------------------------------------- /Priscilla/DialogFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "CommonFx.h" 11 | #include "DarkMode.h" 12 | 13 | #include 14 | 15 | class CDialogFx : public CDialog 16 | { 17 | public: 18 | CDialogFx(UINT dlgResouce, CWnd* pParent = NULL); 19 | virtual ~CDialogFx(); 20 | 21 | // Dialog 22 | virtual BOOL Create(UINT nIDTemplate, CWnd* dlgWnd, UINT menuId, CWnd* pParentWnd = NULL); 23 | 24 | // Font 25 | int GetFontScale(); 26 | BYTE GetFontRender(); 27 | double GetFontRatio(); 28 | CString GetFontFace(); 29 | 30 | // Theme 31 | BOOL IsDisableDarkMode(); 32 | 33 | protected: 34 | // Dialog 35 | virtual BOOL OnInitDialog(); 36 | virtual BOOL PreTranslateMessage(MSG* pMsg); 37 | virtual void PostNcDestroy(); 38 | virtual void UpdateDialogSize(); 39 | virtual void SetClientSize(int sizeX, int sizeY, double zoomRatio); 40 | virtual void UpdateBackground(BOOL resize, BOOL darkMode); 41 | virtual void SetWindowTitle(CString title); 42 | virtual void OnOK(); 43 | virtual void OnCancel(); 44 | 45 | // Zoom 46 | DWORD ChangeZoomType(DWORD zoomType); 47 | 48 | // Theme 49 | BOOL IsHighContrast(); 50 | 51 | // Utility 52 | virtual CString IP(CString imageName); 53 | CString i18n(CString section, CString key, BOOL inEnglish = FALSE); 54 | void OpenUrl(CString url); 55 | void SetLayeredWindow(HWND hWnd, BYTE alpha); 56 | int GetDpi(); 57 | 58 | // MessageMap 59 | DECLARE_MESSAGE_MAP() 60 | afx_msg void OnSize(UINT nType, int cx, int cy); 61 | afx_msg void OnTimer(UINT_PTR nIDEvent); 62 | afx_msg BOOL OnEraseBkgnd(CDC* pDC); 63 | afx_msg LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam); 64 | afx_msg LRESULT OnDisplayChange(WPARAM wParam, LPARAM lParam); 65 | afx_msg LRESULT OnSysColorChange(WPARAM wParam, LPARAM lParam); 66 | afx_msg LRESULT OnSettingChange(WPARAM wParam, LPARAM lParam); 67 | afx_msg LRESULT OnEnterSizeMove(WPARAM wParam, LPARAM lParam); 68 | afx_msg LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam); 69 | 70 | protected: 71 | // Dialog 72 | BOOL m_bInitializing; 73 | BOOL m_bDpiChanging; 74 | BOOL m_bShowWindow; 75 | BOOL m_bModelessDlg; 76 | BOOL m_bHighContrast; 77 | BOOL m_bDarkMode; 78 | BOOL m_bDisableDarkMode; 79 | BOOL m_bBkImage; 80 | UINT m_MenuId; 81 | CWnd* m_ParentWnd; 82 | CWnd* m_DlgWnd; 83 | CString m_Ini; 84 | HACCEL m_hAccelerator; 85 | BOOL m_bDrag; 86 | CString m_FontFace; 87 | int m_FontScale; 88 | double m_FontRatio; 89 | BYTE m_FontRender; 90 | HPALETTE m_hPal; 91 | 92 | int m_SizeX; 93 | int m_MaxSizeX; 94 | int m_MinSizeX; 95 | int m_SizeY; 96 | int m_MaxSizeY; 97 | int m_MinSizeY; 98 | 99 | // Zoom 100 | int m_Dpi; 101 | DWORD m_ZoomType; 102 | double m_ZoomRatio; 103 | 104 | // Color for SubClass 105 | COLORREF m_LabelText; 106 | COLORREF m_MeterText; 107 | COLORREF m_ComboText; 108 | COLORREF m_ComboTextSelected; 109 | COLORREF m_ComboBk; 110 | COLORREF m_ComboBkSelected; 111 | COLORREF m_ButtonText; 112 | COLORREF m_EditText; 113 | COLORREF m_EditBk; 114 | COLORREF m_ListText1; 115 | COLORREF m_ListText2; 116 | COLORREF m_ListTextSelected; 117 | COLORREF m_ListBk1; 118 | COLORREF m_ListBk2; 119 | COLORREF m_ListBkSelected; 120 | COLORREF m_ListLine1; 121 | COLORREF m_ListLine2; 122 | COLORREF m_Glass; 123 | COLORREF m_Frame; 124 | COLORREF m_Background; 125 | 126 | BYTE m_ComboAlpha; 127 | BYTE m_EditAlpha; 128 | BYTE m_GlassAlpha; 129 | 130 | BYTE m_CharacterPosition; 131 | 132 | // Theme for SubClass 133 | int m_OffsetX; 134 | CString m_ThemeDir; 135 | CString m_CurrentTheme; 136 | CString m_DefaultTheme; 137 | CString m_ParentTheme1; 138 | CString m_ParentTheme2; 139 | CString m_RandomThemeLabel; 140 | CString m_RandomThemeName; 141 | 142 | // Language for SubClass 143 | CString m_LangDir; 144 | CString m_CurrentLang; 145 | CString m_CurrentLangPath; 146 | CString m_DefaultLangPath; 147 | CString m_BackgroundName; 148 | 149 | // Voice for SubClass 150 | CString m_VoiceDir; 151 | CString m_CurrentVoice; 152 | INT m_VoiceVolume; 153 | 154 | // Class 155 | CBitmap m_BkBitmap; 156 | CDC m_BkDC; 157 | CImage m_BkImage; 158 | CBrush m_BrushDlg; 159 | }; 160 | -------------------------------------------------------------------------------- /Priscilla/HeaderCtrlFx.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "HeaderCtrlFx.h" 10 | #include "OsInfoFx.h" 11 | 12 | IMPLEMENT_DYNAMIC(CHeaderCtrlFx, CHeaderCtrl) 13 | 14 | CHeaderCtrlFx::CHeaderCtrlFx() 15 | { 16 | m_X = 0; 17 | m_Y = 0; 18 | 19 | m_TextColor = RGB(0, 0, 0); 20 | m_LineColor = RGB(224, 224, 224); 21 | m_BkColor = RGB(255, 255, 255); 22 | m_ZoomRatio = 1.0; 23 | m_FontRatio = 1.0; 24 | m_FontSize = 12; 25 | m_BkDC = NULL; 26 | m_CtrlBitmap = NULL; 27 | m_bHighContrast = FALSE; 28 | m_bDarkMode = FALSE; 29 | m_RenderMode = SystemDraw; 30 | } 31 | 32 | CHeaderCtrlFx::~CHeaderCtrlFx() 33 | { 34 | } 35 | 36 | BEGIN_MESSAGE_MAP(CHeaderCtrlFx, CHeaderCtrl) 37 | ON_WM_PAINT() 38 | ON_MESSAGE(HDM_LAYOUT, OnLayout) 39 | END_MESSAGE_MAP() 40 | 41 | void CHeaderCtrlFx::InitControl(int x, int y, double zoomRatio, CDC* bkDC, CBitmap* ctrlBitmap, COLORREF textColor, COLORREF bkColor, COLORREF lineColor, int renderMode, BOOL bHighContrast, BOOL bDarkMode) 42 | { 43 | m_X = (int)(x * zoomRatio); 44 | m_Y = (int)(y * zoomRatio); 45 | m_ZoomRatio = zoomRatio; 46 | m_BkDC = bkDC; 47 | m_TextColor = textColor; 48 | m_LineColor = lineColor; 49 | m_BkColor = bkColor; 50 | 51 | m_CtrlBitmap = ctrlBitmap; 52 | m_RenderMode = renderMode; 53 | m_bHighContrast = bHighContrast; 54 | m_bDarkMode = bDarkMode; 55 | } 56 | 57 | void CHeaderCtrlFx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 58 | { 59 | if (m_bHighContrast || m_RenderMode & SystemDraw) 60 | { 61 | return CHeaderCtrl::DrawItem(lpDrawItemStruct); 62 | } 63 | 64 | CDC* drawDC = CDC::FromHandle(lpDrawItemStruct->hDC); 65 | 66 | drawDC->SetBkMode(TRANSPARENT); 67 | drawDC->SetTextColor(m_TextColor); 68 | 69 | CRect clientRect; 70 | GetClientRect(&clientRect); 71 | 72 | CDC BkDC; 73 | BkDC.CreateCompatibleDC(m_BkDC); 74 | BkDC.SelectObject(m_CtrlBitmap); 75 | CRect rc = lpDrawItemStruct->rcItem; 76 | CBrush br; 77 | 78 | if (m_CtrlBitmap != NULL) 79 | { 80 | drawDC->BitBlt(rc.left, rc.top, rc.right, rc.bottom, &BkDC, rc.left, rc.top, SRCCOPY); 81 | } 82 | else 83 | { 84 | br.CreateSolidBrush(m_BkColor); 85 | drawDC->FillRect(&rc, &br); 86 | } 87 | 88 | br.DeleteObject(); 89 | br.CreateSolidBrush(m_LineColor); 90 | 91 | CRect rect = lpDrawItemStruct->rcItem; 92 | rect.left = rect.right - 1; 93 | drawDC->FillRect(&rect, &br); 94 | 95 | rect = lpDrawItemStruct->rcItem; 96 | rect.top = rect.bottom - 1; 97 | drawDC->FillRect(&rect, &br); 98 | 99 | HDITEM hi{}; 100 | TCHAR str[256]{}; 101 | hi.mask = HDI_TEXT | HDI_FORMAT; 102 | hi.pszText = str; 103 | hi.cchTextMax = 256; 104 | GetItem(lpDrawItemStruct->itemID, &hi); 105 | 106 | rect = (CRect)(lpDrawItemStruct->rcItem); 107 | 108 | if (hi.fmt & HDF_CENTER) 109 | { 110 | drawDC->DrawText(hi.pszText, lstrlen(hi.pszText), rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 111 | } 112 | else if (hi.fmt & HDF_RIGHT) 113 | { 114 | rect.right -= 6; 115 | drawDC->DrawText(hi.pszText, lstrlen(hi.pszText), rect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); 116 | } 117 | else 118 | { 119 | rect.left += 6; 120 | drawDC->DrawText(hi.pszText, lstrlen(hi.pszText), rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE); 121 | } 122 | } 123 | 124 | void CHeaderCtrlFx::OnPaint() 125 | { 126 | if (m_bHighContrast || m_RenderMode & SystemDraw) 127 | { 128 | return CHeaderCtrl::OnPaint(); 129 | } 130 | 131 | CHeaderCtrl::OnPaint(); 132 | 133 | RECT rectRightItem; 134 | int iItemCount = Header_GetItemCount(this->m_hWnd); 135 | if (iItemCount > 0) 136 | { 137 | Header_GetItemRect(this->m_hWnd, (WPARAM)iItemCount - 1, &rectRightItem); 138 | RECT rectClient; 139 | GetClientRect(&rectClient); 140 | if (rectRightItem.right < rectClient.right) 141 | { 142 | CDC* drawDC = GetDC(); 143 | if (m_CtrlBitmap != NULL) 144 | { 145 | CDC BkDC; 146 | BkDC.CreateCompatibleDC(m_BkDC); 147 | BkDC.SelectObject(m_CtrlBitmap); 148 | drawDC->BitBlt(rectRightItem.right, rectClient.top, rectClient.right, rectClient.bottom, &BkDC, rectRightItem.right, rectRightItem.top, SRCCOPY); 149 | } 150 | else 151 | { 152 | CBrush br; 153 | br.CreateSolidBrush(m_BkColor); 154 | rectClient.left = rectRightItem.right; 155 | drawDC->FillRect(&rectClient, &br); 156 | } 157 | } 158 | } 159 | } 160 | 161 | LRESULT CHeaderCtrlFx::OnLayout(WPARAM wParam, LPARAM lParam) 162 | { 163 | LRESULT lResult = CHeaderCtrl::DefWindowProc(HDM_LAYOUT, 0, lParam); 164 | 165 | if (IsWinXpLuna()) 166 | { 167 | HD_LAYOUT& hdl = *(HD_LAYOUT*)lParam; 168 | RECT* prc = hdl.prc; 169 | WINDOWPOS* pwpos = hdl.pwpos; 170 | 171 | int nHeight = (int)(pwpos->cy * (m_ZoomRatio * m_FontRatio)); 172 | 173 | pwpos->cy = nHeight; 174 | prc->top = nHeight; 175 | } 176 | 177 | return lResult; 178 | } 179 | 180 | void CHeaderCtrlFx::SetFontEx(CString face, int size, double zoomRatio, double fontRatio, LONG fontWeight, BYTE fontRender) 181 | { 182 | m_FontSize = size; 183 | m_ZoomRatio = zoomRatio; 184 | m_FontRatio = fontRatio; 185 | 186 | LOGFONT logFont = { 0 }; 187 | logFont.lfCharSet = DEFAULT_CHARSET; 188 | logFont.lfHeight = (LONG)(-1 * size * zoomRatio * fontRatio); 189 | logFont.lfQuality = fontRender; 190 | logFont.lfWeight = fontWeight; 191 | if (face.GetLength() < 32) 192 | { 193 | wsprintf(logFont.lfFaceName, _T("%s"), (LPCTSTR)face); 194 | } 195 | else 196 | { 197 | wsprintf(logFont.lfFaceName, _T("")); 198 | } 199 | 200 | m_Font.DeleteObject(); 201 | m_Font.CreateFontIndirect(&logFont); 202 | SetFont(&m_Font); 203 | } -------------------------------------------------------------------------------- /DiskMark.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | {342a84d1-5b9a-4a10-b0ca-cc618409b820} 18 | 19 | 20 | {1e1cebf3-7ec5-4e7b-b130-da0db639e588} 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Priscilla 41 | 42 | 43 | Priscilla 44 | 45 | 46 | Priscilla 47 | 48 | 49 | Priscilla 50 | 51 | 52 | Source Files 53 | 54 | 55 | Priscilla 56 | 57 | 58 | Priscilla 59 | 60 | 61 | Priscilla 62 | 63 | 64 | Priscilla 65 | 66 | 67 | Priscilla 68 | 69 | 70 | Priscilla 71 | 72 | 73 | Library 74 | 75 | 76 | Priscilla 77 | 78 | 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Priscilla 97 | 98 | 99 | Priscilla 100 | 101 | 102 | Priscilla 103 | 104 | 105 | Priscilla 106 | 107 | 108 | Priscilla 109 | 110 | 111 | Priscilla 112 | 113 | 114 | Header Files 115 | 116 | 117 | Priscilla 118 | 119 | 120 | Priscilla 121 | 122 | 123 | Priscilla 124 | 125 | 126 | Priscilla 127 | 128 | 129 | Priscilla 130 | 131 | 132 | Library 133 | 134 | 135 | Library 136 | 137 | 138 | Priscilla 139 | 140 | 141 | 142 | 143 | Resource Files 144 | 145 | 146 | Resource Files 147 | 148 | 149 | Resource Files 150 | 151 | 152 | 153 | 154 | Resource Files 155 | 156 | 157 | 158 | 159 | Resource Files 160 | 161 | 162 | -------------------------------------------------------------------------------- /Priscilla/UAHMenuBar.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : adzm 3 | // Web : https://github.com/adzm/win32-custom-menubar-aero-theme 4 | // License : MIT License 5 | // https://github.com/adzm/win32-custom-menubar-aero-theme/blob/main/LICENSE 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include 10 | #include 11 | #include "UAHMenuBar.h" 12 | 13 | #pragma comment(lib, "uxtheme.lib") 14 | 15 | static HTHEME g_menuTheme = nullptr; 16 | extern bool g_darkModeEnabled; 17 | 18 | // ugly colors for illustration purposes 19 | static HBRUSH g_brBarBackground = CreateSolidBrush(RGB(0x2C, 0x2C, 0x2C)); 20 | 21 | void UAHDrawMenuNCBottomLine(HWND hWnd) 22 | { 23 | MENUBARINFO mbi = { sizeof(mbi) }; 24 | if (!GetMenuBarInfo(hWnd, OBJID_MENU, 0, &mbi)) 25 | { 26 | return; 27 | } 28 | 29 | RECT rcClient = { 0 }; 30 | GetClientRect(hWnd, &rcClient); 31 | MapWindowPoints(hWnd, nullptr, (POINT*)&rcClient, 2); 32 | 33 | RECT rcWindow = { 0 }; 34 | GetWindowRect(hWnd, &rcWindow); 35 | 36 | OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top); 37 | 38 | // the rcBar is offset by the window rect 39 | RECT rcAnnoyingLine = rcClient; 40 | rcAnnoyingLine.bottom = rcAnnoyingLine.top; 41 | rcAnnoyingLine.top--; 42 | 43 | 44 | HDC hdc = GetWindowDC(hWnd); 45 | FillRect(hdc, &rcAnnoyingLine, g_brBarBackground); 46 | ReleaseDC(hWnd, hdc); 47 | } 48 | 49 | // processes messages related to UAH / custom menubar drawing. 50 | // return true if handled, false to continue with normal processing in your wndproc 51 | bool UAHWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lr) 52 | { 53 | if (! g_darkModeEnabled) 54 | { 55 | return false; 56 | } 57 | 58 | switch (message) 59 | { 60 | case WM_UAHDRAWMENU: 61 | { 62 | UAHMENU* pUDM = (UAHMENU*)lParam; 63 | RECT rc = { 0 }; 64 | 65 | // get the menubar rect 66 | { 67 | MENUBARINFO mbi = { sizeof(mbi) }; 68 | GetMenuBarInfo(hWnd, OBJID_MENU, 0, &mbi); 69 | 70 | RECT rcWindow; 71 | GetWindowRect(hWnd, &rcWindow); 72 | 73 | // the rcBar is offset by the window rect 74 | rc = mbi.rcBar; 75 | OffsetRect(&rc, -rcWindow.left, -rcWindow.top); 76 | } 77 | 78 | FillRect(pUDM->hdc, &rc, g_brBarBackground); 79 | 80 | return true; 81 | } 82 | case WM_UAHDRAWMENUITEM: 83 | { 84 | typedef HRESULT(WINAPI* FuncDrawThemeTextEx)(HTHEME hTheme, HDC hdc, 85 | int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, 86 | LPRECT pRect, const DTTOPTS* pOptions); 87 | 88 | static bool bInitialized = false; 89 | static FuncDrawThemeTextEx pDrawThemeTextEx = NULL; 90 | 91 | if (bInitialized == false) 92 | { 93 | HMODULE hModule = GetModuleHandle(_T("UxTheme.dll")); 94 | if (hModule) 95 | { 96 | pDrawThemeTextEx = (FuncDrawThemeTextEx)GetProcAddress(hModule, "DrawThemeTextEx"); 97 | } 98 | bInitialized = true; 99 | } 100 | 101 | if (pDrawThemeTextEx == NULL) 102 | { 103 | return false; 104 | } 105 | 106 | UAHDRAWMENUITEM* pUDMI = (UAHDRAWMENUITEM*)lParam; 107 | 108 | // ugly colors for illustration purposes 109 | static HBRUSH g_brItemBackground = CreateSolidBrush(RGB(0x2C, 0x2C, 0x2C)); 110 | static HBRUSH g_brItemBackgroundHot = CreateSolidBrush(RGB(0x35, 0x35, 0x35)); 111 | static HBRUSH g_brItemBackgroundSelected = CreateSolidBrush(RGB(0x35, 0x35, 0x35)); 112 | 113 | HBRUSH* pbrBackground = &g_brItemBackground; 114 | 115 | // get the menu item string 116 | wchar_t menuString[256] = { 0 }; 117 | MENUITEMINFO mii = { sizeof(mii), MIIM_STRING }; 118 | { 119 | mii.dwTypeData = menuString; 120 | mii.cch = (sizeof(menuString) / 2) - 1; 121 | 122 | GetMenuItemInfo(pUDMI->um.hmenu, pUDMI->umi.iPosition, TRUE, &mii); 123 | } 124 | 125 | // get the item state for drawing 126 | 127 | DWORD dwFlags = DT_CENTER | DT_SINGLELINE | DT_VCENTER; 128 | 129 | int iTextStateID = 0; 130 | int iBackgroundStateID = 0; 131 | { 132 | if ((pUDMI->dis.itemState & ODS_INACTIVE) | (pUDMI->dis.itemState & ODS_DEFAULT)) { 133 | // normal display 134 | iTextStateID = MPI_NORMAL; 135 | iBackgroundStateID = MPI_NORMAL; 136 | } 137 | if (pUDMI->dis.itemState & ODS_HOTLIGHT) { 138 | // hot tracking 139 | iTextStateID = MPI_HOT; 140 | iBackgroundStateID = MPI_HOT; 141 | 142 | pbrBackground = &g_brItemBackgroundHot; 143 | } 144 | if (pUDMI->dis.itemState & ODS_SELECTED) { 145 | // clicked -- MENU_POPUPITEM has no state for this, though MENU_BARITEM does 146 | iTextStateID = MPI_HOT; 147 | iBackgroundStateID = MPI_HOT; 148 | 149 | pbrBackground = &g_brItemBackgroundSelected; 150 | } 151 | if ((pUDMI->dis.itemState & ODS_GRAYED) || (pUDMI->dis.itemState & ODS_DISABLED)) { 152 | // disabled / grey text 153 | iTextStateID = MPI_DISABLED; 154 | iBackgroundStateID = MPI_DISABLED; 155 | } 156 | if (pUDMI->dis.itemState & ODS_NOACCEL) { 157 | dwFlags |= DT_HIDEPREFIX; 158 | } 159 | } 160 | 161 | if (!g_menuTheme) { 162 | g_menuTheme = OpenThemeData(hWnd, L"Menu"); 163 | } 164 | 165 | DTTOPTS opts = { sizeof(opts), DTT_TEXTCOLOR | DTT_COMPOSITED | DTT_GLOWSIZE, RGB(0xFF, 0xFF, 0xFF), iTextStateID != MPI_DISABLED ? RGB(0xFF, 0xFF, 0xFF) : RGB(0xC0, 0xC0, 0xC0) }; 166 | //opts.dwFlags = ; 167 | 168 | FillRect(pUDMI->um.hdc, &pUDMI->dis.rcItem, *pbrBackground); 169 | pDrawThemeTextEx(g_menuTheme, pUDMI->um.hdc, MENU_BARITEM, MBI_NORMAL, menuString, mii.cch, dwFlags, &pUDMI->dis.rcItem, &opts); 170 | 171 | return true; 172 | } 173 | case WM_UAHMEASUREMENUITEM: 174 | { 175 | UAHMEASUREMENUITEM* pMmi = (UAHMEASUREMENUITEM*)lParam; 176 | 177 | // allow the default window procedure to handle the message 178 | // since we don't really care about changing the width 179 | *lr = DefWindowProc(hWnd, message, wParam, lParam); 180 | 181 | // but we can modify it here to make it 1/3rd wider for example 182 | //pMmi->mis.itemWidth = (pMmi->mis.itemWidth * 5) / 4; 183 | 184 | return true; 185 | } 186 | case WM_THEMECHANGED: 187 | { 188 | if (g_menuTheme) { 189 | CloseThemeData(g_menuTheme); 190 | g_menuTheme = nullptr; 191 | } 192 | // continue processing in main wndproc 193 | return false; 194 | } 195 | case WM_NCPAINT: 196 | case WM_NCACTIVATE: 197 | *lr = DefWindowProc(hWnd, message, wParam, lParam); 198 | UAHDrawMenuNCBottomLine(hWnd); 199 | return true; 200 | break; 201 | default: 202 | return false; 203 | } 204 | } 205 | 206 | -------------------------------------------------------------------------------- /Library/stdafx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #ifndef _SECURE_ATL 11 | #define _SECURE_ATL 1 12 | #endif 13 | 14 | #ifndef VC_EXTRALEAN 15 | #define VC_EXTRALEAN 16 | #endif 17 | 18 | #ifndef WINVER 19 | #define WINVER 0x0501 20 | #endif 21 | 22 | #ifndef _WIN32_WINNT 23 | #define _WIN32_WINNT 0x0501 24 | #endif 25 | 26 | #ifndef _WIN32_WINDOWS 27 | #define _WIN32_WINDOWS 0x0410 28 | #endif 29 | 30 | #ifndef _WIN32_IE 31 | #define _WIN32_IE 0x0600 32 | #endif 33 | 34 | #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS 35 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS 36 | #define _AFX_ALL_WARNINGS 37 | 38 | #include // MFC core and standard component 39 | #include // Extended MFC 40 | #include // MFC IE4 Common Control support 41 | #include // MFC Windows Common Control support 42 | 43 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 44 | 45 | #ifdef UWP 46 | #ifdef SUISHO_SHIZUKU_SUPPORT 47 | #ifdef _M_ARM 48 | #define PRODUCT_EDITION L"Shizuku Edition ARM32" 49 | #elif _M_ARM64 50 | #define PRODUCT_EDITION L"Shizuku Edition ARM64" 51 | #elif _M_X64 52 | #define PRODUCT_EDITION L"Shizuku Edition x64" 53 | #else 54 | #define PRODUCT_EDITION L"Shizuku Edition x86" 55 | #endif 56 | #else 57 | #ifdef _M_ARM 58 | #define PRODUCT_EDITION L"ARM32" 59 | #elif _M_ARM64 60 | #define PRODUCT_EDITION L"ARM64" 61 | #elif _M_X64 62 | #define PRODUCT_EDITION L"x64" 63 | #else 64 | #define PRODUCT_EDITION L"x86" 65 | #endif 66 | #endif 67 | 68 | #else 69 | 70 | #ifdef SUISHO_AOI_SUPPORT 71 | #ifdef _M_ARM 72 | #define PRODUCT_EDITION L"Aoi Edition ARM32" 73 | #elif _M_ARM64 74 | #define PRODUCT_EDITION L"Aoi Edition ARM64" 75 | #elif _M_X64 76 | #define PRODUCT_EDITION L"Aoi Edition x64" 77 | #else 78 | #define PRODUCT_EDITION L"Aoi Edition x86" 79 | #endif 80 | 81 | #elif MSI_MEI_SUPPORT 82 | #ifdef _M_ARM 83 | #define PRODUCT_EDITION L"MSI Mei Mihoshi Edition ARM32" 84 | #elif _M_ARM64 85 | #define PRODUCT_EDITION L"MSI Mei Mihoshi Edition ARM64" 86 | #elif _M_X64 87 | #define PRODUCT_EDITION L"MSI Mei Mihoshi Edition x64" 88 | #else 89 | #define PRODUCT_EDITION L"MSI Mei Mihoshi Edition x86" 90 | #endif 91 | 92 | #elif SUISHO_SHIZUKU_SUPPORT 93 | #ifdef _M_ARM 94 | #define PRODUCT_EDITION L"Shizuku Edition ARM32" 95 | #elif _M_ARM64 96 | #define PRODUCT_EDITION L"Shizuku Edition ARM64" 97 | #elif _M_X64 98 | #define PRODUCT_EDITION L"Shizuku Edition x64" 99 | #else 100 | #define PRODUCT_EDITION L"Shizuku Edition x86" 101 | #endif 102 | 103 | #else 104 | #ifdef _M_ARM 105 | #define PRODUCT_EDITION L"ARM32" 106 | #elif _M_ARM64 107 | #define PRODUCT_EDITION L"ARM64" 108 | #elif _M_X64 109 | #define PRODUCT_EDITION L"x64" 110 | #else 111 | #define PRODUCT_EDITION L"x86" 112 | #endif 113 | #endif 114 | #endif 115 | 116 | // Version Information 117 | #define PRODUCT_NAME L"CrystalDiskMark" 118 | #define PRODUCT_FILENAME L"CrystalDiskMark" 119 | #define PRODUCT_VERSION L"9.0.1" 120 | #define PRODUCT_SHORT_NAME L"CDM" 121 | 122 | #define PRODUCT_RELEASE L"2025/06/19" 123 | #define PRODUCT_COPY_YEAR L"2007-2025" 124 | #define PRODUCT_LICENSE L"MIT License" 125 | 126 | #ifdef SUISHO_AOI_SUPPORT 127 | #define PRODUCT_COPYRIGHT_1 L"© 2007-2025 hiyohiyo" 128 | #define PRODUCT_COPYRIGHT_2 L"© 2025 CrystalMark Inc." 129 | #define PRODUCT_COPYRIGHT_3 L"© 2023-2025 nijihashi sola" 130 | 131 | #elif MSI_MEI_SUPPORT 132 | #define PRODUCT_COPYRIGHT_1 L"© 2007-2025 hiyohiyo" 133 | #define PRODUCT_COPYRIGHT_2 L"© 2025 CrystalMark Inc." 134 | #define PRODUCT_COPYRIGHT_3 L"© 2024-2025 Micro-Star INT'L CO., LTD." 135 | 136 | #elif SUISHO_SHIZUKU_SUPPORT 137 | #define PRODUCT_COPYRIGHT_1 L"© 2007-2025 hiyohiyo" 138 | #define PRODUCT_COPYRIGHT_2 L"© 2025 CrystalMark Inc." 139 | #define PRODUCT_COPYRIGHT_3 L"© 2012-2025 kirino kasumu" 140 | 141 | #else 142 | #define PRODUCT_COPYRIGHT_1 L"© 2007-2025 hiyohiyo" 143 | #define PRODUCT_COPYRIGHT_2 L"© 2025 CrystalMark Inc." 144 | #define PRODUCT_COPYRIGHT_3 L"" 145 | #endif 146 | 147 | #ifdef MSI_MEI_SUPPORT 148 | #define URL_MAIN_JA L"https://jp.msi.com/" 149 | #define URL_MAIN_EN L"https://www.msi.com/" 150 | #else 151 | #define URL_MAIN_JA L"https://crystalmark.info/ja/" 152 | #define URL_MAIN_EN L"https://crystalmark.info/en/" 153 | #endif 154 | 155 | #define URL_CRYSTAL_DEW_WORLD_JA L"https://crystalmark.info/ja/" 156 | #define URL_CRYSTAL_DEW_WORLD_EN L"https://crystalmark.info/en/" 157 | 158 | #define URL_VERSION_JA L"https://crystalmark.info/ja/software/crystaldiskmark/crystaldiskmark-history/" 159 | #define URL_VERSION_EN L"https://crystalmark.info/en/software/crystaldiskmark/crystaldiskmark-history/" 160 | #define URL_LICENSE_JA L"https://crystalmark.info/ja/software/crystaldiskmark/crystaldiskmark-license/" 161 | #define URL_LICENSE_EN L"https://crystalmark.info/en/software/crystaldiskmark/crystaldiskmark-license/" 162 | #define URL_HELP_JA L"https://crystalmark.info/ja/software/crystaldiskmark/" 163 | #define URL_HELP_EN L"https://crystalmark.info/en/software/crystaldiskmark/" 164 | 165 | #define URL_DISKSPD L"https://github.com/microsoft/diskspd" 166 | 167 | #ifdef SUISHO_AOI_SUPPORT 168 | #define URL_PROJECT_SITE_1 L"https://twitter.com/sola_no_crayon" 169 | #define URL_PROJECT_SITE_2 L"https://twitter.com/harakeiko0718" 170 | #define URL_PROJECT_SITE_3 L"https://instagram.com/kotomi_wicke?igshid=OGQ5ZDc2ODk2ZA==" 171 | #define URL_PROJECT_SITE_4 L"https://twitter.com/bellche" 172 | #define URL_PROJECT_SITE_5 L"" 173 | 174 | #elif MSI_MEI_SUPPORT 175 | #define URL_PROJECT_SITE_1 L"https://jp.msi.com/Landing/mihoshimei/nb" 176 | #define URL_PROJECT_SITE_2 L"https://twitter.com/hoshi_u3" 177 | #define URL_PROJECT_SITE_3 L"https://twitter.com/mokowata" 178 | #define URL_PROJECT_SITE_4 L"https://jp.msi.com/" 179 | #define URL_PROJECT_SITE_5 L"https://jp.msi.com/" 180 | 181 | #elif SUISHO_SHIZUKU_SUPPORT 182 | #define URL_PROJECT_SITE_1 L"https://twitter.com/kirinokasumu" 183 | #define URL_PROJECT_SITE_2 L"https://linux-ha.osdn.jp/wp/" 184 | #define URL_PROJECT_SITE_3 L"https://ch.nicovideo.jp/oss" 185 | #define URL_PROJECT_SITE_4 L"https://twitter.com/bellche" 186 | #define URL_PROJECT_SITE_5 L"https://suishoshizuku.com/" 187 | #endif 188 | 189 | #define MAX_THREADS 64 190 | #define MAX_QUEUES 512 191 | 192 | static const int RE_EXEC = 5963; 193 | 194 | #pragma warning(disable : 4996) 195 | 196 | //------------------------------------------------ 197 | // Option Flags 198 | //------------------------------------------------ 199 | 200 | // For Task Tray Icon Feature 201 | // #define OPTION_TASK_TRAY 202 | 203 | //------------------------------------------------ 204 | // Global Sttings 205 | //------------------------------------------------ 206 | 207 | #define DEFAULT_FONT_FACE_1 L"Segoe UI" 208 | #define DEFAULT_FONT_FACE_2 L"Tahoma" 209 | 210 | #define THEME_DIR L"CdmResource\\themes\\" 211 | #define LANGUAGE_DIR L"CdmResource\\language\\" 212 | #define VOICE_DIR L"CdmResource\\voice\\" 213 | 214 | 215 | #define MENU_THEME_INDEX 3 216 | #define MENU_LANG_INDEX 5 217 | 218 | #define DEFAULT_THEME L"Default" 219 | #define DEFAULT_LANGUAGE L"English" 220 | 221 | #define TIMER_UPDATE_DIALOG 500 222 | 223 | #define WM_UPDATE_SCORE (WM_APP+0x1001) 224 | #define WM_UPDATE_MESSAGE (WM_APP+0x1002) 225 | #define WM_EXIT_BENCHMARK (WM_APP+0x1003) -------------------------------------------------------------------------------- /DiskMark.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 17 3 | VisualStudioVersion = 17.5.33502.453 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiskMark", "DiskMark.vcxproj", "{CDF33C67-147E-4C50-BC76-99A6BCB214D9}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|ARM = Debug|ARM 10 | Debug|ARM64 = Debug|ARM64 11 | Debug|Win32 = Debug|Win32 12 | Debug|x64 = Debug|x64 13 | Release(UWP)|ARM = Release(UWP)|ARM 14 | Release(UWP)|ARM64 = Release(UWP)|ARM64 15 | Release(UWP)|Win32 = Release(UWP)|Win32 16 | Release(UWP)|x64 = Release(UWP)|x64 17 | Release|ARM = Release|ARM 18 | Release|ARM64 = Release|ARM64 19 | Release|Win32 = Release|Win32 20 | Release|x64 = Release|x64 21 | ReleaseAoi(UWP)|ARM = ReleaseAoi(UWP)|ARM 22 | ReleaseAoi(UWP)|ARM64 = ReleaseAoi(UWP)|ARM64 23 | ReleaseAoi(UWP)|Win32 = ReleaseAoi(UWP)|Win32 24 | ReleaseAoi(UWP)|x64 = ReleaseAoi(UWP)|x64 25 | ReleaseAoi|ARM = ReleaseAoi|ARM 26 | ReleaseAoi|ARM64 = ReleaseAoi|ARM64 27 | ReleaseAoi|Win32 = ReleaseAoi|Win32 28 | ReleaseAoi|x64 = ReleaseAoi|x64 29 | ReleaseMSIMei|ARM = ReleaseMSIMei|ARM 30 | ReleaseMSIMei|ARM64 = ReleaseMSIMei|ARM64 31 | ReleaseMSIMei|Win32 = ReleaseMSIMei|Win32 32 | ReleaseMSIMei|x64 = ReleaseMSIMei|x64 33 | ReleaseShizuku(UWP)|ARM = ReleaseShizuku(UWP)|ARM 34 | ReleaseShizuku(UWP)|ARM64 = ReleaseShizuku(UWP)|ARM64 35 | ReleaseShizuku(UWP)|Win32 = ReleaseShizuku(UWP)|Win32 36 | ReleaseShizuku(UWP)|x64 = ReleaseShizuku(UWP)|x64 37 | ReleaseShizuku|ARM = ReleaseShizuku|ARM 38 | ReleaseShizuku|ARM64 = ReleaseShizuku|ARM64 39 | ReleaseShizuku|Win32 = ReleaseShizuku|Win32 40 | ReleaseShizuku|x64 = ReleaseShizuku|x64 41 | EndGlobalSection 42 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 43 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|ARM.ActiveCfg = Debug|ARM 44 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|ARM.Build.0 = Debug|ARM 45 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|ARM64.ActiveCfg = Debug|ARM64 46 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|ARM64.Build.0 = Debug|ARM64 47 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|Win32.ActiveCfg = Debug|Win32 48 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|Win32.Build.0 = Debug|Win32 49 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|x64.ActiveCfg = Debug|x64 50 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Debug|x64.Build.0 = Debug|x64 51 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|ARM.ActiveCfg = Release(UWP)|ARM 52 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|ARM.Build.0 = Release(UWP)|ARM 53 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|ARM64.ActiveCfg = Release(UWP)|ARM64 54 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|ARM64.Build.0 = Release(UWP)|ARM64 55 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|Win32.ActiveCfg = Release(UWP)|Win32 56 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|Win32.Build.0 = Release(UWP)|Win32 57 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|x64.ActiveCfg = Release(UWP)|x64 58 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release(UWP)|x64.Build.0 = Release(UWP)|x64 59 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|ARM.ActiveCfg = Release|ARM 60 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|ARM.Build.0 = Release|ARM 61 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|ARM64.ActiveCfg = Release|ARM64 62 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|ARM64.Build.0 = Release|ARM64 63 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|Win32.ActiveCfg = Release|Win32 64 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|Win32.Build.0 = Release|Win32 65 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|x64.ActiveCfg = Release|x64 66 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.Release|x64.Build.0 = Release|x64 67 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|ARM.ActiveCfg = ReleaseAoi(UWP)|ARM 68 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|ARM.Build.0 = ReleaseAoi(UWP)|ARM 69 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|ARM64.ActiveCfg = ReleaseAoi(UWP)|ARM64 70 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|ARM64.Build.0 = ReleaseAoi(UWP)|ARM64 71 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|Win32.ActiveCfg = ReleaseAoi(UWP)|Win32 72 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|Win32.Build.0 = ReleaseAoi(UWP)|Win32 73 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|x64.ActiveCfg = ReleaseAoi(UWP)|x64 74 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi(UWP)|x64.Build.0 = ReleaseAoi(UWP)|x64 75 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|ARM.ActiveCfg = ReleaseAoi|ARM 76 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|ARM.Build.0 = ReleaseAoi|ARM 77 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|ARM64.ActiveCfg = ReleaseAoi|ARM64 78 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|ARM64.Build.0 = ReleaseAoi|ARM64 79 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|Win32.ActiveCfg = ReleaseAoi|Win32 80 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|Win32.Build.0 = ReleaseAoi|Win32 81 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|x64.ActiveCfg = ReleaseAoi|x64 82 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseAoi|x64.Build.0 = ReleaseAoi|x64 83 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|ARM.ActiveCfg = ReleaseMSIMei|ARM 84 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|ARM.Build.0 = ReleaseMSIMei|ARM 85 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|ARM64.ActiveCfg = ReleaseMSIMei|ARM64 86 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|ARM64.Build.0 = ReleaseMSIMei|ARM64 87 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|Win32.ActiveCfg = ReleaseMSIMei|Win32 88 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|Win32.Build.0 = ReleaseMSIMei|Win32 89 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|x64.ActiveCfg = ReleaseMSIMei|x64 90 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseMSIMei|x64.Build.0 = ReleaseMSIMei|x64 91 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|ARM.ActiveCfg = ReleaseShizuku(UWP)|ARM 92 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|ARM.Build.0 = ReleaseShizuku(UWP)|ARM 93 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|ARM64.ActiveCfg = ReleaseShizuku(UWP)|ARM64 94 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|ARM64.Build.0 = ReleaseShizuku(UWP)|ARM64 95 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|Win32.ActiveCfg = ReleaseShizuku(UWP)|Win32 96 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|Win32.Build.0 = ReleaseShizuku(UWP)|Win32 97 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|x64.ActiveCfg = ReleaseShizuku(UWP)|x64 98 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku(UWP)|x64.Build.0 = ReleaseShizuku(UWP)|x64 99 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|ARM.ActiveCfg = ReleaseShizuku|ARM 100 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|ARM.Build.0 = ReleaseShizuku|ARM 101 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|ARM64.ActiveCfg = ReleaseShizuku|ARM64 102 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|ARM64.Build.0 = ReleaseShizuku|ARM64 103 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|Win32.ActiveCfg = ReleaseShizuku|Win32 104 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|Win32.Build.0 = ReleaseShizuku|Win32 105 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|x64.ActiveCfg = ReleaseShizuku|x64 106 | {CDF33C67-147E-4C50-BC76-99A6BCB214D9}.ReleaseShizuku|x64.Build.0 = ReleaseShizuku|x64 107 | EndGlobalSection 108 | GlobalSection(SolutionProperties) = preSolution 109 | HideSolutionNode = FALSE 110 | EndGlobalSection 111 | GlobalSection(ExtensibilityGlobals) = postSolution 112 | SolutionGuid = {81DC78FD-9979-489D-930A-DA0CD60B9148} 113 | EndGlobalSection 114 | EndGlobal 115 | -------------------------------------------------------------------------------- /Library/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // 3 | #define IDD_DISKMARK_DIALOG 102 4 | #define IDR_MENU 129 5 | #define IDR_MAINFRAME 130 6 | #define IDD_ABOUT 131 7 | #define IDD_COMMENT 132 8 | #define IDR_PNG1 134 9 | #define IDR_PNG2 135 10 | #define IDR_ACCELERATOR 136 11 | #define IDI_ICON1 138 12 | #define IDI_TRAY_ICON 138 13 | #define IDD_SETTINGS 139 14 | #define IDD_FONT 140 15 | 16 | #define IDC_OK 1001 17 | #define IDC_BUTTON_ALL 1003 18 | #define IDC_BUTTON_TEST_0 1004 19 | #define IDC_BUTTON_TEST_1 1005 20 | #define IDC_BUTTON_TEST_2 1006 21 | #define IDC_BUTTON_TEST_3 1007 22 | #define IDC_TEST_READ_0 1009 23 | #define IDC_TEST_READ_1 1010 24 | #define IDC_TEST_READ_2 1011 25 | #define IDC_TEST_READ_3 1012 26 | #define IDC_TEST_WRITE_0 1014 27 | #define IDC_TEST_WRITE_1 1015 28 | #define IDC_TEST_WRITE_2 1016 29 | #define IDC_TEST_WRITE_3 1017 30 | #define IDC_TEST_MIX_0 1019 31 | #define IDC_TEST_MIX_1 1020 32 | #define IDC_TEST_MIX_2 1021 33 | #define IDC_TEST_MIX_3 1022 34 | #define IDC_COMMENT 1023 35 | #define IDC_COMMENT_EX 1024 36 | #define IDC_COMBO_UNIT 1025 37 | #define IDC_COMBO_COUNT 1026 38 | #define IDC_COMBO_DRIVE 1027 39 | #define IDC_COMBO_SIZE 1028 40 | #define IDC_READ_UNIT 1029 41 | #define IDC_WRITE_UNIT 1030 42 | #define IDC_MIX_UNIT 1031 43 | #define IDC_COMBO_MIX 1032 44 | #define IDC_DEMO_SETTING 1033 45 | #define IDC_HIDE 1034 46 | 47 | #define IDC_LOGO 1100 48 | #define IDC_PROJECT_SITE_1 1101 49 | #define IDC_PROJECT_SITE_2 1102 50 | #define IDC_PROJECT_SITE_3 1103 51 | #define IDC_PROJECT_SITE_4 1104 52 | #define IDC_PROJECT_SITE_5 1105 53 | #define IDC_VERSION 1106 54 | #define IDC_RELEASE 1107 55 | #define IDC_COPYRIGHT1 1108 56 | #define IDC_COPYRIGHT2 1109 57 | #define IDC_COPYRIGHT3 1110 58 | #define IDC_LICENSE 1111 59 | #define IDC_EDITION 1112 60 | 61 | #define IDC_FONT_FACE_COMBO 1201 62 | #define IDC_FONT_SCALE_COMBO 1202 63 | #define IDC_FONT_RENDER_COMBO 1203 64 | #define IDC_FONT_FACE 1204 65 | #define IDC_FONT_SCALE 1205 66 | #define IDC_FONT_RENDER 1206 67 | 68 | #define IDC_LABEL_DEMO 1301 69 | #define IDC_COMBO_DATA 1302 70 | #define IDC_LABEL_DATA 1303 71 | #define IDC_SET_DEFAULT 1304 72 | #define IDC_SET_NVME_8 1306 73 | #define IDC_SET_FLASH_MEMORY 1307 74 | #define IDC_LABEL_AFFINITY 1308 75 | #define IDC_COMBO_AFFINITY 1309 76 | #define IDC_LABEL_PEAK 1310 77 | #define IDC_LABEL_TYPE 1311 78 | #define IDC_LABEL_SIZE 1312 79 | #define IDC_LABEL_QUEUES 1313 80 | #define IDC_LABEL_THREADS 1314 81 | #define IDC_LABEL_MEASURE_TIME 1315 82 | #define IDC_LABEL_INTERVAL_TIME 1316 83 | #define IDC_COMBO_MEASURE_TIME 1317 84 | #define IDC_COMBO_INTERVAL_TIME 1318 85 | #define IDC_LABEL_DEFAULT 1319 86 | 87 | #define IDC_COMBO_BENCH_TYPE_0 1320 88 | #define IDC_COMBO_BENCH_TYPE_1 1321 89 | #define IDC_COMBO_BENCH_TYPE_2 1322 90 | #define IDC_COMBO_BENCH_TYPE_3 1323 91 | #define IDC_COMBO_BENCH_TYPE_4 1324 92 | #define IDC_COMBO_BENCH_TYPE_5 1325 93 | #define IDC_COMBO_BENCH_TYPE_8 1328 94 | 95 | #define IDC_COMBO_BENCH_SIZE_0 1330 96 | #define IDC_COMBO_BENCH_SIZE_1 1331 97 | #define IDC_COMBO_BENCH_SIZE_2 1332 98 | #define IDC_COMBO_BENCH_SIZE_3 1333 99 | #define IDC_COMBO_BENCH_SIZE_4 1334 100 | #define IDC_COMBO_BENCH_SIZE_5 1335 101 | #define IDC_COMBO_BENCH_SIZE_8 1338 102 | 103 | #define IDC_COMBO_BENCH_QUEUE_0 1340 104 | #define IDC_COMBO_BENCH_QUEUE_1 1341 105 | #define IDC_COMBO_BENCH_QUEUE_2 1342 106 | #define IDC_COMBO_BENCH_QUEUE_3 1343 107 | #define IDC_COMBO_BENCH_QUEUE_4 1344 108 | #define IDC_COMBO_BENCH_QUEUE_5 1345 109 | #define IDC_COMBO_BENCH_QUEUE_8 1348 110 | 111 | #define IDC_COMBO_BENCH_THREAD_0 1350 112 | #define IDC_COMBO_BENCH_THREAD_1 1351 113 | #define IDC_COMBO_BENCH_THREAD_2 1352 114 | #define IDC_COMBO_BENCH_THREAD_3 1353 115 | #define IDC_COMBO_BENCH_THREAD_4 1354 116 | #define IDC_COMBO_BENCH_THREAD_5 1355 117 | #define IDC_COMBO_BENCH_THREAD_8 1358 118 | 119 | #define ID_EXIT 32771 120 | #define ID_ABOUT 32772 121 | #define ID_THEME 32775 122 | #define ID_THEME_DUMMY 32776 123 | #define ID_COPY 32777 124 | #define ID_LANGUAGE_DUMMY 32778 125 | #define ID_LANGUAGE_A 32779 126 | #define ID_LANGUAGE_O 32780 127 | #define ID_A_DUMMY 32781 128 | #define ID_O_DUMMY 32782 129 | #define ID_BACK_PAGE 32787 130 | #define ID_PRINT 32788 131 | #define ID_FUNCTION_ZOOM 32789 132 | #define ID_ZOOM_100 32803 133 | #define ID_ZOOM_125 32804 134 | #define ID_ZOOM_150 32805 135 | #define ID_ZOOM_200 32806 136 | #define ID_ZOOM_250 32807 137 | #define ID_ZOOM_300 32808 138 | #define ID_ZOOM_AUTO 33809 139 | #define ID_HELP_HELP 32810 140 | #define ID_CRYSTALDEWWORLD 32811 141 | #define ID_FILE_BENCHMARKMODE 32812 142 | #define ID_MODE_DEFAULT 32815 143 | #define ID_MODE_ALL0X00 32816 144 | #define ID_MODE_ALL0XFF 32817 145 | #define ID_SETTINGS_QUEUESTHREADS 32818 146 | #define ID_SAVE_TEXT 32819 147 | #define ID_SAVE_IMAGE 32820 148 | #define ID_FONT_SETTING 32821 149 | #define ID_SETTING_DEFAULT 32822 150 | #define ID_SETTING_NVME_8 32823 151 | #define ID_SETTING_FLASH_MEMORY 32824 152 | 153 | #define ID_INTERVAL_TIME_0 33820 154 | #define ID_INTERVAL_TIME_1 33821 155 | #define ID_INTERVAL_TIME_3 33822 156 | #define ID_INTERVAL_TIME_5 33823 157 | #define ID_INTERVAL_TIME_10 33824 158 | #define ID_INTERVAL_TIME_30 33825 159 | #define ID_INTERVAL_TIME_60 33826 160 | #define ID_INTERVAL_TIME_180 33827 161 | #define ID_INTERVAL_TIME_300 33828 162 | #define ID_INTERVAL_TIME_600 33829 163 | #define ID_PROFILE_DEFAULT 33830 164 | #define ID_PROFILE_PEAK 33831 165 | #define ID_PROFILE_REAL 33832 166 | #define ID_PROFILE_DEMO 33833 167 | #define ID_PROFILE_DEFAULT_MIX 33834 168 | #define ID_PROFILE_PEAK_MIX 33835 169 | #define ID_PROFILE_REAL_MIX 33836 170 | #define ID_BENCHMARK_READ_WRITE 33837 171 | #define ID_BENCHMARK_READ_ONLY 33838 172 | #define ID_BENCHMARK_WRITE_ONLY 33839 173 | 174 | // Next default values for new objects 175 | // 176 | #ifdef APSTUDIO_INVOKED 177 | #ifndef APSTUDIO_READONLY_SYMBOLS 178 | #define _APS_NEXT_RESOURCE_VALUE 141 179 | #define _APS_NEXT_COMMAND_VALUE 33840 180 | #define _APS_NEXT_CONTROL_VALUE 1360 181 | #define _APS_NEXT_SYMED_VALUE 107 182 | #endif 183 | #endif 184 | -------------------------------------------------------------------------------- /DiskMarkDlg.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include "AboutDlg.h" 11 | #include "SettingsDlg.h" 12 | #include "FontSelectionDlg.h" 13 | 14 | #include "DialogFx.h" 15 | #include "MainDialogFx.h" 16 | #include "ButtonFx.h" 17 | #include "StaticFx.h" 18 | #include "ComboBoxFx.h" 19 | #include "EditFx.h" 20 | #include "UtilityFx.h" 21 | #include "OsInfoFx.h" 22 | 23 | class CDiskMarkDlg : public CMainDialogFx 24 | { 25 | public: 26 | CDiskMarkDlg(CWnd* pParent = NULL); 27 | ~CDiskMarkDlg(); 28 | 29 | enum { IDD = IDD_DISKMARK_DIALOG }; 30 | 31 | enum SCORE_UNIT 32 | { 33 | SCORE_MBS = 0, 34 | SCORE_GBS, 35 | SCORE_IOPS, 36 | SCORE_US, 37 | }; 38 | 39 | enum BENCH_TYPE 40 | { 41 | BENCH_SEQ = 0, 42 | BENCH_RND, 43 | }; 44 | 45 | volatile CWinThread* m_WinThread; 46 | volatile BOOL m_DiskBenchStatus; 47 | 48 | void InitScore(); 49 | void UpdateScore(); 50 | 51 | double m_ReadScore[9]; 52 | double m_WriteScore[9]; 53 | double m_ReadLatency[9]; 54 | double m_WriteLatency[9]; 55 | 56 | #ifdef MIX_MODE 57 | double m_MixScore[9]; 58 | double m_MixLatency[9]; 59 | #endif 60 | 61 | void SetMeter(CStaticFx* control, double score, double latency, int blockSize, int unit); 62 | void ChangeLang(CString LangName); 63 | void UpdateDialogSize(); 64 | void ChangeButtonStatus(BOOL status); 65 | void SetScoreToolTip(CStaticFx* cx, double score, double latency, int blockSize); 66 | void UpdateThemeInfo(); 67 | 68 | CString m_ValueTestUnit; 69 | CString m_ValueTestCount; 70 | CString m_ValueTestSize; 71 | CString m_ValueTestDrive; 72 | CString m_TestDriveInfo; 73 | CString m_TestTargetPath; 74 | long m_TestDriveLetter; 75 | 76 | int m_MaxIndexTestDrive; 77 | int m_IndexTestUnit; 78 | int m_IndexTestCount; 79 | int m_IndexTestSize; 80 | int m_IndexTestDrive; 81 | int m_IndexTestMix; 82 | 83 | int m_BenchType[9]; 84 | int m_BenchSize[9]; 85 | int m_BenchQueues[9]; 86 | int m_BenchThreads[9]; 87 | int m_IntervalTime; 88 | int m_MeasureTime; 89 | 90 | int m_TestData; 91 | int m_Profile; 92 | int m_Benchmark; 93 | 94 | int m_MarginButtonTop; 95 | int m_MarginButtonLeft; 96 | int m_MarginButtonBottom; 97 | int m_MarginButtonRight; 98 | int m_MarginMeterTop; 99 | int m_MarginMeterLeft; 100 | int m_MarginMeterBottom; 101 | int m_MarginMeterRight; 102 | int m_MarginCommentTop; 103 | int m_MarginCommentLeft; 104 | int m_MarginCommentBottom; 105 | int m_MarginCommentRight; 106 | int m_MarginDemoTop; 107 | int m_MarginDemoLeft; 108 | int m_MarginDemoBottom; 109 | int m_MarginDemoRight; 110 | 111 | BOOL m_AdminMode; 112 | BOOL m_MixMode; 113 | int m_MixRatio; 114 | 115 | // Message // 116 | CString m_MesDiskCapacityError; 117 | CString m_MesDiskWriteError; 118 | CString m_MesDiskReadError; 119 | CString m_MesStopBenchmark; 120 | CString m_MesDiskCreateFileError; 121 | CString m_MesDiskSpdNotFound; 122 | 123 | void SetWindowTitle(CString message); 124 | 125 | protected: 126 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 127 | 128 | void OnAll(); 129 | void OnTest0(); 130 | void OnTest1(); 131 | void OnTest2(); 132 | void OnTest3(); 133 | void Stop(); 134 | void OnSequentialPeak(); 135 | void OnRandomPeak(); 136 | void OnSequentialReal(); 137 | void OnRandomReal(); 138 | 139 | void SelectDrive(); 140 | CString GetResultString(int type, double score, double latency, int size, int queues, int threads); 141 | CString GetButtonText(int type, int size, int queues, int threads, int unit); 142 | CString GetButtonToolTipText(int type, int size, int queues, int threads, int unit); 143 | 144 | CString m_TitleTestDrive; 145 | CString m_TitleTestCount; 146 | CString m_TitleTestSize; 147 | CString m_TitleTestQSize; 148 | 149 | protected: 150 | HICON m_hIcon; 151 | HICON m_hIconMini; 152 | HACCEL m_hAccelerator; 153 | 154 | int m_SizeX; 155 | int m_SizeY; 156 | 157 | CAboutDlg* m_AboutDlg; 158 | CSettingsDlg* m_SettingsDlg; 159 | 160 | void SetControlFont(); 161 | void InitDrive(); 162 | void UpdateDriveToolTip(); 163 | 164 | BOOL CheckRadioZoomType(int id, int value); 165 | void CheckRadioZoomType(); 166 | void CheckRadioPresetMode(); 167 | void UpdateQueuesThreads(); 168 | 169 | void EnableMenus(); 170 | void DisableMenus(); 171 | 172 | void SaveText(CString fileName); 173 | 174 | void SetLayeredWindow(HWND hWnd, BYTE alpha); 175 | void UpdateComboTooltip(); 176 | 177 | virtual BOOL CheckThemeEdition(CString name); 178 | 179 | BOOL IsDefaultMode(); 180 | BOOL IsNVMe8Mode(); 181 | BOOL IsFlashMemoryMode(); 182 | 183 | #ifdef MIX_MODE 184 | CStaticFx m_TestMix0; 185 | CStaticFx m_TestMix1; 186 | CStaticFx m_TestMix2; 187 | CStaticFx m_TestMix3; 188 | CStaticFx m_MixUnit; 189 | CComboBoxFx m_ComboMix; 190 | #endif 191 | 192 | CButtonFx m_ButtonAll; 193 | CButtonFx m_ButtonTest0; 194 | CButtonFx m_ButtonTest1; 195 | CButtonFx m_ButtonTest2; 196 | CButtonFx m_ButtonTest3; 197 | 198 | CStaticFx m_TestRead0; 199 | CStaticFx m_TestRead1; 200 | CStaticFx m_TestRead2; 201 | CStaticFx m_TestRead3; 202 | 203 | CStaticFx m_TestWrite0; 204 | CStaticFx m_TestWrite1; 205 | CStaticFx m_TestWrite2; 206 | CStaticFx m_TestWrite3; 207 | 208 | CEditFx m_Comment; 209 | 210 | CComboBoxFx m_ComboCount; 211 | CComboBoxFx m_ComboSize; 212 | CComboBoxFx m_ComboDrive; 213 | CComboBoxFx m_ComboUnit; 214 | 215 | CStaticFx m_WriteUnit; 216 | CStaticFx m_ReadUnit; 217 | CStaticFx m_DemoSetting; 218 | 219 | virtual BOOL OnInitDialog(); 220 | virtual void OnOK(); 221 | virtual void OnCancel(); 222 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 223 | virtual BOOL PreTranslateMessage(MSG* pMsg); 224 | 225 | afx_msg void OnPaint(); 226 | afx_msg HCURSOR OnQueryDragIcon(); 227 | afx_msg LRESULT OnUpdateScore(WPARAM wParam, LPARAM lParam); 228 | afx_msg LRESULT OnUpdateMessage(WPARAM wParam, LPARAM lParam); 229 | afx_msg LRESULT OnExitBenchmark(WPARAM wParam, LPARAM lParam); 230 | afx_msg void OnZoom100(); 231 | afx_msg void OnZoom125(); 232 | afx_msg void OnZoom150(); 233 | afx_msg void OnZoom200(); 234 | afx_msg void OnZoom250(); 235 | afx_msg void OnZoom300(); 236 | afx_msg void OnZoomAuto(); 237 | 238 | afx_msg void OnExit(); 239 | afx_msg void OnAbout(); 240 | afx_msg void OnFontSetting(); 241 | 242 | LRESULT OnQueryEndSession(WPARAM wParam, LPARAM lParam); 243 | 244 | DECLARE_MESSAGE_MAP() 245 | 246 | public: 247 | afx_msg void OnCopy(); 248 | afx_msg void OnHelp(); 249 | afx_msg void OnCrystalDewWorld(); 250 | afx_msg void OnModeDefault(); 251 | afx_msg void OnModeAll0x00(); 252 | afx_msg void OnSettingDefault(); 253 | afx_msg void OnSettingNVMe8(); 254 | afx_msg void OnSettingFlashMemory(); 255 | 256 | afx_msg void OnProfileDefault(); 257 | afx_msg void OnProfilePeak(); 258 | afx_msg void OnProfileReal(); 259 | afx_msg void OnProfileDemo(); 260 | afx_msg void OnSaveText(); 261 | afx_msg void OnSaveImage(); 262 | afx_msg void OnSettingsQueuesThreads(); 263 | afx_msg void OnCbnSelchangeComboDrive(); 264 | afx_msg void OnCbnSelchangeComboUnit(); 265 | afx_msg void UpdateUnitLabel(); 266 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 267 | 268 | void ProfileDefault(); 269 | void ProfilePeak(); 270 | void ProfileReal(); 271 | void ProfileDemo(); 272 | 273 | void SettingsQueuesThreads(int type); 274 | 275 | #ifdef MIX_MODE 276 | afx_msg void OnProfileDefaultMix(); 277 | afx_msg void OnProfilePeakMix(); 278 | afx_msg void OnProfileRealMix(); 279 | void ProfileDefaultMix(); 280 | void ProfilePeakMix(); 281 | void ProfileRealMix(); 282 | afx_msg void OnCbnSelchangeComboMix(); 283 | #endif 284 | 285 | afx_msg void OnBenchmarkReadWrite(); 286 | afx_msg void OnBenchmarkReadOnly(); 287 | afx_msg void OnBenchmarkWriteOnly(); 288 | void BenchmarkReadWrite(); 289 | void BenchmarkReadOnly(); 290 | void BenchmarkWriteOnly(); 291 | }; 292 | -------------------------------------------------------------------------------- /Priscilla/md5.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm 3 | * and modified slightly to be functionally identical but condensed into control structures. 4 | */ 5 | 6 | #include "stdafx.h" 7 | #include "md5.h" 8 | 9 | /* 10 | * Constants defined by the MD5 algorithm 11 | */ 12 | #define A 0x67452301 13 | #define B 0xefcdab89 14 | #define C 0x98badcfe 15 | #define D 0x10325476 16 | 17 | static uint32_t S[] = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 18 | 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 19 | 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 20 | 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21}; 21 | 22 | static uint32_t K[] = {0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 23 | 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 24 | 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 25 | 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 26 | 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 27 | 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 28 | 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 29 | 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 30 | 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 31 | 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 32 | 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 33 | 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 34 | 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 35 | 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 36 | 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 37 | 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391}; 38 | 39 | /* 40 | * Padding used to make the size (in bits) of the input congruent to 448 mod 512 41 | */ 42 | static uint8_t PADDING[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 50 | 51 | /* 52 | * Bit-manipulation functions defined by the MD5 algorithm 53 | */ 54 | #define F(X, Y, Z) ((X & Y) | (~X & Z)) 55 | #define G(X, Y, Z) ((X & Z) | (Y & ~Z)) 56 | #define H(X, Y, Z) (X ^ Y ^ Z) 57 | #define I(X, Y, Z) (Y ^ (X | ~Z)) 58 | 59 | /* 60 | * Rotates a 32-bit word left by n bits 61 | */ 62 | uint32_t rotateLeft(uint32_t x, uint32_t n){ 63 | return (x << n) | (x >> (32 - n)); 64 | } 65 | 66 | 67 | /* 68 | * Initialize a context 69 | */ 70 | void md5Init(MD5Context *ctx){ 71 | ctx->size = (uint64_t)0; 72 | 73 | ctx->buffer[0] = (uint32_t)A; 74 | ctx->buffer[1] = (uint32_t)B; 75 | ctx->buffer[2] = (uint32_t)C; 76 | ctx->buffer[3] = (uint32_t)D; 77 | } 78 | 79 | /* 80 | * Add some amount of input to the context 81 | * 82 | * If the input fills out a block of 512 bits, apply the algorithm (md5Step) 83 | * and save the result in the buffer. Also updates the overall size. 84 | */ 85 | void md5Update(MD5Context *ctx, uint8_t *input_buffer, size_t input_len){ 86 | uint32_t input[16]; 87 | unsigned int offset = (unsigned int)(ctx->size % 64); 88 | ctx->size += (uint64_t)input_len; 89 | 90 | // Copy each byte in input_buffer into the next space in our context input 91 | for(unsigned int i = 0; i < input_len; ++i){ 92 | ctx->input[offset++] = (uint8_t)*(input_buffer + i); 93 | 94 | // If we've filled our context input, copy it into our local array input 95 | // then reset the offset to 0 and fill in a new buffer. 96 | // Every time we fill out a chunk, we run it through the algorithm 97 | // to enable some back and forth between cpu and i/o 98 | if(offset % 64 == 0){ 99 | for(unsigned int j = 0; j < 16; ++j){ 100 | // Convert to little-endian 101 | // The local variable `input` our 512-bit chunk separated into 32-bit words 102 | // we can use in calculations 103 | input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 | 104 | (uint32_t)(ctx->input[(j * 4) + 2]) << 16 | 105 | (uint32_t)(ctx->input[(j * 4) + 1]) << 8 | 106 | (uint32_t)(ctx->input[(j * 4)]); 107 | } 108 | md5Step(ctx->buffer, input); 109 | offset = 0; 110 | } 111 | } 112 | } 113 | 114 | /* 115 | * Pad the current input to get to 448 bytes, append the size in bits to the very end, 116 | * and save the result of the final iteration into digest. 117 | */ 118 | void md5Finalize(MD5Context *ctx){ 119 | uint32_t input[16]; 120 | unsigned int offset = (unsigned int)(ctx->size % 64); 121 | unsigned int padding_length = offset < 56 ? 56 - offset : (56 + 64) - offset; 122 | 123 | // Fill in the padding and undo the changes to size that resulted from the update 124 | md5Update(ctx, PADDING, padding_length); 125 | ctx->size -= (uint64_t)padding_length; 126 | 127 | // Do a final update (internal to this function) 128 | // Last two 32-bit words are the two halves of the size (converted from bytes to bits) 129 | for(unsigned int j = 0; j < 14; ++j){ 130 | input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 | 131 | (uint32_t)(ctx->input[(j * 4) + 2]) << 16 | 132 | (uint32_t)(ctx->input[(j * 4) + 1]) << 8 | 133 | (uint32_t)(ctx->input[(j * 4)]); 134 | } 135 | input[14] = (uint32_t)(ctx->size * 8); 136 | input[15] = (uint32_t)((ctx->size * 8) >> 32); 137 | 138 | md5Step(ctx->buffer, input); 139 | 140 | // Move the result into digest (convert from little-endian) 141 | for(unsigned int i = 0; i < 4; ++i){ 142 | ctx->digest[(i * 4) + 0] = (uint8_t)((ctx->buffer[i] & 0x000000FF)); 143 | ctx->digest[(i * 4) + 1] = (uint8_t)((ctx->buffer[i] & 0x0000FF00) >> 8); 144 | ctx->digest[(i * 4) + 2] = (uint8_t)((ctx->buffer[i] & 0x00FF0000) >> 16); 145 | ctx->digest[(i * 4) + 3] = (uint8_t)((ctx->buffer[i] & 0xFF000000) >> 24); 146 | } 147 | } 148 | 149 | /* 150 | * Step on 512 bits of input with the main MD5 algorithm. 151 | */ 152 | void md5Step(uint32_t *buffer, uint32_t *input){ 153 | uint32_t AA = buffer[0]; 154 | uint32_t BB = buffer[1]; 155 | uint32_t CC = buffer[2]; 156 | uint32_t DD = buffer[3]; 157 | 158 | uint32_t E; 159 | 160 | unsigned int j; 161 | 162 | for(unsigned int i = 0; i < 64; ++i){ 163 | switch(i / 16){ 164 | case 0: 165 | E = F(BB, CC, DD); 166 | j = i; 167 | break; 168 | case 1: 169 | E = G(BB, CC, DD); 170 | j = ((i * 5) + 1) % 16; 171 | break; 172 | case 2: 173 | E = H(BB, CC, DD); 174 | j = ((i * 3) + 5) % 16; 175 | break; 176 | default: 177 | E = I(BB, CC, DD); 178 | j = (i * 7) % 16; 179 | break; 180 | } 181 | 182 | uint32_t temp = DD; 183 | DD = CC; 184 | CC = BB; 185 | BB = BB + rotateLeft(AA + E + K[i] + input[j], S[i]); 186 | AA = temp; 187 | } 188 | 189 | buffer[0] += AA; 190 | buffer[1] += BB; 191 | buffer[2] += CC; 192 | buffer[3] += DD; 193 | } 194 | 195 | /* 196 | * Functions that run the algorithm on the provided input and put the digest into result. 197 | * result should be able to store 16 bytes. 198 | */ 199 | void md5String(char *input, uint8_t *result){ 200 | MD5Context ctx = {0}; 201 | md5Init(&ctx); 202 | md5Update(&ctx, (uint8_t *)input, strlen(input)); 203 | md5Finalize(&ctx); 204 | 205 | memcpy(result, ctx.digest, 16); 206 | } 207 | 208 | /* 209 | void md5File(FILE *file, uint8_t *result){ 210 | char *input_buffer = malloc(1024); 211 | size_t input_size = 0; 212 | 213 | MD5Context ctx; 214 | md5Init(&ctx); 215 | 216 | while((input_size = fread(input_buffer, 1, 1024, file)) > 0){ 217 | md5Update(&ctx, (uint8_t *)input_buffer, input_size); 218 | } 219 | 220 | md5Finalize(&ctx); 221 | 222 | free(input_buffer); 223 | 224 | memcpy(result, ctx.digest, 16); 225 | } 226 | */ 227 | -------------------------------------------------------------------------------- /FontSelectionDlg.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "DiskMark.h" 10 | #include "DiskMarkDlg.h" 11 | #include "FontSelectionDlg.h" 12 | 13 | int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam); 14 | 15 | IMPLEMENT_DYNAMIC(CFontSelectionDlg, CDialog) 16 | 17 | CFontSelectionDlg::CFontSelectionDlg(CWnd* pParent) 18 | : CDialogFx(CFontSelectionDlg::IDD, pParent) 19 | { 20 | CMainDialogFx* p = (CMainDialogFx*)pParent; 21 | 22 | m_ZoomType = p->GetZoomType(); 23 | m_FontScale = p->GetFontScale(); 24 | m_FontRatio = 1.0; // p->GetFontRatio(); 25 | m_FontFace = p->GetFontFace(); 26 | m_FontRender = p->GetFontRender(); 27 | m_CurrentLangPath = p->GetCurrentLangPath(); 28 | m_DefaultLangPath = p->GetDefaultLangPath(); 29 | m_ThemeDir = p->GetThemeDir(); 30 | m_CurrentTheme = p->GetCurrentTheme(); 31 | m_DefaultTheme = p->GetDefaultTheme(); 32 | m_Ini = p->GetIniPath(); 33 | 34 | m_BackgroundName = L""; 35 | } 36 | 37 | CFontSelectionDlg::~CFontSelectionDlg() 38 | { 39 | } 40 | 41 | void CFontSelectionDlg::DoDataExchange(CDataExchange* pDX) 42 | { 43 | CDialog::DoDataExchange(pDX); 44 | DDX_Control(pDX, IDC_OK, m_CtrlOk); 45 | DDX_Control(pDX, IDC_FONT_FACE, m_LabelFontFace); 46 | DDX_Control(pDX, IDC_FONT_SCALE, m_LabelFontScale); 47 | DDX_Control(pDX, IDC_FONT_RENDER, m_LabelFontRender); 48 | DDX_Control(pDX, IDC_FONT_FACE_COMBO, m_CtrlFontFace); 49 | DDX_Control(pDX, IDC_FONT_SCALE_COMBO, m_CtrlFontScale); 50 | DDX_Control(pDX, IDC_FONT_RENDER_COMBO, m_CtrlFontRender); 51 | DDX_Control(pDX, IDC_SET_DEFAULT, m_CtrlDefault); 52 | } 53 | 54 | BEGIN_MESSAGE_MAP(CFontSelectionDlg, CDialogFx) 55 | ON_BN_CLICKED(IDC_OK, &CFontSelectionDlg::OnOk) 56 | ON_BN_CLICKED(IDC_SET_DEFAULT, &CFontSelectionDlg::OnSetDefault) 57 | END_MESSAGE_MAP() 58 | 59 | BOOL CFontSelectionDlg::OnInitDialog() 60 | { 61 | CDialogFx::OnInitDialog(); 62 | 63 | SetWindowTitle(i18n(L"WindowTitle", L"FONT_SETTING")); 64 | 65 | SetDefaultFont(m_FontFace); 66 | 67 | CString cstr; 68 | for (int i = 50; i <= 150; i += 10) 69 | { 70 | cstr.Format(L"%d", i); 71 | m_CtrlFontScale.AddString(cstr); 72 | if (m_FontScale == i) { m_CtrlFontScale.SetCurSel(m_CtrlFontScale.GetCount() - 1); } 73 | } 74 | 75 | m_CtrlFontRender.AddString(i18n(L"Dialog", L"ENABLED")); 76 | m_CtrlFontRender.AddString(i18n(L"Dialog", L"DISABLED")); 77 | 78 | if (m_FontRender == CLEARTYPE_NATURAL_QUALITY) 79 | { 80 | m_CtrlFontRender.SetCurSel(0); 81 | } 82 | else 83 | { 84 | m_CtrlFontRender.SetCurSel(1); 85 | } 86 | 87 | m_LabelFontFace.SetWindowTextW(i18n(L"Dialog", L"FONT_FACE")); 88 | m_LabelFontScale.SetWindowTextW(i18n(L"Dialog", L"FONT_SCALE")); 89 | m_LabelFontRender.SetWindowTextW(L"ClearType"); 90 | m_CtrlDefault.SetWindowTextW(i18n(L"Dialog", L"DEFAULT")); 91 | 92 | UpdateDialogSize(); 93 | 94 | return TRUE; 95 | } 96 | 97 | void CFontSelectionDlg::UpdateDialogSize() 98 | { 99 | CDialogFx::UpdateDialogSize(); 100 | 101 | COLORREF textColor = RGB(0, 0, 0); 102 | COLORREF textSelectedColor = RGB(0, 0, 0); 103 | 104 | ChangeZoomType(m_ZoomType); 105 | SetClientSize(SIZE_X, SIZE_Y, m_ZoomRatio); 106 | 107 | UpdateBackground(FALSE, m_bDarkMode); 108 | 109 | m_LabelFontFace.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, RGB(0, 0, 0), FW_NORMAL, m_FontRender); 110 | m_LabelFontScale.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, RGB(0, 0, 0), FW_NORMAL, m_FontRender); 111 | m_LabelFontRender.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, RGB(0, 0, 0), FW_NORMAL, m_FontRender); 112 | 113 | m_LabelFontFace.InitControl(8, 8, 432, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 114 | m_LabelFontScale.InitControl(8, 80, 208, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 115 | m_LabelFontRender.InitControl(240, 80, 208, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 116 | m_CtrlFontFace.InitControl(20, 32, 440, 360, m_ZoomRatio, &m_BkDC, NULL, 0, ES_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, RGB(255, 255, 255), RGB(160, 220, 255), RGB(255, 255, 255), 0); 117 | m_CtrlFontScale.InitControl(20, 104, 208, 360, m_ZoomRatio, &m_BkDC, NULL, 0, ES_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, RGB(255, 255, 255), RGB(160, 220, 255), RGB(255, 255, 255), 0); 118 | m_CtrlFontRender.InitControl(252, 104, 208, 360, m_ZoomRatio, &m_BkDC, NULL, 0, ES_LEFT, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, RGB(255, 255, 255), RGB(160, 220, 255), RGB(255, 255, 255), 0); 119 | 120 | m_CtrlDefault.InitControl(40, 156, 168, 32, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, SystemDraw, m_bHighContrast, m_bDarkMode, FALSE); 121 | m_CtrlOk.InitControl(272, 156, 168, 32, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, SystemDraw, m_bHighContrast, m_bDarkMode, FALSE); 122 | 123 | m_CtrlFontFace.SetMargin(0, 4, 0, 0, m_ZoomRatio); 124 | m_CtrlFontScale.SetMargin(0, 4, 0, 0, m_ZoomRatio); 125 | m_CtrlFontRender.SetMargin(0, 4, 0, 0, m_ZoomRatio); 126 | 127 | m_CtrlFontFace.SetFontHeight(20, m_ZoomRatio, m_FontRatio); 128 | m_CtrlFontFace.SetFontEx(m_FontFace, 20, 20, m_ZoomRatio, m_FontRatio, textColor, textSelectedColor, FW_NORMAL, m_FontRender); 129 | m_CtrlFontFace.SetItemHeightEx(-1, 36, m_ZoomRatio, m_FontRatio); 130 | for (int i = 0; i < m_CtrlFontFace.GetCount(); i++) 131 | { 132 | m_CtrlFontFace.SetItemHeightEx(i, 32, m_ZoomRatio, m_FontRatio); 133 | } 134 | 135 | m_CtrlFontScale.SetFontHeight(20, m_ZoomRatio, m_FontRatio); 136 | m_CtrlFontScale.SetFontEx(m_FontFace, 20, 20, m_ZoomRatio, m_FontRatio, textColor, textSelectedColor, FW_NORMAL, m_FontRender); 137 | m_CtrlFontScale.SetItemHeightEx(-1, 36, m_ZoomRatio, m_FontRatio); 138 | for (int i = 0; i < m_CtrlFontScale.GetCount(); i++) 139 | { 140 | m_CtrlFontScale.SetItemHeightEx(i, 32, m_ZoomRatio, m_FontRatio); 141 | } 142 | 143 | m_CtrlFontRender.SetFontHeight(20, m_ZoomRatio, m_FontRatio); 144 | m_CtrlFontRender.SetFontEx(m_FontFace, 20, 20, m_ZoomRatio, m_FontRatio, textColor, textSelectedColor, FW_NORMAL, m_FontRender); 145 | m_CtrlFontRender.SetItemHeightEx(-1, 36, m_ZoomRatio, m_FontRatio); 146 | for (int i = 0; i < m_CtrlFontRender.GetCount(); i++) 147 | { 148 | m_CtrlFontRender.SetItemHeightEx(i, 32, m_ZoomRatio, m_FontRatio); 149 | } 150 | 151 | m_CtrlDefault.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, FW_NORMAL, m_FontRender); 152 | m_CtrlOk.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, FW_NORMAL, m_FontRender); 153 | 154 | m_CtrlDefault.SetHandCursor(); 155 | m_CtrlOk.SetHandCursor(); 156 | 157 | SetDarkModeControl(m_CtrlDefault.GetSafeHwnd(), m_bDarkMode); 158 | SetDarkModeControl(m_CtrlOk.GetSafeHwnd(), m_bDarkMode); 159 | 160 | Invalidate(); 161 | } 162 | 163 | void CFontSelectionDlg::OnOk() 164 | { 165 | CString cstr; 166 | 167 | m_CtrlFontFace.GetLBText(m_CtrlFontFace.GetCurSel(), m_FontFace); 168 | m_CtrlFontScale.GetLBText(m_CtrlFontScale.GetCurSel(), cstr); 169 | m_FontScale = _wtoi(cstr); 170 | if (m_CtrlFontRender.GetCurSel() == 0) 171 | { 172 | m_FontRender = CLEARTYPE_NATURAL_QUALITY; 173 | } 174 | else 175 | { 176 | m_FontRender = ANTIALIASED_QUALITY; 177 | } 178 | 179 | CDialog::OnOK(); 180 | } 181 | 182 | int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam) 183 | { 184 | CFontComboBox* pFontComboBox = (CFontComboBox*)lParam; 185 | if(pFontComboBox->FindStringExact(0, (TCHAR*)lpelfe->elfLogFont.lfFaceName) == CB_ERR 186 | && _tcschr((TCHAR*)lpelfe->elfLogFont.lfFaceName, L'@') == NULL 187 | && lpelfe->elfLogFont.lfCharSet != SYMBOL_CHARSET 188 | ) 189 | { 190 | pFontComboBox->AddString((TCHAR*)lpelfe->elfLogFont.lfFaceName); 191 | } 192 | return TRUE; 193 | } 194 | 195 | void CFontSelectionDlg::OnSetDefault() 196 | { 197 | SetDefaultFont(L""); 198 | m_CtrlFontScale.SetCurSel(5); 199 | m_CtrlFontRender.SetCurSel(0); 200 | } 201 | 202 | void CFontSelectionDlg::SetDefaultFont(CString fontFace) 203 | { 204 | m_CtrlFontFace.ResetContent(); 205 | 206 | CClientDC dc(this); 207 | LOGFONT logfont; 208 | ZeroMemory(&logfont, sizeof(LOGFONT)); 209 | logfont.lfCharSet = DEFAULT_CHARSET; 210 | 211 | ::EnumFontFamiliesExW(dc.m_hDC, &logfont, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)&m_CtrlFontFace, 0); 212 | 213 | int no = m_CtrlFontFace.FindStringExact(0, fontFace); 214 | if (no >= 0) 215 | { 216 | m_CtrlFontFace.SetCurSel(no); 217 | } 218 | else 219 | { 220 | no = m_CtrlFontFace.FindStringExact(0, DEFAULT_FONT_FACE_1); 221 | if (no >= 0) 222 | { 223 | m_CtrlFontFace.SetCurSel(no); 224 | } 225 | else 226 | { 227 | no = m_CtrlFontFace.FindStringExact(0, DEFAULT_FONT_FACE_2); 228 | if (no >= 0) 229 | { 230 | m_CtrlFontFace.SetCurSel(no); 231 | } 232 | else 233 | { 234 | m_CtrlFontFace.SetCurSel(0); 235 | } 236 | } 237 | } 238 | 239 | for (int i = 0; i < m_CtrlFontFace.GetCount(); i++) 240 | { 241 | m_CtrlFontFace.SetItemHeightEx(i, 32, m_ZoomRatio, m_FontRatio); 242 | } 243 | } -------------------------------------------------------------------------------- /Priscilla/DarkMode.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : Richard Yu 3 | // Web : https://github.com/ysc3839/win32-darkmode 4 | // License : MIT License 5 | // https://github.com/ysc3839/win32-darkmode/blob/master/LICENSE 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "OsInfoFx.h" 10 | #include "IatHook.h" 11 | 12 | enum IMMERSIVE_HC_CACHE_MODE 13 | { 14 | IHCM_USE_CACHED_VALUE, 15 | IHCM_REFRESH 16 | }; 17 | 18 | // 1903 18362 19 | enum class PreferredAppMode 20 | { 21 | Default, 22 | AllowDark, 23 | ForceDark, 24 | ForceLight, 25 | Max 26 | }; 27 | 28 | enum WINDOWCOMPOSITIONATTRIB 29 | { 30 | WCA_UNDEFINED = 0, 31 | WCA_NCRENDERING_ENABLED = 1, 32 | WCA_NCRENDERING_POLICY = 2, 33 | WCA_TRANSITIONS_FORCEDISABLED = 3, 34 | WCA_ALLOW_NCPAINT = 4, 35 | WCA_CAPTION_BUTTON_BOUNDS = 5, 36 | WCA_NONCLIENT_RTL_LAYOUT = 6, 37 | WCA_FORCE_ICONIC_REPRESENTATION = 7, 38 | WCA_EXTENDED_FRAME_BOUNDS = 8, 39 | WCA_HAS_ICONIC_BITMAP = 9, 40 | WCA_THEME_ATTRIBUTES = 10, 41 | WCA_NCRENDERING_EXILED = 11, 42 | WCA_NCADORNMENTINFO = 12, 43 | WCA_EXCLUDED_FROM_LIVEPREVIEW = 13, 44 | WCA_VIDEO_OVERLAY_ACTIVE = 14, 45 | WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15, 46 | WCA_DISALLOW_PEEK = 16, 47 | WCA_CLOAK = 17, 48 | WCA_CLOAKED = 18, 49 | WCA_ACCENT_POLICY = 19, 50 | WCA_FREEZE_REPRESENTATION = 20, 51 | WCA_EVER_UNCLOAKED = 21, 52 | WCA_VISUAL_OWNER = 22, 53 | WCA_HOLOGRAPHIC = 23, 54 | WCA_EXCLUDED_FROM_DDA = 24, 55 | WCA_PASSIVEUPDATEMODE = 25, 56 | WCA_USEDARKMODECOLORS = 26, 57 | WCA_LAST = 27 58 | }; 59 | 60 | struct WINDOWCOMPOSITIONATTRIBDATA 61 | { 62 | WINDOWCOMPOSITIONATTRIB Attrib; 63 | PVOID pvData; 64 | SIZE_T cbData; 65 | }; 66 | 67 | using fnRtlGetNtVersionNumbers = void (WINAPI*)(LPDWORD major, LPDWORD minor, LPDWORD build); 68 | using fnSetWindowCompositionAttribute = BOOL(WINAPI*)(HWND hWnd, WINDOWCOMPOSITIONATTRIBDATA*); 69 | // 1809 17763 70 | using fnShouldAppsUseDarkMode = bool (WINAPI*)(); // ordinal 132 71 | using fnAllowDarkModeForWindow = bool (WINAPI*)(HWND hWnd, bool allow); // ordinal 133 72 | using fnAllowDarkModeForApp = bool (WINAPI*)(bool allow); // ordinal 135, in 1809 73 | using fnFlushMenuThemes = void (WINAPI*)(); // ordinal 136 74 | using fnRefreshImmersiveColorPolicyState = void (WINAPI*)(); // ordinal 104 75 | using fnIsDarkModeAllowedForWindow = bool (WINAPI*)(HWND hWnd); // ordinal 137 76 | using fnGetIsImmersiveColorUsingHighContrast = bool (WINAPI*)(IMMERSIVE_HC_CACHE_MODE mode); // ordinal 106 77 | using fnOpenNcThemeData = HTHEME(WINAPI*)(HWND hWnd, LPCWSTR pszClassList); // ordinal 49 78 | // 1903 18362 79 | using fnShouldSystemUseDarkMode = bool (WINAPI*)(); // ordinal 138 80 | using fnSetPreferredAppMode = PreferredAppMode(WINAPI*)(PreferredAppMode appMode); // ordinal 135, in 1903 81 | using fnIsDarkModeAllowedForApp = bool (WINAPI*)(); // ordinal 139 82 | 83 | fnSetWindowCompositionAttribute _SetWindowCompositionAttribute = nullptr; 84 | fnShouldAppsUseDarkMode _ShouldAppsUseDarkMode = nullptr; 85 | fnAllowDarkModeForWindow _AllowDarkModeForWindow = nullptr; 86 | fnAllowDarkModeForApp _AllowDarkModeForApp = nullptr; 87 | fnFlushMenuThemes _FlushMenuThemes = nullptr; 88 | fnRefreshImmersiveColorPolicyState _RefreshImmersiveColorPolicyState = nullptr; 89 | fnIsDarkModeAllowedForWindow _IsDarkModeAllowedForWindow = nullptr; 90 | fnGetIsImmersiveColorUsingHighContrast _GetIsImmersiveColorUsingHighContrast = nullptr; 91 | fnOpenNcThemeData _OpenNcThemeData = nullptr; 92 | // 1903 18362 93 | fnShouldSystemUseDarkMode _ShouldSystemUseDarkMode = nullptr; 94 | fnSetPreferredAppMode _SetPreferredAppMode = nullptr; 95 | 96 | bool g_darkModeSupported = false; 97 | bool g_darkModeEnabled = false; 98 | DWORD g_buildNumber = 0; 99 | 100 | bool AllowDarkModeForWindow(HWND hWnd, bool allow) 101 | { 102 | if (g_darkModeSupported) 103 | return _AllowDarkModeForWindow(hWnd, allow); 104 | return false; 105 | } 106 | 107 | bool IsHighContrast() 108 | { 109 | HIGHCONTRASTW highContrast = { sizeof(highContrast) }; 110 | if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE)) 111 | return highContrast.dwFlags & HCF_HIGHCONTRASTON; 112 | return false; 113 | } 114 | 115 | void AllowDarkModeForApp(bool allow) 116 | { 117 | if (_AllowDarkModeForApp) 118 | _AllowDarkModeForApp(allow); 119 | else if (_SetPreferredAppMode) 120 | _SetPreferredAppMode(allow ? PreferredAppMode::AllowDark : PreferredAppMode::Default); 121 | } 122 | 123 | void RefreshTitleBarThemeColor(HWND hWnd) 124 | { 125 | BOOL dark = FALSE; 126 | if (_IsDarkModeAllowedForWindow(hWnd) && 127 | _ShouldAppsUseDarkMode() && 128 | !IsHighContrast()) 129 | { 130 | dark = TRUE; 131 | } 132 | if (g_buildNumber < 18362) 133 | SetPropW(hWnd, L"UseImmersiveDarkModeColors", reinterpret_cast(static_cast(dark))); 134 | else if (_SetWindowCompositionAttribute) 135 | { 136 | WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof(dark) }; 137 | _SetWindowCompositionAttribute(hWnd, &data); 138 | } 139 | } 140 | 141 | constexpr bool CheckBuildNumber(DWORD buildNumber) 142 | { 143 | return (buildNumber >= 17763); 144 | } 145 | 146 | void FixDarkScrollBar() 147 | { 148 | HMODULE hComctl = LoadLibraryExW(L"comctl32.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 149 | if (hComctl) 150 | { 151 | auto addr = FindDelayLoadThunkInModule(hComctl, "uxtheme.dll", 49); // OpenNcThemeData 152 | if (addr) 153 | { 154 | DWORD oldProtect; 155 | if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect)) 156 | { 157 | auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME { 158 | if (wcscmp(classList, L"ScrollBar") == 0) 159 | { 160 | hWnd = nullptr; 161 | classList = L"Explorer::ScrollBar"; 162 | } 163 | return _OpenNcThemeData(hWnd, classList); 164 | }; 165 | 166 | addr->u1.Function = reinterpret_cast(static_cast(MyOpenThemeData)); 167 | VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), oldProtect, &oldProtect); 168 | } 169 | } 170 | } 171 | } 172 | 173 | BOOL InitDarkMode() 174 | { 175 | HMODULE ntdll = GetModuleHandleW(L"ntdll.dll"); 176 | HMODULE user32 = GetModuleHandleW(L"user32.dll"); 177 | if (!ntdll || !user32) return FALSE; 178 | auto RtlGetNtVersionNumbers = reinterpret_cast(GetProcAddress(ntdll, "RtlGetNtVersionNumbers")); 179 | if (RtlGetNtVersionNumbers) 180 | { 181 | DWORD major, minor; 182 | RtlGetNtVersionNumbers(&major, &minor, &g_buildNumber); 183 | g_buildNumber &= ~0xF0000000; 184 | if (major == 10 && minor == 0 && CheckBuildNumber(g_buildNumber)) 185 | { 186 | HMODULE hUxtheme = LoadLibraryExW(L"uxtheme.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 187 | if (hUxtheme) 188 | { 189 | _OpenNcThemeData = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(49))); 190 | _RefreshImmersiveColorPolicyState = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(104))); 191 | _GetIsImmersiveColorUsingHighContrast = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(106))); 192 | _ShouldAppsUseDarkMode = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(132))); 193 | _AllowDarkModeForWindow = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133))); 194 | 195 | auto ord135 = GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135)); 196 | if (g_buildNumber < 18362) 197 | _AllowDarkModeForApp = reinterpret_cast(ord135); 198 | else 199 | _SetPreferredAppMode = reinterpret_cast(ord135); 200 | 201 | //_FlushMenuThemes = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(136))); 202 | _IsDarkModeAllowedForWindow = reinterpret_cast(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(137))); 203 | 204 | _SetWindowCompositionAttribute = reinterpret_cast(GetProcAddress(user32, "SetWindowCompositionAttribute")); 205 | 206 | if (_OpenNcThemeData && 207 | _RefreshImmersiveColorPolicyState && 208 | _ShouldAppsUseDarkMode && 209 | _AllowDarkModeForWindow && 210 | (_AllowDarkModeForApp || _SetPreferredAppMode) && 211 | //_FlushMenuThemes && 212 | _IsDarkModeAllowedForWindow) 213 | { 214 | g_darkModeSupported = true; 215 | 216 | AllowDarkModeForApp(true); 217 | _RefreshImmersiveColorPolicyState(); 218 | 219 | g_darkModeEnabled = _ShouldAppsUseDarkMode() && !IsHighContrast(); 220 | 221 | // FixDarkScrollBar(); 222 | } 223 | } 224 | } 225 | } 226 | 227 | return (BOOL)g_darkModeEnabled; 228 | } 229 | 230 | BOOL SetDarkMode(HWND hWnd) 231 | { 232 | BOOL bDarkMode = FALSE; 233 | if (IsDarkModeSupport()) 234 | { 235 | bDarkMode = InitDarkMode(); 236 | AllowDarkModeForWindow(hWnd, bDarkMode); 237 | RefreshTitleBarThemeColor(hWnd); 238 | } 239 | 240 | return bDarkMode; 241 | } 242 | 243 | void UnsetDarkMode(HWND hWnd) 244 | { 245 | if (IsDarkModeSupport()) 246 | { 247 | InitDarkMode(); 248 | AllowDarkModeForWindow(hWnd, FALSE); 249 | RefreshTitleBarThemeColor(hWnd); 250 | } 251 | } 252 | 253 | void SetDarkModeControl(HWND hWnd, BOOL bDarkMode) 254 | { 255 | if (IsDarkModeSupport()) 256 | { 257 | SetWindowTheme(hWnd, L"Explorer", nullptr); 258 | AllowDarkModeForWindow(hWnd, bDarkMode); 259 | SendMessageW(hWnd, WM_THEMECHANGED, 0, 0); 260 | } 261 | } -------------------------------------------------------------------------------- /Priscilla/ListCtrlFx.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "ListCtrlFx.h" 10 | #include "OsInfoFx.h" 11 | 12 | IMPLEMENT_DYNAMIC(CListCtrlFx, CListCtrl) 13 | 14 | CListCtrlFx::CListCtrlFx() 15 | { 16 | m_X = 0; 17 | m_Y = 0; 18 | m_bNT6orLater = IsNT6orLater(); 19 | m_BkDC = NULL; 20 | m_bHighContrast = FALSE; 21 | m_RenderMode = SystemDraw; 22 | m_bDarkMode = FALSE; 23 | 24 | // Color 25 | m_TextColor1 = RGB(0, 0, 0); 26 | m_TextColor2 = RGB(0, 0, 0); 27 | m_TextSelected = RGB(0, 0, 0); 28 | m_BkColor1 = RGB(255, 255, 255); 29 | m_BkColor2 = RGB(248, 248, 248); 30 | m_BkSelected = RGB(248, 248, 255); 31 | m_LineColor1 = RGB(224, 224, 224); 32 | m_LineColor2 = RGB(240, 240, 240); 33 | 34 | // Glass 35 | m_GlassColor = RGB(255, 255, 255); 36 | m_GlassAlpha = 128; 37 | } 38 | 39 | CListCtrlFx::~CListCtrlFx() 40 | { 41 | } 42 | 43 | #pragma warning( disable : 26454 ) 44 | BEGIN_MESSAGE_MAP(CListCtrlFx, CListCtrl) 45 | ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, &CListCtrlFx::OnCustomdraw) 46 | END_MESSAGE_MAP() 47 | #pragma warning( default : 26454 ) 48 | 49 | BOOL CListCtrlFx::InitControl(int x, int y, int width, int height, int maxWidth, int maxHeight, double zoomRatio, CDC* bkDC, int renderMode, BOOL bHighContrast, BOOL bDarkMode) 50 | { 51 | m_X = (int)(x * zoomRatio); 52 | m_Y = (int)(y * zoomRatio); 53 | m_CtrlSize.cx = (int)(width * zoomRatio); 54 | m_CtrlSize.cy = (int)(height * zoomRatio); 55 | MoveWindow(m_X, m_Y, m_CtrlSize.cx, m_CtrlSize.cy); 56 | maxWidth = (int)(maxWidth * zoomRatio); 57 | maxHeight = (int)(maxHeight * zoomRatio); 58 | 59 | m_BkDC = bkDC; 60 | m_RenderMode = renderMode; 61 | m_bHighContrast = bHighContrast; 62 | m_bDarkMode = bDarkMode; 63 | 64 | if (m_bHighContrast) 65 | { 66 | SetBkImage((LPTSTR)_T("")); 67 | } 68 | else if (renderMode & OwnerDrawGlass || renderMode & OwnerDrawTransparent) 69 | { 70 | m_BkBitmap.DeleteObject(); 71 | m_BkBitmap.CreateCompatibleBitmap(m_BkDC, maxWidth, maxHeight); 72 | CDC BkDC; 73 | BkDC.CreateCompatibleDC(m_BkDC); 74 | BkDC.SelectObject(m_BkBitmap); 75 | BkDC.BitBlt(0, 0, maxWidth, maxHeight, m_BkDC, m_X + 2, m_Y + 2, SRCCOPY); 76 | 77 | m_CtrlImage.Destroy(); 78 | m_CtrlImage.Create(maxWidth, maxHeight, 32); 79 | 80 | RECT rect{}; 81 | rect.top = 0; 82 | rect.left = 0; 83 | rect.right = maxWidth; 84 | rect.bottom = maxHeight; 85 | 86 | m_CtrlBitmap.Detach(); 87 | m_CtrlBitmap.Attach((HBITMAP)m_CtrlImage); 88 | 89 | DWORD length = maxWidth * maxHeight * 4; 90 | BYTE* bitmapBits = new BYTE[length]; 91 | m_CtrlBitmap.GetBitmapBits(length, bitmapBits); 92 | 93 | BYTE r, g, b, a; 94 | if (renderMode & OwnerDrawGlass) 95 | { 96 | r = (BYTE)GetRValue(m_GlassColor); 97 | g = (BYTE)GetGValue(m_GlassColor); 98 | b = (BYTE)GetBValue(m_GlassColor); 99 | a = m_GlassAlpha; 100 | } 101 | else // OwnerDrawTransparent 102 | { 103 | r = 0; 104 | g = 0; 105 | b = 0; 106 | a = 0; 107 | } 108 | 109 | for (int y = 0; y < maxHeight; y++) 110 | { 111 | for (int x = 0; x < maxWidth; x++) 112 | { 113 | DWORD p = (y * maxWidth + x) * 4; 114 | #pragma warning( disable : 6386 ) 115 | bitmapBits[p + 0] = b; 116 | bitmapBits[p + 1] = g; 117 | bitmapBits[p + 2] = r; 118 | bitmapBits[p + 3] = a; 119 | #pragma warning( default : 6386 ) 120 | } 121 | } 122 | 123 | m_CtrlBitmap.SetBitmapBits(length, bitmapBits); 124 | delete[] bitmapBits; 125 | 126 | SetupControlImage(m_BkBitmap, m_CtrlBitmap); 127 | if(m_bNT6orLater) 128 | { 129 | SetBkImage((HBITMAP)m_CtrlBitmap); 130 | m_Header.InitControl(x, y, zoomRatio, bkDC, &m_CtrlBitmap, m_TextColor1, m_BkColor1, m_LineColor1, m_RenderMode, m_bHighContrast, m_bDarkMode); 131 | } 132 | else 133 | { 134 | SetBkColor(m_BkColor1); 135 | m_Header.InitControl(x, y, zoomRatio, bkDC, NULL, m_TextColor1, m_BkColor1, m_LineColor1, m_RenderMode, m_bHighContrast, m_bDarkMode); 136 | } 137 | } 138 | else 139 | { 140 | if(m_bNT6orLater) 141 | { 142 | SetBkImage((LPTSTR)_T("")); 143 | SetBkColor(m_BkColor1); 144 | m_Header.InitControl(x, y, zoomRatio, bkDC, NULL, m_TextColor1, m_BkColor1, m_LineColor1, m_RenderMode, m_bHighContrast, m_bDarkMode); 145 | } 146 | else 147 | { 148 | SetBkColor(m_BkColor1); 149 | m_Header.InitControl(x, y, zoomRatio, bkDC, NULL, m_TextColor1, m_BkColor1, m_LineColor1, m_RenderMode, m_bHighContrast, m_bDarkMode); 150 | } 151 | } 152 | 153 | return TRUE; 154 | } 155 | 156 | void CListCtrlFx::SetupControlImage(CBitmap& bkBitmap, CBitmap& ctrlBitmap) 157 | { 158 | int color = m_BkDC->GetDeviceCaps(BITSPIXEL) * m_BkDC->GetDeviceCaps(PLANES); 159 | 160 | CBitmap* bk32Bitmap; 161 | CImage bk32Image; 162 | if (color == 32) 163 | { 164 | bk32Bitmap = &bkBitmap; 165 | } 166 | else 167 | { 168 | bk32Image.Create(m_CtrlSize.cx, m_CtrlSize.cy, 32); 169 | ::BitBlt(bk32Image.GetDC(), 0, 0, m_CtrlSize.cx, m_CtrlSize.cy, *m_BkDC, m_X, m_Y, SRCCOPY); 170 | bk32Bitmap = CBitmap::FromHandle((HBITMAP)bk32Image); 171 | bk32Image.ReleaseDC(); 172 | } 173 | 174 | BITMAP CtlBmpInfo, DstBmpInfo; 175 | bk32Bitmap->GetBitmap(&DstBmpInfo); 176 | DWORD DstLineBytes = DstBmpInfo.bmWidthBytes; 177 | DWORD DstMemSize = DstLineBytes * DstBmpInfo.bmHeight; 178 | ctrlBitmap.GetBitmap(&CtlBmpInfo); 179 | DWORD CtlLineBytes = CtlBmpInfo.bmWidthBytes; 180 | DWORD CtlMemSize = CtlLineBytes * CtlBmpInfo.bmHeight; 181 | BYTE* DstBuffer = new BYTE[DstMemSize]; 182 | bk32Bitmap->GetBitmapBits(DstMemSize, DstBuffer); 183 | BYTE* CtlBuffer = new BYTE[CtlMemSize]; 184 | ctrlBitmap.GetBitmapBits(CtlMemSize, CtlBuffer); 185 | 186 | int baseY = 0; 187 | for (LONG py = 0; py < DstBmpInfo.bmHeight; py++) 188 | { 189 | int dn = py * DstLineBytes; 190 | int cn = (baseY + py) * CtlLineBytes; 191 | for (LONG px = 0; px < DstBmpInfo.bmWidth; px++) 192 | { 193 | #pragma warning( disable : 6385 ) 194 | #pragma warning( disable : 6386 ) 195 | BYTE a = CtlBuffer[cn + 3]; 196 | BYTE na = 255 - a; 197 | CtlBuffer[dn + 0] = (BYTE)((CtlBuffer[cn + 0] * a + DstBuffer[dn + 0] * na) / 255); 198 | CtlBuffer[dn + 1] = (BYTE)((CtlBuffer[cn + 1] * a + DstBuffer[dn + 1] * na) / 255); 199 | CtlBuffer[dn + 2] = (BYTE)((CtlBuffer[cn + 2] * a + DstBuffer[dn + 2] * na) / 255); 200 | dn += (DstBmpInfo.bmBitsPixel / 8); 201 | cn += (CtlBmpInfo.bmBitsPixel / 8); 202 | #pragma warning( default : 6386 ) 203 | #pragma warning( default : 6385 ) 204 | } 205 | } 206 | 207 | if (color == 32) 208 | { 209 | ctrlBitmap.SetBitmapBits(CtlMemSize, CtlBuffer); 210 | } 211 | else 212 | { 213 | bk32Bitmap->SetBitmapBits(CtlMemSize, CtlBuffer); 214 | m_CtrlImage.Detach(); 215 | m_CtrlImage.Attach(ctrlBitmap); 216 | ::BitBlt(m_CtrlImage.GetDC(), 0, 0, m_CtrlSize.cx - 1, m_CtrlSize.cy - 1, bk32Image.GetDC(), 1, 1, SRCCOPY); 217 | m_CtrlImage.ReleaseDC(); 218 | bk32Image.ReleaseDC(); 219 | } 220 | 221 | delete[] DstBuffer; 222 | delete[] CtlBuffer; 223 | } 224 | 225 | void CListCtrlFx::OnCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) 226 | { 227 | LPNMLVCUSTOMDRAW lpLVCustomDraw = reinterpret_cast(pNMHDR); 228 | 229 | switch(lpLVCustomDraw->nmcd.dwDrawStage) 230 | { 231 | case CDDS_ITEMPREPAINT: 232 | case CDDS_ITEMPREPAINT | CDDS_SUBITEM: 233 | if(! m_bHighContrast) 234 | { 235 | if(lpLVCustomDraw->nmcd.dwItemSpec % 2 == 0) 236 | { 237 | lpLVCustomDraw->clrText = m_TextColor1; 238 | lpLVCustomDraw->clrTextBk = m_BkColor1; 239 | } 240 | else 241 | { 242 | lpLVCustomDraw->clrText = m_TextColor2; 243 | lpLVCustomDraw->clrTextBk = m_BkColor2; 244 | } 245 | } 246 | break; 247 | case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM: 248 | { 249 | RECT rc{}; 250 | CBrush br1(m_LineColor1); 251 | CBrush br2(m_LineColor2); 252 | 253 | CHeaderCtrl* header = this->GetHeaderCtrl(); 254 | if(header != NULL) 255 | { 256 | int count = header->GetItemCount(); 257 | for(int i = 0; i < count; i++) 258 | { 259 | ListView_GetSubItemRect(m_hWnd, lpLVCustomDraw->nmcd.dwItemSpec, i, LVIR_LABEL, &rc); 260 | LONG left = rc.left; 261 | rc.left = rc.right - 1; 262 | FillRect(lpLVCustomDraw->nmcd.hdc, &rc, (HBRUSH)br1.GetSafeHandle()); 263 | rc.left = left; 264 | rc.top = rc.bottom - 1; 265 | FillRect(lpLVCustomDraw->nmcd.hdc, &rc, (HBRUSH)br2.GetSafeHandle()); 266 | } 267 | } 268 | } 269 | break; 270 | default: 271 | break; 272 | } 273 | 274 | *pResult = 0; 275 | *pResult |= CDRF_NOTIFYPOSTPAINT; 276 | *pResult |= CDRF_NOTIFYITEMDRAW; 277 | *pResult |= CDRF_NOTIFYSUBITEMDRAW; 278 | } 279 | 280 | void CListCtrlFx::SetTextColor1(COLORREF color){m_TextColor1 = color;} 281 | void CListCtrlFx::SetTextColor2(COLORREF color){m_TextColor2 = color;} 282 | void CListCtrlFx::SetTextSelected(COLORREF color){m_TextSelected = color;} 283 | void CListCtrlFx::SetBkColor1(COLORREF color){m_BkColor1 = color;} 284 | void CListCtrlFx::SetBkColor2(COLORREF color){m_BkColor2 = color;} 285 | void CListCtrlFx::SetBkSelected(COLORREF color){m_BkSelected = color;} 286 | void CListCtrlFx::SetLineColor1(COLORREF color){m_LineColor1 = color;} 287 | void CListCtrlFx::SetLineColor2(COLORREF color){m_LineColor2 = color;} 288 | 289 | void CListCtrlFx::SetGlassColor(COLORREF glassColor, BYTE glassAlpha) 290 | { 291 | m_GlassColor = glassColor; 292 | m_GlassAlpha = glassAlpha; 293 | } 294 | 295 | COLORREF CListCtrlFx::GetTextColor1(){return m_TextColor1;} 296 | COLORREF CListCtrlFx::GetTextColor2(){return m_TextColor2;} 297 | COLORREF CListCtrlFx::GetTextSelected(){return m_TextSelected;} 298 | COLORREF CListCtrlFx::GetBkColor1(){return m_BkColor1;} 299 | COLORREF CListCtrlFx::GetBkColor2(){return m_BkColor2;} 300 | COLORREF CListCtrlFx::GetBkSelected(){return m_BkSelected;} 301 | COLORREF CListCtrlFx::GetLineColor1(){return m_LineColor1;} 302 | COLORREF CListCtrlFx::GetLineColor2(){return m_LineColor2;} 303 | 304 | void CListCtrlFx::SetFontEx(CString face, int size, double zoomRatio, double fontRatio, LONG fontWeight, BYTE fontRender) 305 | { 306 | LOGFONT logFont = { 0 }; 307 | logFont.lfCharSet = DEFAULT_CHARSET; 308 | logFont.lfHeight = (LONG)(-1 * size * zoomRatio * fontRatio); 309 | logFont.lfQuality = fontRender; 310 | logFont.lfWeight = fontWeight; 311 | if (face.GetLength() < 32) 312 | { 313 | wsprintf(logFont.lfFaceName, _T("%s"), (LPCTSTR)face); 314 | } 315 | else 316 | { 317 | wsprintf(logFont.lfFaceName, _T("")); 318 | } 319 | 320 | m_Font.DeleteObject(); 321 | m_Font.CreateFontIndirect(&logFont); 322 | SetFont(&m_Font); 323 | 324 | m_Header.SetFontEx(face, size, zoomRatio, fontRatio, fontWeight, fontRender); 325 | } 326 | 327 | void CListCtrlFx::PreSubclassWindow() 328 | { 329 | CListCtrl::PreSubclassWindow(); 330 | 331 | CHeaderCtrlFx* pHeader = (CHeaderCtrlFx*)GetHeaderCtrl(); 332 | m_Header.SubclassWindow(pHeader->GetSafeHwnd()); 333 | } 334 | 335 | void CListCtrlFx::EnableHeaderOwnerDraw(BOOL bOwnerDraw) 336 | { 337 | if (m_bHighContrast) 338 | { 339 | HDITEM hi = { 0 }; 340 | hi.mask = HDI_FORMAT; 341 | for (int i = 0; i < m_Header.GetItemCount(); i++) 342 | { 343 | m_Header.GetItem(i, &hi); 344 | hi.fmt &= ~HDF_OWNERDRAW; 345 | m_Header.SetItem(i, &hi); 346 | } 347 | return; 348 | } 349 | else if (m_RenderMode & OwnerDrawGlass) 350 | { 351 | HDITEM hi = {0}; 352 | hi.mask = HDI_FORMAT; 353 | if (bOwnerDraw) 354 | { 355 | for (int i = 0; i < m_Header.GetItemCount(); i++) 356 | { 357 | m_Header.GetItem(i, &hi); 358 | hi.fmt |= HDF_OWNERDRAW; 359 | m_Header.SetItem(i, &hi); 360 | } 361 | } 362 | else 363 | { 364 | for (int i = 0; i < m_Header.GetItemCount(); i++) 365 | { 366 | m_Header.GetItem(i, &hi); 367 | hi.fmt &= ~HDF_OWNERDRAW; 368 | m_Header.SetItem(i, &hi); 369 | } 370 | } 371 | } 372 | } 373 | -------------------------------------------------------------------------------- /Priscilla/OsInfoFx.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | ////------------------------------------------------ 13 | // OS Info 14 | ////------------------------------------------------ 15 | 16 | #if _MSC_VER > 1310 17 | BOOL IsWindowsVersionOrGreaterFx(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor = 0); 18 | BOOL IsWindowsBuildOrGreater(DWORD build); 19 | BOOL IsX64(); 20 | BOOL IsIa64(); 21 | BOOL IsArm32(); 22 | BOOL IsArm64(); 23 | BOOL IsWow64(); 24 | BOOL IsIe556(); 25 | BOOL IsDotNet2(); 26 | BOOL IsDotNet4(); 27 | BOOL IsDotNet48(); 28 | BOOL IsNT5(); 29 | BOOL IsNT6orLater(); 30 | BOOL IsWin2k(); 31 | BOOL IsWinXpOrLater(); 32 | BOOL IsWinXpLuna(); 33 | BOOL IsWin8orLater(); 34 | BOOL IsWin81orLater(); 35 | BOOL IsDarkModeSupport(); 36 | BOOL HasSidebar(); 37 | #endif 38 | 39 | #if _MSC_VER <= 1310 40 | #ifdef UNICODE 41 | BOOL IsCurrentUserLocalAdministrator(void); 42 | BOOL IsUserAdmin(VOID); 43 | #endif 44 | #endif 45 | 46 | BOOL IsNT3(); 47 | BOOL IsNT4(); 48 | BOOL IsWin9x(); 49 | BOOL IsWin95(); 50 | BOOL IsWin95First(); 51 | BOOL IsPC98(); 52 | BOOL IsNT51orlater(); 53 | BOOL IsRunningOnWine(); 54 | 55 | DWORD GetIeVersion(); 56 | // DWORD GetWin10Version(); 57 | void GetOsName(CString& osFullName, CString& osName, CString& osVersion, CString& osArchitecture); 58 | void GetOsNameWmi(CString& osFullName); 59 | 60 | ////------------------------------------------------ 61 | // Define 62 | ////------------------------------------------------ 63 | 64 | #define PRODUCT_UNDEFINED 0x00000000 65 | 66 | #define PRODUCT_ULTIMATE 0x00000001 67 | #define PRODUCT_HOME_BASIC 0x00000002 68 | #define PRODUCT_HOME_PREMIUM 0x00000003 69 | #define PRODUCT_ENTERPRISE 0x00000004 70 | #define PRODUCT_HOME_BASIC_N 0x00000005 71 | #define PRODUCT_BUSINESS 0x00000006 72 | #define PRODUCT_STANDARD_SERVER 0x00000007 73 | #define PRODUCT_DATACENTER_SERVER 0x00000008 74 | #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009 75 | #define PRODUCT_ENTERPRISE_SERVER 0x0000000A 76 | #define PRODUCT_STARTER 0x0000000B 77 | #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C 78 | #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D 79 | #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E 80 | #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F 81 | #define PRODUCT_BUSINESS_N 0x00000010 82 | #define PRODUCT_WEB_SERVER 0x00000011 83 | #define PRODUCT_CLUSTER_SERVER 0x00000012 84 | #define PRODUCT_HOME_SERVER 0x00000013 85 | #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014 86 | #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015 87 | #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016 88 | #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017 89 | #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018 90 | #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x00000019 91 | #define PRODUCT_HOME_PREMIUM_N 0x0000001A 92 | #define PRODUCT_ENTERPRISE_N 0x0000001B 93 | #define PRODUCT_ULTIMATE_N 0x0000001C 94 | #define PRODUCT_WEB_SERVER_CORE 0x0000001D 95 | #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E 96 | #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F 97 | #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020 98 | #define PRODUCT_SERVER_FOUNDATION 0x00000021 99 | #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022 100 | #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023 101 | #define PRODUCT_STANDARD_SERVER_V 0x00000024 102 | #define PRODUCT_DATACENTER_SERVER_V 0x00000025 103 | #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026 104 | #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027 105 | #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028 106 | #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029 107 | #define PRODUCT_HYPERV 0x0000002A 108 | #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B 109 | #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C 110 | #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D 111 | #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E 112 | #define PRODUCT_STARTER_N 0x0000002F 113 | #define PRODUCT_PROFESSIONAL 0x00000030 114 | #define PRODUCT_PROFESSIONAL_N 0x00000031 115 | #define PRODUCT_SB_SOLUTION_SERVER 0x00000032 116 | #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033 117 | #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034 118 | #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035 119 | #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036 120 | #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037 121 | #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038 122 | #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039 123 | #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A 124 | #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B 125 | #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C 126 | #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D 127 | #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E 128 | #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F 129 | #define PRODUCT_CLUSTER_SERVER_V 0x00000040 130 | #define PRODUCT_EMBEDDED 0x00000041 131 | #define PRODUCT_STARTER_E 0x00000042 132 | #define PRODUCT_HOME_BASIC_E 0x00000043 133 | #define PRODUCT_HOME_PREMIUM_E 0x00000044 134 | #define PRODUCT_PROFESSIONAL_E 0x00000045 135 | #define PRODUCT_ENTERPRISE_E 0x00000046 136 | #define PRODUCT_ULTIMATE_E 0x00000047 137 | #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048 138 | #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C 139 | #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D 140 | #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F 141 | #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050 142 | #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054 143 | #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055 144 | #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056 145 | #define PRODUCT_THINPC 0x00000057 146 | #define PRODUCT_EMBEDDED_A 0x00000058 147 | #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059 148 | #define PRODUCT_EMBEDDED_E 0x0000005A 149 | #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B 150 | #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C 151 | #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F 152 | #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060 153 | #define PRODUCT_CORE_ARM 0x00000061 154 | #define PRODUCT_CORE_N 0x00000062 155 | #define PRODUCT_CORE_COUNTRYSPECIFIC 0x00000063 156 | #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064 157 | #define PRODUCT_CORE 0x00000065 158 | #define PRODUCT_PROFESSIONAL_WMC 0x00000067 159 | #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069 160 | #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A 161 | #define PRODUCT_EMBEDDED_EVAL 0x0000006B 162 | #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C 163 | #define PRODUCT_NANO_SERVER 0x0000006D 164 | #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E 165 | #define PRODUCT_CORE_CONNECTED 0x0000006F 166 | #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070 167 | #define PRODUCT_CORE_CONNECTED_N 0x00000071 168 | #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072 169 | #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073 170 | #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074 171 | #define PRODUCT_CONNECTED_CAR 0x00000075 172 | #define PRODUCT_INDUSTRY_HANDHELD 0x00000076 173 | #define PRODUCT_PPI_PRO 0x00000077 174 | #define PRODUCT_ARM64_SERVER 0x00000078 175 | #define PRODUCT_EDUCATION 0x00000079 176 | #define PRODUCT_EDUCATION_N 0x0000007A 177 | #define PRODUCT_IOTUAP 0x0000007B 178 | #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C 179 | #define PRODUCT_ENTERPRISE_S 0x0000007D 180 | #define PRODUCT_ENTERPRISE_S_N 0x0000007E 181 | #define PRODUCT_PROFESSIONAL_S 0x0000007F 182 | #define PRODUCT_PROFESSIONAL_S_N 0x00000080 183 | #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081 184 | #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082 185 | #define PRODUCT_HOLOGRAPHIC 0x00000087 186 | #define PRODUCT_HOLOGRAPHIC_BUSINESS 0x00000088 187 | #define PRODUCT_PRO_SINGLE_LANGUAGE 0x0000008A 188 | #define PRODUCT_PRO_CHINA 0x0000008B 189 | #define PRODUCT_ENTERPRISE_SUBSCRIPTION 0x0000008C 190 | #define PRODUCT_ENTERPRISE_SUBSCRIPTION_N 0x0000008D 191 | #define PRODUCT_DATACENTER_NANO_SERVER 0x0000008F 192 | #define PRODUCT_STANDARD_NANO_SERVER 0x00000090 193 | #define PRODUCT_DATACENTER_A_SERVER_CORE 0x00000091 194 | #define PRODUCT_STANDARD_A_SERVER_CORE 0x00000092 195 | #define PRODUCT_DATACENTER_WS_SERVER_CORE 0x00000093 196 | #define PRODUCT_STANDARD_WS_SERVER_CORE 0x00000094 197 | #define PRODUCT_UTILITY_VM 0x00000095 198 | #define PRODUCT_DATACENTER_EVALUATION_SERVER_CORE 0x0000009F 199 | #define PRODUCT_STANDARD_EVALUATION_SERVER_CORE 0x000000A0 200 | #define PRODUCT_PRO_WORKSTATION 0x000000A1 201 | #define PRODUCT_PRO_WORKSTATION_N 0x000000A2 202 | #define PRODUCT_PRO_FOR_EDUCATION 0x000000A4 203 | #define PRODUCT_PRO_FOR_EDUCATION_N 0x000000A5 204 | #define PRODUCT_AZURE_SERVER_CORE 0x000000A8 205 | #define PRODUCT_AZURE_NANO_SERVER 0x000000A9 206 | #define PRODUCT_ENTERPRISEG 0x000000AB 207 | #define PRODUCT_ENTERPRISEGN 0x000000AC 208 | #define PRODUCT_SERVERRDSH 0x000000AF 209 | #define PRODUCT_CLOUD 0x000000B2 210 | #define PRODUCT_CLOUDN 0x000000B3 211 | #define PRODUCT_HUBOS 0x000000B4 212 | #define PRODUCT_ONECOREUPDATEOS 0x000000B6 213 | #define PRODUCT_CLOUDE 0x000000B7 214 | #define PRODUCT_IOTOS 0x000000B9 215 | #define PRODUCT_CLOUDEN 0x000000BA 216 | #define PRODUCT_IOTEDGEOS 0x000000BB 217 | #define PRODUCT_IOTENTERPRISE 0x000000BC 218 | #define PRODUCT_LITE 0x000000BD 219 | #define PRODUCT_IOTENTERPRISES 0x000000BF 220 | #define PRODUCT_XBOX_SYSTEMOS 0x000000C0 221 | #define PRODUCT_XBOX_GAMEOS 0x000000C2 222 | #define PRODUCT_XBOX_ERAOS 0x000000C3 223 | #define PRODUCT_XBOX_DURANGOHOSTOS 0x000000C4 224 | #define PRODUCT_XBOX_SCARLETTHOSTOS 0x000000C5 225 | #define PRODUCT_XBOX_KEYSTONE 0x000000C6 226 | #define PRODUCT_AZURE_SERVER_CLOUDHOST 0x000000C7 227 | #define PRODUCT_AZURE_SERVER_CLOUDMOS 0x000000C8 228 | #define PRODUCT_CLOUDEDITIONN 0x000000CA 229 | #define PRODUCT_CLOUDEDITION 0x000000CB 230 | #define PRODUCT_AZURESTACKHCI_SERVER_CORE 0x00000196 231 | #define PRODUCT_DATACENTER_SERVER_AZURE_EDITION 0x00000197 232 | #define PRODUCT_DATACENTER_SERVER_CORE_AZURE_EDITION 0x00000198 233 | 234 | #define PRODUCT_UNLICENSED 0xABCDABCD 235 | 236 | // ChatGPT... 237 | #define PRODUCT_ENTERPRISE_G 0x00000067 238 | #define PRODUCT_PROFESSIONAL_WORKSTATION 0x000000B5 239 | #define PRODUCT_PROFESSIONAL_WORKSTATION_N 0x000000B6 240 | 241 | #define SM_TABLETPC 86 242 | #define SM_MEDIACENTER 87 243 | #define SM_STARTER 88 244 | #define SM_SERVERR2 89 245 | -------------------------------------------------------------------------------- /AboutDlg.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "DiskMark.h" 10 | #include "DiskMarkDlg.h" 11 | #include "AboutDlg.h" 12 | 13 | IMPLEMENT_DYNCREATE(CAboutDlg, CDialog) 14 | 15 | CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/) 16 | : CDialogFx(CAboutDlg::IDD, pParent) 17 | { 18 | CMainDialogFx* p = (CMainDialogFx*)pParent; 19 | 20 | m_ZoomType = p->GetZoomType(); 21 | m_FontScale = p->GetFontScale(); 22 | m_FontRatio = p->GetFontRatio(); 23 | m_FontFace = p->GetFontFace(); 24 | m_FontRender = p->GetFontRender(); 25 | m_CurrentLangPath = p->GetCurrentLangPath(); 26 | m_DefaultLangPath = p->GetDefaultLangPath(); 27 | m_ThemeDir = p->GetThemeDir(); 28 | m_CurrentTheme = p->GetCurrentTheme(); 29 | m_DefaultTheme = p->GetDefaultTheme(); 30 | m_Ini = p->GetIniPath(); 31 | 32 | #ifdef SUISHO_SHIZUKU_SUPPORT 33 | m_BackgroundName = L"About"; 34 | #else 35 | m_BackgroundName = L""; 36 | #endif 37 | } 38 | 39 | CAboutDlg::~CAboutDlg() 40 | { 41 | } 42 | 43 | void CAboutDlg::DoDataExchange(CDataExchange* pDX) 44 | { 45 | CDialogFx::DoDataExchange(pDX); 46 | DDX_Control(pDX, IDC_LOGO, m_CtrlLogo); 47 | 48 | DDX_Control(pDX, IDC_PROJECT_SITE_1, m_CtrlProjectSite1); 49 | DDX_Control(pDX, IDC_PROJECT_SITE_2, m_CtrlProjectSite2); 50 | DDX_Control(pDX, IDC_PROJECT_SITE_3, m_CtrlProjectSite3); 51 | DDX_Control(pDX, IDC_PROJECT_SITE_4, m_CtrlProjectSite4); 52 | DDX_Control(pDX, IDC_PROJECT_SITE_5, m_CtrlProjectSite5); 53 | 54 | DDX_Control(pDX, IDC_VERSION, m_CtrlVersion); 55 | DDX_Control(pDX, IDC_LICENSE, m_CtrlLicense); 56 | DDX_Control(pDX, IDC_RELEASE, m_CtrlRelease); 57 | DDX_Control(pDX, IDC_COPYRIGHT1, m_CtrlCopyright1); 58 | DDX_Control(pDX, IDC_COPYRIGHT2, m_CtrlCopyright2); 59 | DDX_Control(pDX, IDC_COPYRIGHT3, m_CtrlCopyright3); 60 | DDX_Control(pDX, IDC_EDITION, m_CtrlEdition); 61 | } 62 | 63 | BOOL CAboutDlg::OnInitDialog() 64 | { 65 | CDialogFx::OnInitDialog(); 66 | 67 | SetWindowTitle(i18n(L"WindowTitle", L"ABOUT")); 68 | 69 | m_bShowWindow = TRUE; 70 | m_CtrlVersion.SetWindowTextW(PRODUCT_NAME L" " PRODUCT_VERSION); 71 | m_CtrlEdition.SetWindowTextW(PRODUCT_EDITION); 72 | m_CtrlRelease.SetWindowTextW(L"Release: " PRODUCT_RELEASE); 73 | m_CtrlCopyright1.SetWindowTextW(PRODUCT_COPYRIGHT_1); 74 | m_CtrlCopyright2.SetWindowTextW(PRODUCT_COPYRIGHT_2); 75 | m_CtrlCopyright3.SetWindowTextW(PRODUCT_COPYRIGHT_3); 76 | m_CtrlLicense.SetWindowTextW(PRODUCT_LICENSE); 77 | 78 | UpdateDialogSize(); 79 | 80 | CenterWindow(); 81 | ShowWindow(SW_SHOW); 82 | return TRUE; 83 | } 84 | 85 | BEGIN_MESSAGE_MAP(CAboutDlg, CDialogFx) 86 | ON_BN_CLICKED(IDC_LOGO, &CAboutDlg::OnLogo) 87 | ON_BN_CLICKED(IDC_LICENSE, &CAboutDlg::OnLicense) 88 | ON_BN_CLICKED(IDC_VERSION, &CAboutDlg::OnVersion) 89 | #ifdef SUISHO_SHIZUKU_SUPPORT 90 | ON_BN_CLICKED(IDC_PROJECT_SITE_1, &CAboutDlg::OnProjectSite1) 91 | ON_BN_CLICKED(IDC_PROJECT_SITE_2, &CAboutDlg::OnProjectSite2) 92 | ON_BN_CLICKED(IDC_PROJECT_SITE_3, &CAboutDlg::OnProjectSite3) 93 | ON_BN_CLICKED(IDC_PROJECT_SITE_4, &CAboutDlg::OnProjectSite4) 94 | ON_BN_CLICKED(IDC_PROJECT_SITE_5, &CAboutDlg::OnProjectSite5) 95 | #endif 96 | END_MESSAGE_MAP() 97 | 98 | 99 | void CAboutDlg::UpdateDialogSize() 100 | { 101 | CDialogFx::UpdateDialogSize(); 102 | m_bHighContrast = FALSE; 103 | 104 | ChangeZoomType(m_ZoomType); 105 | SetClientSize(SIZE_X, SIZE_Y, m_ZoomRatio); 106 | UpdateBackground(TRUE, m_bDarkMode); 107 | 108 | #ifdef SUISHO_AOI_SUPPORT 109 | m_CtrlLogo.InitControl(32, 484, 128, 144, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 110 | m_CtrlSecretVoice.InitControl(392, 288, 60, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 111 | m_CtrlProjectSite1.InitControl(184, 508, 148, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 112 | m_CtrlProjectSite2.InitControl(244, 540, 108, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 113 | m_CtrlProjectSite3.InitControl(232, 556, 180, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 114 | m_CtrlProjectSite4.InitControl(244, 576, 120, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 115 | m_CtrlProjectSite5.InitControl(0, 0, 0, 0, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 116 | m_CtrlSecretVoice.SetHandCursor(); 117 | m_CtrlProjectSite1.SetHandCursor(); 118 | m_CtrlProjectSite2.SetHandCursor(); 119 | m_CtrlProjectSite3.SetHandCursor(); 120 | m_CtrlProjectSite4.SetHandCursor(); 121 | m_CtrlProjectSite5.SetHandCursor(); 122 | 123 | #elif MSI_MEI_SUPPORT 124 | m_CtrlProjectSite1.InitControl(24, 460, 348, 128, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 125 | m_CtrlProjectSite2.InitControl(168, 604, 36, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 126 | m_CtrlProjectSite3.InitControl(332, 604, 104, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 127 | m_CtrlProjectSite4.InitControl(20, 20, 120, 40, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 128 | m_CtrlProjectSite5.InitControl(464, 604, 168, 24, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 129 | m_CtrlLogo.InitControl(80, 64, 128, 128, m_ZoomRatio, m_hPal, &m_BkDC, IP(L"Logo"), 1, BS_CENTER, OwnerDrawImage, FALSE, FALSE, FALSE); 130 | m_CtrlProjectSite1.SetHandCursor(); 131 | m_CtrlProjectSite2.SetHandCursor(); 132 | m_CtrlProjectSite3.SetHandCursor(); 133 | m_CtrlProjectSite4.SetHandCursor(); 134 | m_CtrlProjectSite5.SetHandCursor(); 135 | 136 | #elif SUISHO_SHIZUKU_SUPPORT 137 | m_CtrlProjectSite1.InitControl(64, 372, 140, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 138 | m_CtrlProjectSite2.InitControl(64, 416, 148, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 139 | m_CtrlProjectSite3.InitControl(64, 432, 184, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 140 | m_CtrlProjectSite4.InitControl(40, 460, 208, 16, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 141 | m_CtrlProjectSite5.InitControl(92, 504, 432, 124, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 142 | m_CtrlLogo.InitControl(80, 12, 128, 128, m_ZoomRatio, m_hPal, &m_BkDC, IP(L"Logo"), 1, BS_CENTER, OwnerDrawImage, FALSE, FALSE, FALSE); 143 | m_CtrlProjectSite1.SetHandCursor(); 144 | m_CtrlProjectSite2.SetHandCursor(); 145 | m_CtrlProjectSite3.SetHandCursor(); 146 | m_CtrlProjectSite4.SetHandCursor(); 147 | m_CtrlProjectSite5.SetHandCursor(); 148 | #else 149 | m_CtrlLogo.InitControl(20, 20, 128, 128, m_ZoomRatio, m_hPal, &m_BkDC, IP(L"Logo"), 1, BS_CENTER, OwnerDrawImage, FALSE, FALSE, FALSE); 150 | m_CtrlProjectSite1.ShowWindow(SW_HIDE); 151 | m_CtrlProjectSite2.ShowWindow(SW_HIDE); 152 | m_CtrlProjectSite3.ShowWindow(SW_HIDE); 153 | m_CtrlProjectSite4.ShowWindow(SW_HIDE); 154 | m_CtrlProjectSite5.ShowWindow(SW_HIDE); 155 | #endif 156 | 157 | m_CtrlLogo.SetHandCursor(); 158 | 159 | #ifdef MSI_MEI_SUPPORT 160 | COLORREF fontColor = RGB(255, 255, 255); 161 | #else 162 | COLORREF fontColor = RGB(0, 0, 0); 163 | #endif 164 | 165 | m_CtrlVersion.SetFontEx(m_FontFace, 20, 20, m_ZoomRatio, m_FontRatio, fontColor, FW_BOLD, m_FontRender); 166 | m_CtrlEdition.SetFontEx(m_FontFace, 20, 20, m_ZoomRatio, m_FontRatio, fontColor, FW_BOLD, m_FontRender); 167 | m_CtrlRelease.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, fontColor, FW_NORMAL, m_FontRender); 168 | m_CtrlCopyright1.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, fontColor, FW_NORMAL, m_FontRender); 169 | m_CtrlCopyright2.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, fontColor, FW_NORMAL, m_FontRender); 170 | m_CtrlCopyright3.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, fontColor, FW_NORMAL, m_FontRender); 171 | m_CtrlLicense.SetFontEx(m_FontFace, 16, 16, m_ZoomRatio, m_FontRatio, fontColor, FW_NORMAL, m_FontRender); 172 | 173 | m_CtrlVersion.SetHandCursor(); 174 | m_CtrlLicense.SetHandCursor(); 175 | 176 | #ifdef SUISHO_AOI_SUPPORT 177 | m_CtrlVersion.InitControl(0, 152, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 178 | m_CtrlEdition.InitControl(0, 180, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 179 | m_CtrlRelease.InitControl(0, 216, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 180 | m_CtrlCopyright1.InitControl(0, 236, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 181 | m_CtrlCopyright2.InitControl(0, 256, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 182 | m_CtrlCopyright3.InitControl(0, 276, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 183 | m_CtrlLicense.InitControl(0, 296, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 184 | 185 | #elif MSI_MEI_SUPPORT 186 | m_CtrlVersion.InitControl(0, 204, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 187 | m_CtrlEdition.InitControl(0, 232, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 188 | m_CtrlRelease.InitControl(0, 268, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 189 | m_CtrlCopyright1.InitControl(0, 288, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 190 | m_CtrlCopyright2.InitControl(0, 308, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 191 | m_CtrlCopyright3.InitControl(0, 328, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 192 | m_CtrlLicense.InitControl(0, 0, 0, 0, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 193 | 194 | #elif SUISHO_SHIZUKU_SUPPORT 195 | m_CtrlVersion.InitControl(0, 152, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 196 | m_CtrlEdition.InitControl(0, 180, 288, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 197 | m_CtrlRelease.InitControl(0, 216, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 198 | m_CtrlCopyright1.InitControl(0, 236, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 199 | m_CtrlCopyright2.InitControl(0, 256, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 200 | m_CtrlCopyright3.InitControl(0, 276, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 201 | m_CtrlLicense.InitControl(0, 296, 288, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, FALSE, FALSE, FALSE); 202 | 203 | #else 204 | m_CtrlVersion.InitControl(160, 12, 364, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 205 | m_CtrlEdition.InitControl(160, 40, 364, 28, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 206 | m_CtrlRelease.InitControl(160, 76, 364, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 207 | m_CtrlCopyright1.InitControl(160, 96, 364, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 208 | m_CtrlCopyright2.InitControl(160, 116, 364, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 209 | m_CtrlCopyright3.InitControl(160, 136, 364, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, SS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 210 | m_CtrlLicense.InitControl(160, 136, 364, 20, m_ZoomRatio, m_hPal, &m_BkDC, NULL, 0, BS_CENTER, OwnerDrawTransparent, m_bHighContrast, m_bDarkMode, FALSE); 211 | m_CtrlCopyright3.ShowWindow(SW_HIDE); 212 | 213 | #endif 214 | 215 | Invalidate(); 216 | } 217 | 218 | void CAboutDlg::OnLogo() 219 | { 220 | if (GetUserDefaultLCID() == 0x0411)// Japanese 221 | { 222 | OpenUrl(URL_MAIN_JA); 223 | } 224 | else // Other Language 225 | { 226 | OpenUrl(URL_MAIN_EN); 227 | } 228 | } 229 | 230 | void CAboutDlg::OnVersion() 231 | { 232 | if (GetUserDefaultLCID() == 0x0411)// Japanese 233 | { 234 | OpenUrl(URL_VERSION_JA); 235 | } 236 | else // Other Language 237 | { 238 | OpenUrl(URL_VERSION_EN); 239 | } 240 | 241 | } 242 | void CAboutDlg::OnLicense() 243 | { 244 | if (GetUserDefaultLCID() == 0x0411)// Japanese 245 | { 246 | OpenUrl(URL_LICENSE_JA); 247 | } 248 | else // Other Language 249 | { 250 | OpenUrl(URL_LICENSE_EN); 251 | } 252 | } 253 | 254 | #ifdef SUISHO_SHIZUKU_SUPPORT 255 | void CAboutDlg::OnProjectSite1() 256 | { 257 | OpenUrl(URL_PROJECT_SITE_1); 258 | } 259 | 260 | void CAboutDlg::OnProjectSite2() 261 | { 262 | OpenUrl(URL_PROJECT_SITE_2); 263 | } 264 | 265 | void CAboutDlg::OnProjectSite3() 266 | { 267 | OpenUrl(URL_PROJECT_SITE_3); 268 | } 269 | 270 | void CAboutDlg::OnProjectSite4() 271 | { 272 | OpenUrl(URL_PROJECT_SITE_4); 273 | } 274 | 275 | void CAboutDlg::OnProjectSite5() 276 | { 277 | OpenUrl(URL_PROJECT_SITE_5); 278 | } 279 | #endif -------------------------------------------------------------------------------- /Priscilla/EditFx.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "EditFx.h" 10 | 11 | ////------------------------------------------------ 12 | // CEditFx 13 | ////------------------------------------------------ 14 | 15 | CEditFx::CEditFx() 16 | { 17 | // Control 18 | m_X = 0; 19 | m_Y = 0; 20 | m_bHighContrast = FALSE; 21 | m_bDarkMode = FALSE; 22 | m_bDrawFrame = FALSE; 23 | m_FrameColor = RGB(128, 128, 128); 24 | m_RenderMode = OwnerDrawImage; 25 | m_bMultiLine = FALSE; 26 | m_BkColor = RGB(255, 255, 255); 27 | 28 | // Glass 29 | m_GlassColor = RGB(255, 255, 255); 30 | m_GlassAlpha = 128; 31 | 32 | // Image 33 | m_ImageCount = 0; 34 | m_BkDC = NULL; 35 | m_bBkBitmapInit = FALSE; 36 | m_bBkLoad = FALSE; 37 | 38 | // Font 39 | m_TextAlign = SS_LEFT; 40 | m_TextColor = RGB(0, 0, 0); 41 | 42 | // Margin 43 | m_Margin.top = 0; 44 | m_Margin.left = 0; 45 | m_Margin.bottom = 0; 46 | m_Margin.right = 0; 47 | } 48 | 49 | CEditFx::~CEditFx() 50 | { 51 | } 52 | 53 | IMPLEMENT_DYNAMIC(CEditFx, CEdit) 54 | 55 | BEGIN_MESSAGE_MAP(CEditFx, CEdit) 56 | //{{AFX_MSG_MAP(CEditFx) 57 | ON_WM_CTLCOLOR_REFLECT() 58 | ON_CONTROL_REFLECT(EN_CHANGE, OnEnChange) 59 | ON_WM_KEYDOWN() 60 | //}}AFX_MSG_MAP 61 | END_MESSAGE_MAP() 62 | 63 | //------------------------------------------------ 64 | // Control 65 | //------------------------------------------------ 66 | 67 | BOOL CEditFx::InitControl(int x, int y, int width, int height, double zoomRatio, CDC* bkDC, 68 | LPCTSTR imagePath, int imageCount, DWORD textAlign, int renderMode, BOOL bHighContrast, BOOL bDarkMode, BOOL bDrawFrame, BOOL bMultiLine) 69 | { 70 | m_X = (int)(x * zoomRatio); 71 | m_Y = (int)(y * zoomRatio); 72 | m_CtrlSize.cx = (int)(width * zoomRatio); 73 | m_CtrlSize.cy = (int)(height * zoomRatio); 74 | MoveWindow(m_X, m_Y, m_CtrlSize.cx, m_CtrlSize.cy); 75 | m_bMultiLine = bMultiLine; 76 | 77 | m_BkDC = bkDC; 78 | m_ImagePath = imagePath; 79 | m_ImageCount = imageCount; 80 | m_RenderMode = renderMode; 81 | 82 | if (ES_LEFT <= textAlign && textAlign <= ES_RIGHT) 83 | { 84 | m_TextAlign = textAlign; 85 | ModifyStyle(0, m_TextAlign); 86 | } 87 | 88 | if (m_ToolTip.m_hWnd != NULL) 89 | { 90 | if (m_ToolTip.GetToolCount() != 0) 91 | { 92 | m_ToolTip.DelTool(this, 1); 93 | } 94 | CRect rect; 95 | GetClientRect(rect); 96 | m_ToolTip.AddTool(this, m_ToolTipText, rect, 1); 97 | } 98 | 99 | m_bHighContrast = bHighContrast; 100 | m_bDarkMode = bDarkMode; 101 | m_bDrawFrame = bDrawFrame; 102 | 103 | if (m_bHighContrast) 104 | { 105 | return TRUE; 106 | } 107 | else if (renderMode & SystemDraw) 108 | { 109 | return TRUE; 110 | } 111 | else 112 | { 113 | SetBkReload(); 114 | LoadCtrlBk(m_BkDC); 115 | } 116 | 117 | if (renderMode & OwnerDrawImage) 118 | { 119 | if (!LoadBitmap(imagePath)) 120 | { 121 | } 122 | } 123 | else 124 | { 125 | m_ImageCount = 1; 126 | m_CtrlImage.Destroy(); 127 | m_CtrlImage.Create(m_CtrlSize.cx, m_CtrlSize.cy * m_ImageCount, 32); 128 | m_CtrlBitmap.Detach(); 129 | m_CtrlBitmap.Attach((HBITMAP)m_CtrlImage); 130 | DWORD length = m_CtrlSize.cx * m_CtrlSize.cy * m_ImageCount * 4; 131 | BYTE* bitmapBits = new BYTE[length]; 132 | m_CtrlBitmap.GetBitmapBits(length, bitmapBits); 133 | 134 | BYTE r, g, b, a; 135 | if (renderMode & OwnerDrawGlass) 136 | { 137 | r = (BYTE)GetRValue(m_GlassColor); 138 | g = (BYTE)GetGValue(m_GlassColor); 139 | b = (BYTE)GetBValue(m_GlassColor); 140 | a = m_GlassAlpha; 141 | } 142 | else // OwnerDrawTransparent 143 | { 144 | r = 0; 145 | g = 0; 146 | b = 0; 147 | a = 0; 148 | } 149 | 150 | for (int y = 0; y < (int)(m_CtrlSize.cy * m_ImageCount); y++) 151 | { 152 | for (int x = 0; x < m_CtrlSize.cx; x++) 153 | { 154 | DWORD p = (y * m_CtrlSize.cx + x) * 4; 155 | #if _MSC_VER > 1310 156 | #pragma warning( disable : 6386 ) 157 | #endif 158 | bitmapBits[p + 0] = b; 159 | bitmapBits[p + 1] = g; 160 | bitmapBits[p + 2] = r; 161 | bitmapBits[p + 3] = a; 162 | #if _MSC_VER > 1310 163 | #pragma warning( default : 6386 ) 164 | #endif 165 | } 166 | } 167 | 168 | m_CtrlBitmap.SetBitmapBits(length, bitmapBits); 169 | delete[] bitmapBits; 170 | } 171 | 172 | SetupControlImage(m_BkBitmap, m_CtrlBitmap); 173 | 174 | m_BkBrush.DeleteObject(); 175 | m_BkBrush.CreatePatternBrush(&m_CtrlBitmap); 176 | 177 | Invalidate(); 178 | 179 | return TRUE; 180 | } 181 | 182 | void CEditFx::SetMargin(int top, int left, int bottom, int right, double zoomRatio) 183 | { 184 | m_Margin.top = (int)(top * zoomRatio); 185 | m_Margin.left = (int)(left * zoomRatio); 186 | m_Margin.bottom = (int)(bottom * zoomRatio); 187 | m_Margin.right = (int)(right * zoomRatio); 188 | 189 | if (GetWindowLongPtr(m_hWnd, GWL_STYLE) & ES_MULTILINE) 190 | { 191 | CRect rectGet, rectSet; 192 | GetRect(rectGet); 193 | 194 | rectSet.top = m_Margin.top; 195 | rectSet.bottom = rectGet.bottom - m_Margin.bottom - m_Margin.top; 196 | rectSet.left = m_Margin.left; 197 | rectSet.right = rectGet.right - m_Margin.right - m_Margin.left; 198 | 199 | SetRect(rectSet); 200 | } 201 | else 202 | { 203 | SetMargins(m_Margin.left, m_Margin.right); 204 | } 205 | } 206 | 207 | CSize CEditFx::GetSize(void) 208 | { 209 | return m_CtrlSize; 210 | } 211 | 212 | void CEditFx::SetDrawFrame(BOOL bDrawFrame) 213 | { 214 | #if _MSC_VER > 1310 215 | if (bDrawFrame) 216 | { 217 | ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_DRAWFRAME); 218 | } 219 | else 220 | { 221 | ModifyStyleEx(WS_EX_STATICEDGE, 0, SWP_DRAWFRAME); 222 | } 223 | #else 224 | if (bDrawFrame) 225 | { 226 | if (IsNT3()) 227 | { 228 | ModifyStyle(0, WS_BORDER, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); 229 | } 230 | else 231 | { 232 | ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_DRAWFRAME); 233 | } 234 | } 235 | else 236 | { 237 | if (IsNT3()) 238 | { 239 | ModifyStyle(WS_BORDER, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); 240 | } 241 | else 242 | { 243 | ModifyStyleEx(WS_EX_STATICEDGE, 0, SWP_DRAWFRAME); 244 | } 245 | } 246 | #endif 247 | m_bDrawFrame = bDrawFrame; 248 | } 249 | 250 | void CEditFx::SetGlassColor(COLORREF glassColor, BYTE glassAlpha) 251 | { 252 | m_GlassColor = glassColor; 253 | m_GlassAlpha = glassAlpha; 254 | } 255 | 256 | void CEditFx::SetBkColor(COLORREF bkColor) 257 | { 258 | m_BkColor = bkColor; 259 | } 260 | 261 | void CEditFx::Adjust() 262 | { 263 | CRect rectGet, rectSet; 264 | GetRect(rectGet); 265 | 266 | CClientDC dc(this); 267 | HGDIOBJ oldFont = dc.SelectObject(&m_Font); 268 | #ifdef UNICODE 269 | CSize size = dc.GetTextExtent(L"ÁAaPpQqYy8!"); 270 | #else 271 | CSize size = dc.GetTextExtent("AaPpQqYy8!"); 272 | #endif 273 | 274 | dc.SelectObject(oldFont); 275 | 276 | rectSet.top = (m_CtrlSize.cy - size.cy) / 2; 277 | rectSet.bottom = rectSet.top + size.cy; 278 | rectSet.left = rectGet.left; 279 | rectSet.right = rectGet.right; 280 | 281 | SetRect(rectSet); 282 | } 283 | 284 | HBRUSH CEditFx::CtlColor(CDC* pDC, UINT nCtlColor) 285 | { 286 | if (m_bHighContrast) 287 | { 288 | pDC->SetBkMode(TRANSPARENT); 289 | return NULL; 290 | } 291 | else 292 | { 293 | #ifdef UNICODE 294 | pDC->SetTextColor(m_TextColor); 295 | pDC->SetBkMode(TRANSPARENT); 296 | return m_BkBrush; 297 | #else 298 | pDC->SetTextColor(m_TextColor); 299 | pDC->SetBkColor(m_BkColor); 300 | pDC->SetBkMode(OPAQUE); 301 | 302 | return CreateSolidBrush(m_BkColor); 303 | #endif 304 | } 305 | } 306 | 307 | //------------------------------------------------ 308 | // Image 309 | //------------------------------------------------ 310 | 311 | BOOL CEditFx::LoadBitmap(LPCTSTR fileName) 312 | { 313 | if (m_bHighContrast) { return FALSE; } 314 | if (fileName == NULL) { return FALSE; } 315 | 316 | m_CtrlImage.Destroy(); 317 | m_CtrlImage.Load(fileName); 318 | if (m_CtrlImage.IsNull()) { return FALSE; } 319 | 320 | return LoadBitmap((HBITMAP)m_CtrlImage); 321 | } 322 | 323 | BOOL CEditFx::LoadBitmap(HBITMAP hBitmap) 324 | { 325 | if (m_bHighContrast) { return FALSE; } 326 | 327 | m_CtrlBitmap.Detach(); 328 | m_CtrlBitmap.Attach(hBitmap); 329 | 330 | return SetBitmap(m_CtrlBitmap); 331 | } 332 | 333 | void CEditFx::SetBkReload(void) 334 | { 335 | m_bBkBitmapInit = FALSE; 336 | m_bBkLoad = FALSE; 337 | } 338 | 339 | BOOL CEditFx::SetBitmap(CBitmap& bitmap) 340 | { 341 | if (m_bHighContrast) { return FALSE; } 342 | 343 | BITMAP bitmapInfo; 344 | bitmap.GetBitmap(&bitmapInfo); 345 | 346 | if (m_CtrlSize.cx != bitmapInfo.bmWidth 347 | || m_CtrlSize.cy != bitmapInfo.bmHeight / m_ImageCount) 348 | { 349 | return FALSE; 350 | } 351 | else 352 | { 353 | return TRUE; 354 | } 355 | } 356 | 357 | void CEditFx::LoadCtrlBk(CDC* drawDC) 358 | { 359 | if (m_bHighContrast) { SetBkReload(); return; } 360 | 361 | if (m_BkBitmap.m_hObject != NULL) 362 | { 363 | BITMAP bitmapInfo; 364 | m_BkBitmap.GetBitmap(&bitmapInfo); 365 | if (bitmapInfo.bmBitsPixel != drawDC->GetDeviceCaps(BITSPIXEL)) 366 | { 367 | SetBkReload(); 368 | } 369 | } 370 | 371 | if (&m_CtrlBitmap != NULL) 372 | { 373 | if (!m_bBkBitmapInit) 374 | { 375 | m_BkBitmap.DeleteObject(); 376 | m_BkBitmap.CreateCompatibleBitmap(drawDC, m_CtrlSize.cx, m_CtrlSize.cy); 377 | m_bBkBitmapInit = TRUE; 378 | } 379 | 380 | if (!m_bBkLoad) 381 | { 382 | CBitmap* pOldBitmap; 383 | CDC* pMemDC = new CDC; 384 | pMemDC->CreateCompatibleDC(drawDC); 385 | pOldBitmap = pMemDC->SelectObject(&m_BkBitmap); 386 | pMemDC->BitBlt(0, 0, m_CtrlSize.cx, m_CtrlSize.cy, m_BkDC, m_X, m_Y, SRCCOPY); 387 | pMemDC->SelectObject(pOldBitmap); 388 | pMemDC->DeleteDC(); 389 | delete pMemDC; 390 | m_bBkLoad = TRUE; 391 | } 392 | } 393 | } 394 | 395 | void CEditFx::SetupControlImage(CBitmap& bkBitmap, CBitmap& ctrlBitmap) 396 | { 397 | int color = m_BkDC->GetDeviceCaps(BITSPIXEL) * m_BkDC->GetDeviceCaps(PLANES); 398 | 399 | if (!m_CtrlImage.IsNull()) 400 | { 401 | if (m_CtrlImage.GetBPP() == 32) 402 | { 403 | CBitmap* bk32Bitmap; 404 | CImage bk32Image; 405 | if (color == 32) 406 | { 407 | bk32Bitmap = &bkBitmap; 408 | } 409 | else 410 | { 411 | bk32Image.Create(m_CtrlSize.cx, m_CtrlSize.cy, 32); 412 | ::BitBlt(bk32Image.GetDC(), 0, 0, m_CtrlSize.cx, m_CtrlSize.cy, *m_BkDC, m_X, m_Y, SRCCOPY); 413 | bk32Bitmap = CBitmap::FromHandle((HBITMAP)bk32Image); 414 | bk32Image.ReleaseDC(); 415 | } 416 | 417 | BITMAP CtlBmpInfo, DstBmpInfo; 418 | bk32Bitmap->GetBitmap(&DstBmpInfo); 419 | DWORD DstLineBytes = DstBmpInfo.bmWidthBytes; 420 | DWORD DstMemSize = DstLineBytes * DstBmpInfo.bmHeight; 421 | ctrlBitmap.GetBitmap(&CtlBmpInfo); 422 | DWORD CtlLineBytes = CtlBmpInfo.bmWidthBytes; 423 | DWORD CtlMemSize = CtlLineBytes * CtlBmpInfo.bmHeight; 424 | 425 | if ((DstBmpInfo.bmWidthBytes != CtlBmpInfo.bmWidthBytes) 426 | || (DstBmpInfo.bmHeight != CtlBmpInfo.bmHeight / m_ImageCount)) 427 | { 428 | // Error Check // 429 | } 430 | else 431 | { 432 | BYTE* DstBuffer = new BYTE[DstMemSize]; 433 | bk32Bitmap->GetBitmapBits(DstMemSize, DstBuffer); 434 | BYTE* CtlBuffer = new BYTE[CtlMemSize]; 435 | ctrlBitmap.GetBitmapBits(CtlMemSize, CtlBuffer); 436 | 437 | int baseY = 0; 438 | for (LONG py = 0; py < DstBmpInfo.bmHeight; py++) 439 | { 440 | int dn = py * DstLineBytes; 441 | int cn = (baseY + py) * CtlLineBytes; 442 | for (LONG px = 0; px < DstBmpInfo.bmWidth; px++) 443 | { 444 | #if _MSC_VER > 1310 445 | #pragma warning( disable : 6385 ) 446 | #pragma warning( disable : 6386 ) 447 | #endif 448 | BYTE a = CtlBuffer[cn + 3]; 449 | BYTE na = 255 - a; 450 | CtlBuffer[dn + 0] = (BYTE)((CtlBuffer[cn + 0] * a + DstBuffer[dn + 0] * na) / 255); 451 | CtlBuffer[dn + 1] = (BYTE)((CtlBuffer[cn + 1] * a + DstBuffer[dn + 1] * na) / 255); 452 | CtlBuffer[dn + 2] = (BYTE)((CtlBuffer[cn + 2] * a + DstBuffer[dn + 2] * na) / 255); 453 | dn += (DstBmpInfo.bmBitsPixel / 8); 454 | cn += (CtlBmpInfo.bmBitsPixel / 8); 455 | #if _MSC_VER > 1310 456 | #pragma warning( default : 6386 ) 457 | #pragma warning( default : 6385 ) 458 | #endif 459 | } 460 | } 461 | 462 | if (color == 32) 463 | { 464 | ctrlBitmap.SetBitmapBits(CtlMemSize, CtlBuffer); 465 | } 466 | else 467 | { 468 | bk32Bitmap->SetBitmapBits(CtlMemSize, CtlBuffer); 469 | m_CtrlImage.Detach(); 470 | m_CtrlImage.Attach(ctrlBitmap); 471 | ::BitBlt(m_CtrlImage.GetDC(), 0, 0, m_CtrlSize.cx, m_CtrlSize.cy, bk32Image.GetDC(), 0, 0, SRCCOPY); 472 | m_CtrlImage.ReleaseDC(); 473 | bk32Image.ReleaseDC(); 474 | 475 | ctrlBitmap.SetBitmapBits(CtlMemSize, CtlBuffer); 476 | } 477 | 478 | if (m_bDrawFrame) 479 | { 480 | HGDIOBJ oldPen; 481 | POINT point; 482 | CPen pen1; pen1.CreatePen(PS_SOLID, 1, RGB(0xF8, 0xF8, 0xF8)); 483 | CPen pen2; pen2.CreatePen(PS_SOLID, 1, RGB(0x98, 0x98, 0x98)); 484 | 485 | HDC hDC = m_CtrlImage.GetDC(); 486 | 487 | oldPen = SelectObject(hDC, pen1); 488 | MoveToEx(hDC, 0, m_CtrlSize.cy - 1, &point); 489 | LineTo(hDC, m_CtrlSize.cx - 1, m_CtrlSize.cy - 1); 490 | LineTo(hDC, m_CtrlSize.cx - 1, 0); 491 | LineTo(hDC, m_CtrlSize.cx - 1, m_CtrlSize.cy - 1); 492 | SelectObject(hDC, pen2); 493 | MoveToEx(hDC, 0, m_CtrlSize.cy - 2, &point); 494 | LineTo(hDC, 0, 0); 495 | LineTo(hDC, m_CtrlSize.cx - 1, 0); 496 | SelectObject(hDC, oldPen); 497 | 498 | pen1.DeleteObject(); 499 | pen2.DeleteObject(); 500 | m_CtrlImage.ReleaseDC(); 501 | } 502 | 503 | delete[] DstBuffer; 504 | delete[] CtlBuffer; 505 | } 506 | } 507 | } 508 | } 509 | 510 | //------------------------------------------------ 511 | // Font 512 | //------------------------------------------------ 513 | 514 | void CEditFx::SetFontEx(CString face, int size, int sizeToolTip, double zoomRatio, double fontRatio, 515 | COLORREF textColor, LONG fontWeight, BYTE fontRender) 516 | { 517 | LOGFONT logFont = { 0 }; 518 | logFont.lfCharSet = DEFAULT_CHARSET; 519 | logFont.lfHeight = (LONG)(-1 * size * zoomRatio * fontRatio); 520 | logFont.lfQuality = fontRender; 521 | logFont.lfWeight = fontWeight; 522 | if (face.GetLength() < 32) 523 | { 524 | wsprintf(logFont.lfFaceName, _T("%s"), (LPCTSTR)face); 525 | } 526 | else 527 | { 528 | wsprintf(logFont.lfFaceName, _T("")); 529 | } 530 | 531 | m_Font.DeleteObject(); 532 | m_Font.CreateFontIndirect(&logFont); 533 | SetFont(&m_Font); 534 | 535 | logFont.lfHeight = (LONG)(-1 * sizeToolTip * zoomRatio); 536 | m_FontToolTip.DeleteObject(); 537 | m_FontToolTip.CreateFontIndirect(&logFont); 538 | 539 | m_TextColor = textColor; 540 | 541 | if (m_ToolTip.m_hWnd != NULL) 542 | { 543 | m_ToolTip.SetFont(&m_FontToolTip); 544 | } 545 | } 546 | 547 | //------------------------------------------------ 548 | // Message Map 549 | //------------------------------------------------ 550 | 551 | void CEditFx::OnEnChange() 552 | { 553 | Invalidate(); 554 | } 555 | 556 | void CEditFx::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 557 | { 558 | if (nChar == VK_RETURN && m_bMultiLine == FALSE) 559 | { 560 | return ; 561 | } 562 | else 563 | { 564 | CEdit::OnKeyDown(nChar, nRepCnt, nFlags); 565 | } 566 | } 567 | 568 | //------------------------------------------------ 569 | // ToolTip 570 | //------------------------------------------------ 571 | 572 | void CEditFx::SetToolTipText(LPCTSTR text) 573 | { 574 | if (text == NULL) { return; } 575 | 576 | InitToolTip(); 577 | m_ToolTipText = text; 578 | if (m_ToolTip.GetToolCount() == 0) 579 | { 580 | CRect rect; 581 | GetClientRect(rect); 582 | m_ToolTip.AddTool(this, m_ToolTipText, rect, 1); 583 | } 584 | else 585 | { 586 | m_ToolTip.UpdateTipText(m_ToolTipText, this, 1); 587 | } 588 | 589 | SetToolTipActivate(TRUE); 590 | } 591 | 592 | void CEditFx::SetToolTipActivate(BOOL bActivate) 593 | { 594 | if (m_ToolTip.GetToolCount() == 0) { return; } 595 | m_ToolTip.Activate(bActivate); 596 | } 597 | 598 | void CEditFx::SetToolTipWindowText(LPCTSTR text) 599 | { 600 | SetToolTipText(text); 601 | SetWindowText(text); 602 | } 603 | 604 | CString CEditFx::GetToolTipText() 605 | { 606 | return m_ToolTipText; 607 | } 608 | 609 | void CEditFx::InitToolTip() 610 | { 611 | if (m_ToolTip.m_hWnd == NULL) 612 | { 613 | m_ToolTip.Create(this, TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOANIMATE | TTS_NOFADE); 614 | m_ToolTip.Activate(FALSE); 615 | m_ToolTip.SetFont(&m_FontToolTip); 616 | m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, 1024); 617 | m_ToolTip.SetDelayTime(TTDT_AUTOPOP, 8000); 618 | m_ToolTip.SetDelayTime(TTDT_INITIAL, 500); 619 | m_ToolTip.SetDelayTime(TTDT_RESHOW, 100); 620 | } 621 | } 622 | 623 | BOOL CEditFx::PreTranslateMessage(MSG* pMsg) 624 | { 625 | InitToolTip(); 626 | m_ToolTip.RelayEvent(pMsg); 627 | 628 | return CEdit::PreTranslateMessage(pMsg); 629 | } -------------------------------------------------------------------------------- /Priscilla/DialogFx.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : https://crystalmark.info/ 5 | // License : MIT License 6 | /*---------------------------------------------------------------------------*/ 7 | 8 | #include "stdafx.h" 9 | #include "Resource.h" 10 | #include "DialogFx.h" 11 | #include "UtilityFx.h" 12 | #include "OsInfoFx.h" 13 | 14 | //#include 15 | #if _MSC_VER > 1310 16 | #include 17 | #endif 18 | 19 | using namespace Gdiplus; 20 | #pragma comment(lib,"Gdiplus.lib") 21 | 22 | // defined by Windows 8.1/Windows 2012 R2 23 | #ifndef WM_DPICHANGED 24 | #define WM_DPICHANGED 0x02E0 25 | #endif 26 | 27 | ////------------------------------------------------ 28 | // CDialogFx 29 | ////------------------------------------------------ 30 | 31 | CDialogFx::CDialogFx(UINT dlgResouce, CWnd* pParent) 32 | :CDialog(dlgResouce, pParent) 33 | { 34 | // Dialog 35 | m_bInitializing = TRUE; 36 | m_bDpiChanging = FALSE; 37 | m_bShowWindow = FALSE; 38 | m_bModelessDlg = FALSE; 39 | m_bHighContrast = FALSE; 40 | m_bDarkMode = FALSE; 41 | m_bDisableDarkMode = FALSE; 42 | m_bBkImage = FALSE; 43 | m_MenuId = 0; 44 | m_ParentWnd = NULL; 45 | m_DlgWnd = NULL; 46 | m_hAccelerator = NULL; 47 | m_bDrag = FALSE; 48 | m_FontScale = 100; 49 | m_FontRatio = 1.0; 50 | m_FontRender = CLEARTYPE_NATURAL_QUALITY; 51 | m_hPal = NULL; 52 | 53 | m_SizeX = 0; 54 | m_MaxSizeX = 65535; 55 | m_MinSizeX = 0; 56 | m_SizeY = 0; 57 | m_MaxSizeY = 65535; 58 | m_MinSizeY = 0; 59 | 60 | // Zoom 61 | m_Dpi = 96; 62 | m_ZoomRatio = 1.0; 63 | m_ZoomType = ZoomTypeAuto; 64 | 65 | // Color for SubClass 66 | m_LabelText = 0x00000000; 67 | m_MeterText = 0x00000000; 68 | m_ComboText = 0x00000000; 69 | m_ComboTextSelected = 0x00808080; 70 | m_ComboBk = 0x00FFFFFF; 71 | m_ComboBkSelected = 0x00808080; 72 | m_ButtonText = 0x00000000; 73 | m_EditText = 0x00000000; 74 | m_EditBk = 0x00FFFFFF; 75 | m_ListText1 = 0x00000000; 76 | m_ListText2 = 0x00000000; 77 | m_ListTextSelected = 0x00000000; 78 | m_ListBk1 = 0x00FFFFFF; 79 | m_ListBk2 = 0x00FFFFFF; 80 | m_ListBkSelected = 0x00808080; 81 | m_ListLine1 = 0x00000000; 82 | m_ListLine2 = 0x00000000; 83 | m_Glass = 0x00808080; 84 | m_Frame = 0x00808080; 85 | m_Background = 0xFFFFFFFF; // Disabled 86 | 87 | m_ComboAlpha = 0; 88 | m_EditAlpha = 0; 89 | m_GlassAlpha = 0; 90 | 91 | m_CharacterPosition = 0; 92 | 93 | // Theme for SubClass 94 | m_OffsetX = 0; 95 | 96 | // Voice for SubClass 97 | m_VoiceVolume = 0; 98 | } 99 | 100 | CDialogFx::~CDialogFx() 101 | { 102 | if(m_hPal) DeleteObject(m_hPal); 103 | } 104 | 105 | BEGIN_MESSAGE_MAP(CDialogFx, CDialog) 106 | ON_WM_SIZE() 107 | ON_WM_TIMER() 108 | ON_WM_ERASEBKGND() 109 | ON_MESSAGE(WM_DPICHANGED, &CDialogFx::OnDpiChanged) 110 | ON_MESSAGE(WM_DISPLAYCHANGE, &CDialogFx::OnDisplayChange) 111 | ON_MESSAGE(WM_SYSCOLORCHANGE, &CDialogFx::OnSysColorChange) 112 | ON_MESSAGE(WM_SETTINGCHANGE, &CDialogFx::OnSettingChange) 113 | ON_MESSAGE(WM_ENTERSIZEMOVE, &CDialogFx::OnEnterSizeMove) 114 | ON_MESSAGE(WM_EXITSIZEMOVE, &CDialogFx::OnExitSizeMove) 115 | END_MESSAGE_MAP() 116 | 117 | //------------------------------------------------ 118 | // Dialog 119 | //------------------------------------------------ 120 | 121 | BOOL CDialogFx::Create(UINT nIDTemplate, CWnd* pDlgWnd, UINT menuId, CWnd* pParentWnd) 122 | { 123 | m_bModelessDlg = TRUE; 124 | m_ParentWnd = pParentWnd; 125 | m_DlgWnd = pDlgWnd; 126 | m_MenuId = menuId; 127 | 128 | if (m_MenuId != 0 && m_ParentWnd != NULL) 129 | { 130 | CMenu* menu = m_ParentWnd->GetMenu(); 131 | menu->EnableMenuItem(m_MenuId, MF_GRAYED); 132 | m_ParentWnd->SetMenu(menu); 133 | m_ParentWnd->DrawMenuBar(); 134 | } 135 | 136 | return CDialog::Create(nIDTemplate, pParentWnd); 137 | } 138 | 139 | int CDialogFx::GetDpi() 140 | { 141 | INT dpi = 96; 142 | CDC* pDC = GetDC(); 143 | dpi = GetDeviceCaps(pDC->m_hDC, LOGPIXELSY); 144 | ReleaseDC(pDC); 145 | 146 | HMODULE hModule = GetModuleHandle(_T("Shcore.dll")); 147 | if (hModule) 148 | { 149 | typedef HRESULT(WINAPI* FuncGetDpiForMonitor) (HMONITOR hmonitor, UINT dpiType, UINT* dpiX, UINT* dpiY); 150 | typedef HMONITOR(WINAPI* FuncMonitorFromWindow) (HWND hwnd, DWORD dwFlags); 151 | 152 | FuncGetDpiForMonitor pGetDpiForMonitor = (FuncGetDpiForMonitor)GetProcAddress(hModule, "GetDpiForMonitor"); 153 | FuncMonitorFromWindow pMonitorFromWindow = (FuncMonitorFromWindow)GetProcAddress(hModule, "MonitorFromWindow"); 154 | 155 | if (pGetDpiForMonitor && pMonitorFromWindow) 156 | { 157 | UINT dpiX, dpiY; 158 | pGetDpiForMonitor(pMonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), 0, &dpiX, &dpiY); 159 | dpi = dpiY; 160 | } 161 | } 162 | 163 | return dpi; 164 | } 165 | 166 | BOOL CDialogFx::OnInitDialog() 167 | { 168 | CDialog::OnInitDialog(); 169 | 170 | m_bHighContrast = IsHighContrast(); 171 | m_Dpi = GetDpi(); 172 | m_hAccelerator = ::LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR)); 173 | 174 | // m_bInitializing = FALSE; 175 | 176 | return TRUE; 177 | } 178 | 179 | void CDialogFx::OnSize(UINT nType, int cx, int cy) 180 | { 181 | CDialog::OnSize(nType, cx, cy); 182 | 183 | if (nType == SIZE_RESTORED) 184 | { 185 | UpdateBackground(TRUE, FALSE); 186 | Invalidate(); 187 | } 188 | } 189 | 190 | BOOL CDialogFx::PreTranslateMessage(MSG* pMsg) 191 | { 192 | if(m_hAccelerator != NULL) 193 | { 194 | if(::TranslateAccelerator(m_hWnd, m_hAccelerator, pMsg) != 0) 195 | { 196 | return TRUE; 197 | } 198 | } 199 | 200 | return CDialog::PreTranslateMessage(pMsg); 201 | } 202 | 203 | void CDialogFx::PostNcDestroy() 204 | { 205 | if (m_bModelessDlg) 206 | { 207 | m_DlgWnd = NULL; 208 | delete this; 209 | } 210 | else 211 | { 212 | CDialog::PostNcDestroy(); 213 | } 214 | } 215 | 216 | void CDialogFx::UpdateDialogSize() 217 | { 218 | #if _MSC_VER > 1310 219 | if (! m_bDisableDarkMode) 220 | { 221 | m_bDarkMode = SetDarkMode(m_hWnd); 222 | } 223 | else 224 | { 225 | UnsetDarkMode(m_hWnd); 226 | m_bDarkMode = FALSE; 227 | } 228 | #endif 229 | } 230 | 231 | void CDialogFx::SetClientSize(int sizeX, int sizeY, double zoomRatio) 232 | { 233 | RECT rw, rc; 234 | GetWindowRect(&rw); 235 | GetClientRect(&rc); 236 | 237 | if (rc.right != 0) 238 | { 239 | int ncaWidth = (rw.right - rw.left) - (rc.right - rc.left); 240 | int ncaHeight = (rw.bottom - rw.top) - (rc.bottom - rc.top); 241 | 242 | SetWindowPos(NULL, 0, 0, (int)(sizeX * zoomRatio) + ncaWidth, (int)(sizeY * zoomRatio) + ncaHeight, SWP_NOMOVE | SWP_NOZORDER); 243 | 244 | GetWindowRect(&rw); 245 | GetClientRect(&rc); 246 | 247 | int ncaHeightMenu = (rw.bottom - rw.top) - (rc.bottom - rc.top); 248 | 249 | if (ncaHeight != ncaHeightMenu) 250 | { 251 | SetWindowPos(NULL, 0, 0, (int)(sizeX * zoomRatio) + ncaWidth, (int)(sizeY * zoomRatio) + ncaHeightMenu, SWP_NOMOVE | SWP_NOZORDER); 252 | } 253 | } 254 | } 255 | 256 | void CDialogFx::UpdateBackground(BOOL resize, BOOL bDarkMode) 257 | { 258 | HRESULT hr; 259 | CImage srcBitmap; 260 | double ratio = m_ZoomRatio; 261 | m_bBkImage = FALSE; 262 | 263 | #if _MSC_VER > 1310 264 | if (resize) { m_ZoomRatio = 3.0; } 265 | hr = srcBitmap.Load(IP(m_BackgroundName)); 266 | if (resize) { m_ZoomRatio = ratio; } 267 | #else 268 | if (resize) { m_ZoomRatio = 1.0; } 269 | hr = srcBitmap.Load(IP(m_BackgroundName)); 270 | if (resize) { m_ZoomRatio = ratio; } 271 | #endif 272 | 273 | HDC hScreenDC = ::GetDC(NULL); // get desktop DC 274 | if(!m_hPal && GetDeviceCaps(hScreenDC, RASTERCAPS) & RC_PALETTE) 275 | { 276 | m_hPal = CreateHalftonePalette(hScreenDC); 277 | } 278 | DeleteDC(hScreenDC); // delete it after use 279 | 280 | if (SUCCEEDED(hr)) 281 | { 282 | m_bBkImage = TRUE; 283 | CBitmap baseBitmap; 284 | CDC baseDC; 285 | CDC* pWndDC = GetDC(); 286 | 287 | #if _MSC_VER > 1310 288 | int w = (int)(m_ZoomRatio / 3.0 * srcBitmap.GetWidth()); 289 | int h = (int)(m_ZoomRatio / 3.0 * srcBitmap.GetHeight()); 290 | #else 291 | int w = (int)(m_ZoomRatio * srcBitmap.GetWidth()); 292 | int h = (int)(m_ZoomRatio * srcBitmap.GetHeight()); 293 | #endif 294 | int orgw = srcBitmap.GetWidth(); 295 | int orgh = srcBitmap.GetHeight(); 296 | if(m_hPal && pWndDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE) 297 | { 298 | SelectPalette( pWndDC->GetSafeHdc(), m_hPal, TRUE ); 299 | pWndDC->RealizePalette(); 300 | pWndDC->SetStretchBltMode(HALFTONE); 301 | } 302 | baseBitmap.CreateCompatibleBitmap(pWndDC, orgw, orgh); 303 | baseDC.CreateCompatibleDC(pWndDC); 304 | if(m_hPal && baseDC.GetDeviceCaps(RASTERCAPS) & RC_PALETTE) 305 | { 306 | SelectPalette( baseDC.GetSafeHdc(), m_hPal, FALSE ); 307 | baseDC.RealizePalette(); 308 | baseDC.SetStretchBltMode(HALFTONE); 309 | } 310 | 311 | m_BkBitmap.DeleteObject(); 312 | m_BkDC.DeleteDC(); 313 | m_BkBitmap.CreateCompatibleBitmap(pWndDC, w, h); 314 | m_BkDC.CreateCompatibleDC(pWndDC); 315 | if(m_hPal && baseDC.GetDeviceCaps(RASTERCAPS) & RC_PALETTE) 316 | { 317 | SelectPalette( m_BkDC.GetSafeHdc(), m_hPal, FALSE ); 318 | m_BkDC.RealizePalette(); 319 | m_BkDC.SetStretchBltMode(HALFTONE); 320 | } 321 | 322 | ReleaseDC(pWndDC); 323 | 324 | baseDC.SelectObject(&baseBitmap); 325 | m_BkDC.SelectObject(&m_BkBitmap); 326 | 327 | srcBitmap.BitBlt(baseDC.GetSafeHdc(), 0, 0, SRCCOPY); 328 | srcBitmap.Destroy(); 329 | 330 | if(m_hPal || (LOBYTE(LOWORD(GetVersion()))) == 3) 331 | { 332 | m_BkDC.StretchBlt(0, 0, w, h, &baseDC, 0, 0, orgw, orgh, SRCCOPY); 333 | } 334 | else 335 | { 336 | Bitmap* pBitmap = Bitmap::FromHBITMAP((HBITMAP)baseBitmap.GetSafeHandle(), NULL); 337 | Graphics g(m_BkDC.GetSafeHdc()); 338 | g.SetInterpolationMode(InterpolationModeHighQualityBicubic); 339 | g.DrawImage(pBitmap, 0, 0, w, h); 340 | 341 | delete pBitmap; 342 | } 343 | 344 | baseBitmap.DeleteObject(); 345 | baseDC.DeleteDC(); 346 | 347 | m_BrushDlg.DeleteObject(); 348 | m_BrushDlg.CreatePatternBrush(&m_BkBitmap); 349 | 350 | return; 351 | } 352 | else if (m_bHighContrast) 353 | { 354 | m_BrushDlg.DeleteObject(); 355 | m_BrushDlg.CreateSolidBrush(RGB(0, 0, 0)); 356 | } 357 | else 358 | { 359 | CBitmap baseBitmap; 360 | CDC baseDC; 361 | CDC* pWndDC = GetDC(); 362 | 363 | CRect rect; 364 | GetClientRect(&rect); 365 | int w = rect.Width(); 366 | int h = rect.Height(); 367 | 368 | m_BkBitmap.DeleteObject(); 369 | m_BkBitmap.CreateCompatibleBitmap(pWndDC, w, h); 370 | m_BkDC.DeleteDC(); 371 | m_BkDC.CreateCompatibleDC(pWndDC); 372 | m_BkDC.SelectObject(&m_BkBitmap); 373 | 374 | m_BrushDlg.DeleteObject(); 375 | COLORREF bkColor; 376 | 377 | if (m_Background != 0xFFFFFFFF) 378 | { 379 | bkColor = m_Background; 380 | } 381 | else if (bDarkMode) 382 | { 383 | bkColor = RGB(32, 32, 32); 384 | } 385 | else 386 | { 387 | bkColor = RGB(255, 255, 255); 388 | } 389 | m_BrushDlg.CreateSolidBrush(bkColor); 390 | 391 | m_BkDC.FillRect(&rect, &m_BrushDlg); 392 | 393 | ReleaseDC(pWndDC); 394 | } 395 | } 396 | 397 | void CDialogFx::SetWindowTitle(CString title) 398 | { 399 | SetWindowText(_T(" ") + title + _T(" ")); 400 | } 401 | 402 | void CDialogFx::OnOK() 403 | { 404 | } 405 | 406 | void CDialogFx::OnCancel() 407 | { 408 | if (m_bModelessDlg) 409 | { 410 | if (m_MenuId != 0 && m_ParentWnd != NULL) 411 | { 412 | CMenu* menu = m_ParentWnd->GetMenu(); 413 | menu->EnableMenuItem(m_MenuId, MF_ENABLED); 414 | m_ParentWnd->SetMenu(menu); 415 | m_ParentWnd->DrawMenuBar(); 416 | } 417 | CDialog::DestroyWindow(); 418 | } 419 | else 420 | { 421 | CDialog::OnCancel(); 422 | } 423 | } 424 | 425 | //------------------------------------------------ 426 | // Font 427 | //------------------------------------------------ 428 | 429 | int CDialogFx::GetFontScale() 430 | { 431 | return m_FontScale; 432 | } 433 | 434 | BYTE CDialogFx::GetFontRender() 435 | { 436 | return m_FontRender; 437 | } 438 | 439 | double CDialogFx::GetFontRatio() 440 | { 441 | return m_FontRatio; 442 | } 443 | 444 | CString CDialogFx::GetFontFace() 445 | { 446 | return m_FontFace; 447 | } 448 | 449 | //------------------------------------------------ 450 | // Zoom 451 | //------------------------------------------------ 452 | 453 | DWORD CDialogFx::ChangeZoomType(DWORD zoomType) 454 | { 455 | DWORD current = (DWORD)ceil(m_Dpi / 96.0 * 100); 456 | int width = GetSystemMetrics(SM_CXSCREEN); 457 | 458 | if(zoomType == ZoomTypeAuto) 459 | { 460 | #if _MSC_VER > 1310 461 | if (current >= 300) 462 | { 463 | zoomType = ZoomType300; 464 | } 465 | else if (current >= 250) 466 | { 467 | zoomType = ZoomType250; 468 | } 469 | else 470 | #endif 471 | if(current >= 200) 472 | { 473 | zoomType = ZoomType200; 474 | } 475 | else if(current >= 150) 476 | { 477 | zoomType = ZoomType150; 478 | } 479 | else if(current >= 125) 480 | { 481 | zoomType = ZoomType125; 482 | } 483 | #ifdef CRYSTALMARK_RETRO 484 | #ifdef SUISHO_SHIZUKU_SUPPORT 485 | else if (width < 900) { zoomType = ZoomType050; } 486 | else if (width < 1200){ zoomType = ZoomType075; } 487 | #else 488 | // else if (width < 732) { zoomType = ZoomType050; } 489 | else if (width < 732) { zoomType = ZoomType064; } 490 | else if (width < 976) { zoomType = ZoomType075; } 491 | #endif 492 | #endif 493 | else 494 | { 495 | zoomType = ZoomType100; 496 | } 497 | } 498 | 499 | m_ZoomRatio = zoomType / 100.0; 500 | 501 | return zoomType; 502 | } 503 | 504 | //------------------------------------------------ 505 | // Theme 506 | //------------------------------------------------ 507 | 508 | BOOL CDialogFx::IsHighContrast() 509 | { 510 | HIGHCONTRAST hc = { sizeof(HIGHCONTRAST) }; 511 | SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &hc, 0); 512 | 513 | return hc.dwFlags & HCF_HIGHCONTRASTON; 514 | } 515 | 516 | BOOL CDialogFx::IsDisableDarkMode() 517 | { 518 | return m_bDisableDarkMode; 519 | } 520 | 521 | //------------------------------------------------ 522 | // Utility 523 | //------------------------------------------------ 524 | 525 | CString CDialogFx::IP(CString imageName) /// ImagePath 526 | { 527 | CString imagePath; 528 | imagePath.Format(_T("%s%s\\%s-%03d.png"), (LPCTSTR)m_ThemeDir, (LPCTSTR)m_CurrentTheme, (LPCTSTR)imageName, (DWORD)(m_ZoomRatio * 100)); 529 | if (IsFileExist(imagePath)) 530 | { 531 | return imagePath; 532 | } 533 | imagePath.Format(_T("%s%s\\%s-%03d.png"), (LPCTSTR)m_ThemeDir, (LPCTSTR)m_ParentTheme1, (LPCTSTR)imageName, (DWORD)(m_ZoomRatio * 100)); 534 | if (IsFileExist(imagePath)) 535 | { 536 | return imagePath; 537 | } 538 | imagePath.Format(_T("%s%s\\%s-%03d.png"), (LPCTSTR)m_ThemeDir, (LPCTSTR)m_ParentTheme2, (LPCTSTR)imageName, (DWORD)(m_ZoomRatio * 100)); 539 | if (IsFileExist(imagePath)) 540 | { 541 | return imagePath; 542 | } 543 | imagePath.Format(_T("%s%s\\%s-%03d.png"), (LPCTSTR)m_ThemeDir, (LPCTSTR)m_DefaultTheme, (LPCTSTR)imageName, (DWORD)(m_ZoomRatio * 100)); 544 | if (IsFileExist(imagePath)) 545 | { 546 | return imagePath; 547 | } 548 | 549 | return _T(""); 550 | } 551 | 552 | CString CDialogFx::i18n(CString section, CString key, BOOL inEnglish) 553 | { 554 | TCHAR str[256]; 555 | CString cstr; 556 | 557 | if(inEnglish) 558 | { 559 | GetPrivateProfileStringFx(section, key, _T(""), str, 256, m_DefaultLangPath); 560 | cstr = str; 561 | } 562 | else 563 | { 564 | GetPrivateProfileStringFx(section, key, _T(""), str, 256, m_CurrentLangPath); 565 | cstr = str; 566 | if(cstr.IsEmpty()) 567 | { 568 | GetPrivateProfileStringFx(section, key, _T(""), str, 256, m_DefaultLangPath); 569 | cstr = str; 570 | } 571 | } 572 | 573 | return cstr; 574 | } 575 | 576 | void CDialogFx::OpenUrl(CString url) 577 | { 578 | INT_PTR result = 0; 579 | result = (INT_PTR)(ShellExecute(NULL, _T("open"), (LPCTSTR)url, NULL, NULL, SW_SHOWNORMAL)); 580 | if(result <= 32) 581 | { 582 | CString args; 583 | args.Format(_T("url.dll,FileProtocolHandler %s"), (LPCTSTR)url); 584 | ShellExecute(NULL, _T("open"), _T("rundll32.exe"), args, NULL, SW_SHOWNORMAL); 585 | } 586 | } 587 | 588 | void CDialogFx::SetLayeredWindow(HWND hWnd, BYTE alpha) 589 | { 590 | #if _MSC_VER > 1310 591 | if (IsWin2k()) { return; } 592 | 593 | ::SetWindowLong(hWnd, GWL_EXSTYLE, ::GetWindowLong(hWnd, GWL_EXSTYLE) ^ WS_EX_LAYERED); 594 | ::SetWindowLong(hWnd, GWL_EXSTYLE, ::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED); 595 | if (m_bHighContrast) 596 | { 597 | ::SetLayeredWindowAttributes(hWnd, 0, 255, LWA_ALPHA); 598 | } 599 | else 600 | { 601 | ::SetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA); 602 | } 603 | #endif 604 | } 605 | 606 | //------------------------------------------------ 607 | // MessageMap 608 | //------------------------------------------------ 609 | 610 | void CDialogFx::OnTimer(UINT_PTR nIDEvent) 611 | { 612 | switch (nIDEvent) 613 | { 614 | case TimerUpdateDialogSizeDpiChanged: 615 | if (m_bDrag) 616 | { 617 | KillTimer(TimerUpdateDialogSizeDpiChanged); 618 | SetTimer(TimerUpdateDialogSizeDpiChanged, TIMER_UPDATE_DIALOG, NULL); 619 | } 620 | else 621 | { 622 | m_bDpiChanging = FALSE; 623 | KillTimer(TimerUpdateDialogSizeDpiChanged); 624 | UpdateDialogSize(); 625 | } 626 | break; 627 | case TimerUpdateDialogSizeDisplayChange: 628 | KillTimer(TimerUpdateDialogSizeDisplayChange); 629 | UpdateDialogSize(); 630 | break; 631 | case TimerUpdateDialogSizeSysColorChange: 632 | KillTimer(TimerUpdateDialogSizeSysColorChange); 633 | UpdateDialogSize(); 634 | break; 635 | case TimerUpdateDialogSizeSettingChange: 636 | KillTimer(TimerUpdateDialogSizeSettingChange); 637 | UpdateDialogSize(); 638 | break; 639 | } 640 | } 641 | 642 | BOOL CDialogFx::OnEraseBkgnd(CDC* pDC) 643 | { 644 | if (m_bHighContrast) 645 | { 646 | return CDialog::OnEraseBkgnd(pDC); 647 | } 648 | 649 | if(m_hPal && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE) 650 | { 651 | SelectPalette( pDC->GetSafeHdc(), m_hPal, TRUE ); 652 | pDC->RealizePalette(); 653 | pDC->SetStretchBltMode(HALFTONE); 654 | } 655 | 656 | CRect rect; 657 | GetClientRect(&rect); 658 | 659 | return pDC->StretchBlt(0, 0, rect.Width(), rect.Height(), &m_BkDC, 0, 0, rect.Width(), rect.Height(), SRCCOPY); 660 | } 661 | 662 | afx_msg LRESULT CDialogFx::OnDpiChanged(WPARAM wParam, LPARAM lParam) 663 | { 664 | if (m_bInitializing) { return 0; } 665 | 666 | static ULONGLONG preTime = 0; 667 | ULONGLONG currentTime = GetTickCountFx(); 668 | if (currentTime - preTime < 1000) 669 | { 670 | return 0; 671 | } 672 | else 673 | { 674 | preTime = currentTime; 675 | } 676 | 677 | m_Dpi = (INT)HIWORD(wParam); 678 | 679 | #if _MSC_VER > 1310 680 | if (IsWindowsBuildOrGreater(16299)) // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 681 | { 682 | ChangeZoomType(m_ZoomType); 683 | m_bDpiChanging = TRUE; 684 | SetTimer(TimerUpdateDialogSizeDpiChanged, TIMER_UPDATE_DIALOG, NULL); 685 | } 686 | else 687 | #endif 688 | if(m_ZoomType == ZoomTypeAuto) 689 | { 690 | DWORD oldZoomRatio = (DWORD)(m_ZoomRatio * 100); 691 | if (ChangeZoomType(m_ZoomType) != oldZoomRatio) 692 | { 693 | m_bDpiChanging = TRUE; 694 | SetTimer(TimerUpdateDialogSizeDpiChanged, TIMER_UPDATE_DIALOG, NULL); 695 | } 696 | } 697 | 698 | return 0; 699 | } 700 | 701 | afx_msg LRESULT CDialogFx::OnDisplayChange(WPARAM wParam, LPARAM lParam) 702 | { 703 | if (m_bInitializing) { return 0; } 704 | 705 | CDC* cdc = GetDC(); 706 | if (cdc) 707 | { 708 | int color = cdc->GetDeviceCaps(BITSPIXEL) * cdc->GetDeviceCaps(PLANES); 709 | if (color != wParam) 710 | { 711 | SetTimer(TimerUpdateDialogSizeDisplayChange, TIMER_UPDATE_DIALOG, NULL); 712 | } 713 | ReleaseDC(cdc); 714 | } 715 | 716 | return 0; 717 | } 718 | 719 | afx_msg LRESULT CDialogFx::OnSysColorChange(WPARAM wParam, LPARAM lParam) 720 | { 721 | if (m_bInitializing) { return 0; } 722 | 723 | m_bHighContrast = IsHighContrast(); 724 | 725 | SetTimer(TimerUpdateDialogSizeSysColorChange, TIMER_UPDATE_DIALOG, NULL); 726 | 727 | return 0; 728 | } 729 | 730 | afx_msg LRESULT CDialogFx::OnSettingChange(WPARAM wParam, LPARAM lParam) 731 | { 732 | if (m_bInitializing) { return 0; } 733 | 734 | if (!lstrcmp(LPCTSTR(lParam), _T("ImmersiveColorSet"))) 735 | { 736 | SetTimer(TimerUpdateDialogSizeSettingChange, TIMER_UPDATE_DIALOG, NULL); 737 | } 738 | 739 | return 0; 740 | } 741 | 742 | afx_msg LRESULT CDialogFx::OnEnterSizeMove(WPARAM wParam, LPARAM lParam) 743 | { 744 | m_bDrag = TRUE; 745 | 746 | return TRUE; 747 | } 748 | 749 | afx_msg LRESULT CDialogFx::OnExitSizeMove(WPARAM wParam, LPARAM lParam) 750 | { 751 | m_bDrag = FALSE; 752 | 753 | return TRUE; 754 | } --------------------------------------------------------------------------------