MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / CUtility

Class CUtility

src/UtilityLib/Utility.h:8–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <Windows.h>
7
8class CUtility
9{
10public:
11 CUtility() = default;
12 ~CUtility() = default;
13
14 static std::wstring GetVersion(const std::wstring& filePath);
15
16 static HWND CreateToolTip(HWND hWnd, int nCtrlID, const std::wstring& tooltipText, HINSTANCE hInst = nullptr);
17
18 static float GetDesktopScale(HWND hWnd);
19
20 static short GetXFromLPARAM(LPARAM lp);
21 static short GetYFromLPARAM(LPARAM lp);
22
23 static auto GetEditCtrlText(HWND hWnd) -> std::wstring;
24 static void SetEditCtrlText(HWND hWnd, const std::wstring& txt);
25
26 static bool GetCheckboxStatus(HWND hWnd);
27 static void SetCheckboxStatus(HWND hWnd, bool bCheck);
28
29 static bool DirExist(const std::wstring& dirPath);
30 static bool FileExist(const std::wstring& filePath);
31
32 static long FileSize(const std::wstring& filePath);
33
34 static bool CreateDir(const std::wstring& dirPath);
35
36 static bool Copy(const std::wstring& srcFile, const std::wstring& dstFile);
37
38 static auto GetFileName(const std::wstring& fullPath, bool withExtension = true) -> std::wstring;
39 static auto GetFileExtension(const std::wstring& fileName) -> std::wstring;
40
41 static auto GetTempFilePath() -> std::wstring;
42 static auto GetSpecialFolderLocation(int folderKind) -> std::wstring;
43
44 static bool OpenFileDlg(std::wstring& filePath, const std::wstring& dlgTitle, const std::vector<wchar_t>& dlgFilter, DWORD flags = 0);
45
46 static bool CopyToClipboard(const std::wstring& str2cpy, HWND hWnd);
47
48 static bool IsNumber(const std::wstring& str);
49 static auto GetNumber(const std::wstring& str) -> std::optional<int>;
50};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected