├── .gitattributes ├── .gitignore ├── OpenHardwareMonitorApi ├── LibreHardwareMonitorLib.dll ├── LibreHardwareMonitorLib.xml ├── OpenHardwareMonitorApi.h ├── OpenHardwareMonitorApi.vcxproj ├── OpenHardwareMonitorApi.vcxproj.filters ├── OpenHardwareMonitorGlobal.h ├── OpenHardwareMonitorImp.cpp ├── OpenHardwareMonitorImp.h ├── Stdafx.cpp ├── Stdafx.h ├── UpdateVisitor.cpp ├── UpdateVisitor.h └── resource.h ├── TrayS.sln └── TrayS ├── 1280.ico ├── 576.ico ├── 800.ico ├── 960.ico ├── Function.cpp ├── Function.h ├── OlsApiInit.h ├── OlsApiInitDef.h ├── OlsDef.h ├── OpenHardwareMonitorApi.h ├── OpenHardwareMonitorApi.lib ├── OpenHardwareMonitorGlobal.h ├── TrayS.cpp ├── TrayS.h ├── TrayS.ico ├── TrayS.rc ├── TrayS.vcxproj ├── TrayS.vcxproj.filters ├── WinRing0x32.sys ├── WinRing0x64.sys ├── adl_defines.h ├── adl_sdk.h ├── adl_structures.h ├── close.ico ├── framework.h ├── lb.ico ├── lt.ico ├── mute.ico ├── nomute.ico ├── notopmost.ico ├── nvapi.h ├── path.ico ├── rb.ico ├── resource.h ├── rt.ico ├── targetver.h ├── topmost.ico └── window.ico /.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 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/LibreHardwareMonitorLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/OpenHardwareMonitorApi/LibreHardwareMonitorLib.dll -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorApi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "OpenHardwareMonitorGlobal.h" 4 | #include 5 | #include 6 | 7 | namespace OpenHardwareMonitorApi 8 | { 9 | class IOpenHardwareMonitor 10 | { 11 | public: 12 | virtual void GetHardwareInfo() = 0; //获取一次硬件信息 13 | virtual float CpuTemperature() = 0; //返回获取到的CPU温度 14 | virtual float GpuTemperature() = 0; //返回获取到的GPU温度 15 | virtual float HDDTemperature() = 0; //返回获取到的硬盘温度 16 | virtual float MainboardTemperature() = 0; //返回获取到的主板温度 17 | virtual float GpuUsage() = 0; //返回获取到的GPU利用率 18 | virtual const std::map& AllHDDTemperature() = 0; //返回所有硬盘的温度。map的key是硬盘的名称,value是硬盘的温度 19 | virtual const std::map& AllCpuTemperature() = 0; //返回所有CPU(核心)的温度。map的key是CPU的名称,value是硬盘的温度 20 | virtual const std::map& AllHDDUsage() = 0; //返回所有硬盘的使用率 21 | 22 | virtual void SetCpuEnable(bool enable) = 0; 23 | virtual void SetGpuEnable(bool enable) = 0; 24 | virtual void SetHddEnable(bool enable) = 0; 25 | virtual void SetMainboardEnable(bool enable) = 0; 26 | }; 27 | 28 | std::shared_ptr CreateInstance(); 29 | // OPENHARDWAREMONITOR_API std::wstring GetErrorMessage(); 30 | } 31 | std::shared_ptr m_pMonitor{}; 32 | extern "C" OPENHARDWAREMONITOR_API void GetTemperature(float* fCpu,float * fGpu,float* fMain,float *fHdd,int iHDD,float * fCpuPackge) 33 | { 34 | if (m_pMonitor == 0) 35 | { 36 | m_pMonitor = OpenHardwareMonitorApi::CreateInstance(); 37 | if(fCpu) 38 | m_pMonitor->SetCpuEnable(true); 39 | if (fGpu) 40 | m_pMonitor->SetGpuEnable(true); 41 | if (fHdd) 42 | m_pMonitor->SetHddEnable(true); 43 | if (fMain) 44 | m_pMonitor->SetMainboardEnable(true); 45 | } 46 | m_pMonitor->GetHardwareInfo(); 47 | if (fCpu) 48 | { 49 | std::wstring cpu_core_name=L"CPU Core #1"; 50 | auto iter = m_pMonitor->AllCpuTemperature().find(cpu_core_name); 51 | if (iter == m_pMonitor->AllCpuTemperature().end()) 52 | { 53 | iter = m_pMonitor->AllCpuTemperature().begin(); 54 | } 55 | *fCpu = iter->second; 56 | } 57 | if (fCpuPackge) 58 | { 59 | std::wstring cpu_core_name = L"CPU Package"; 60 | auto iter = m_pMonitor->AllCpuTemperature().find(cpu_core_name); 61 | if (iter == m_pMonitor->AllCpuTemperature().end()) 62 | { 63 | iter = m_pMonitor->AllCpuTemperature().begin(); 64 | iter++; 65 | } 66 | *fCpuPackge = iter->second; 67 | } 68 | if (fGpu) 69 | *fGpu = m_pMonitor->GpuTemperature(); 70 | if (fMain) 71 | *fMain = m_pMonitor->MainboardTemperature(); 72 | if (fHdd) 73 | { 74 | auto iter = m_pMonitor->AllHDDTemperature().begin(); 75 | if (iHDD == -1) 76 | { 77 | size_t n = m_pMonitor->AllHDDTemperature().size(); 78 | float f = 0; 79 | for (size_t i = 0; i < n; i++) 80 | { 81 | if (iter->second > f) 82 | f = iter->second; 83 | } 84 | *fHdd = f; 85 | } 86 | else 87 | { 88 | for (int i = 0; i < iHDD; i++) 89 | { 90 | ++iter; 91 | } 92 | *fHdd = iter->second; 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorApi.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26} 23 | 24 | 25 | ManagedCProj 26 | OpenHardwareMonitorApi 27 | 10.0.22000.0 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | v143 34 | true 35 | Unicode 36 | 37 | 38 | DynamicLibrary 39 | false 40 | v143 41 | true 42 | Unicode 43 | 44 | 45 | DynamicLibrary 46 | true 47 | v143 48 | true 49 | Unicode 50 | 51 | 52 | DynamicLibrary 53 | false 54 | v143 55 | true 56 | Unicode 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | $(ProjectDir)..\include;$(IncludePath) 79 | $(SolutionDir)Bin\$(Configuration)\ 80 | 81 | 82 | true 83 | $(ProjectDir)..\include;$(IncludePath) 84 | $(SolutionDir)Bin\$(Platform)\$(Configuration)\ 85 | 86 | 87 | false 88 | $(ProjectDir)..\include;$(IncludePath) 89 | $(SolutionDir)Bin\$(Configuration)\ 90 | 91 | 92 | false 93 | $(IncludePath) 94 | ..\x64\Release 95 | 96 | 97 | 98 | Level3 99 | Disabled 100 | WIN32;_DEBUG;%(PreprocessorDefinitions);OPENHARDWAREMONITOR_EXPORTS 101 | Use 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | Level3 110 | Disabled 111 | _DEBUG;%(PreprocessorDefinitions);OPENHARDWAREMONITOR_EXPORTS 112 | Use 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Level3 121 | WIN32;NDEBUG;%(PreprocessorDefinitions);OPENHARDWAREMONITOR_EXPORTS 122 | Use 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | TurnOffAllWarnings 131 | NDEBUG;%(PreprocessorDefinitions);OPENHARDWAREMONITOR_EXPORTS 132 | Use 133 | MinSpace 134 | None 135 | Size 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | LibreHardwareMonitorLib.dll 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | Create 161 | Create 162 | Create 163 | Create 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorApi.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;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | 头文件 16 | 17 | 18 | 头文件 19 | 20 | 21 | 头文件 22 | 23 | 24 | 头文件 25 | 26 | 27 | 头文件 28 | 29 | 30 | 头文件 31 | 32 | 33 | 34 | 35 | 源文件 36 | 37 | 38 | 源文件 39 | 40 | 41 | 源文件 42 | 43 | 44 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorGlobal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef OPENHARDWAREMONITOR_EXPORTS 4 | #define OPENHARDWAREMONITOR_API __declspec(dllexport) 5 | #else 6 | #define OPENHARDWAREMONITOR_API __declspec(dllimport) 7 | #endif 8 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorImp.cpp: -------------------------------------------------------------------------------- 1 | // 这是主 DLL 文件。 2 | 3 | #include "stdafx.h" 4 | 5 | #include "OpenHardwareMonitorImp.h" 6 | #include 7 | 8 | namespace OpenHardwareMonitorApi 9 | { 10 | static std::wstring error_message; 11 | 12 | //将CRL的String类型转换成C++的std::wstring类型 13 | static std::wstring ClrStringToStdWstring(System::String^ str) 14 | { 15 | if (str == nullptr) 16 | { 17 | return std::wstring(); 18 | } 19 | else 20 | { 21 | const wchar_t* chars = (const wchar_t*)(Runtime::InteropServices::Marshal::StringToHGlobalUni(str)).ToPointer(); 22 | std::wstring os = chars; 23 | Runtime::InteropServices::Marshal::FreeHGlobal(IntPtr((void*)chars)); 24 | return os; 25 | } 26 | } 27 | 28 | 29 | std::shared_ptr CreateInstance() 30 | { 31 | std::shared_ptr pMonitor; 32 | try 33 | { 34 | MonitorGlobal::Instance()->Init(); 35 | pMonitor = std::make_shared(); 36 | } 37 | catch (System::Exception^ e) 38 | { 39 | error_message = ClrStringToStdWstring(e->Message); 40 | } 41 | return pMonitor; 42 | } 43 | 44 | std::wstring GetErrorMessage() 45 | { 46 | return error_message; 47 | } 48 | 49 | float COpenHardwareMonitor::CpuTemperature() 50 | { 51 | return m_cpu_temperature; 52 | } 53 | 54 | float COpenHardwareMonitor::GpuTemperature() 55 | { 56 | if (m_gpu_nvidia_temperature >= 0) 57 | return m_gpu_nvidia_temperature; 58 | else 59 | return m_gpu_ati_temperature; 60 | } 61 | 62 | float COpenHardwareMonitor::HDDTemperature() 63 | { 64 | return m_hdd_temperature; 65 | } 66 | 67 | float COpenHardwareMonitor::MainboardTemperature() 68 | { 69 | return m_main_board_temperature; 70 | } 71 | 72 | float COpenHardwareMonitor::GpuUsage() 73 | { 74 | if (m_gpu_nvidia_usage >= 0) 75 | return m_gpu_nvidia_usage; 76 | else 77 | return m_gpu_ati_usage; 78 | } 79 | 80 | const std::map& COpenHardwareMonitor::AllHDDTemperature() 81 | { 82 | return m_all_hdd_temperature; 83 | } 84 | 85 | const std::map& COpenHardwareMonitor::AllCpuTemperature() 86 | { 87 | return m_all_cpu_temperature; 88 | } 89 | 90 | const std::map& COpenHardwareMonitor::AllHDDUsage() 91 | { 92 | return m_all_hdd_usage; 93 | } 94 | 95 | void COpenHardwareMonitor::SetCpuEnable(bool enable) 96 | { 97 | MonitorGlobal::Instance()->computer->IsCpuEnabled = enable; 98 | } 99 | 100 | void COpenHardwareMonitor::SetGpuEnable(bool enable) 101 | { 102 | MonitorGlobal::Instance()->computer->IsGpuEnabled = enable; 103 | } 104 | 105 | void COpenHardwareMonitor::SetHddEnable(bool enable) 106 | { 107 | MonitorGlobal::Instance()->computer->IsStorageEnabled = enable; 108 | } 109 | 110 | void COpenHardwareMonitor::SetMainboardEnable(bool enable) 111 | { 112 | MonitorGlobal::Instance()->computer->IsMotherboardEnabled = enable; 113 | } 114 | 115 | bool COpenHardwareMonitor::GetHardwareTemperature(IHardware^ hardware, float& temperature) 116 | { 117 | temperature = -1; 118 | std::vector all_temperature; 119 | float core_temperature{ -1 }; 120 | System::String^ temperature_name; 121 | switch (hardware->HardwareType) 122 | { 123 | case HardwareType::Cpu: 124 | temperature_name = L"Core Average"; 125 | break; 126 | case HardwareType::GpuNvidia: case HardwareType::GpuAmd: 127 | temperature_name = L"GPU Core"; 128 | break; 129 | default: 130 | break; 131 | } 132 | for (int i = 0; i < hardware->Sensors->Length; i++) 133 | { 134 | //找到温度传感器 135 | if (hardware->Sensors[i]->SensorType == SensorType::Temperature) 136 | { 137 | float cur_temperture = Convert::ToDouble(hardware->Sensors[i]->Value); 138 | all_temperature.push_back(cur_temperture); 139 | if (hardware->Sensors[i]->Name == temperature_name) //如果找到了名称为temperature_name的温度传感器,则将温度保存到core_temperature里 140 | core_temperature = cur_temperture; 141 | } 142 | } 143 | if (core_temperature >= 0) 144 | { 145 | temperature = core_temperature; 146 | return true; 147 | } 148 | if (!all_temperature.empty()) 149 | { 150 | //如果有多个温度传感器,则取平均值 151 | float sum{}; 152 | for (auto i : all_temperature) 153 | sum += i; 154 | temperature = sum / all_temperature.size(); 155 | return true; 156 | } 157 | //如果没有找到温度传感器,则在SubHardware中寻找 158 | for (int i = 0; i < hardware->SubHardware->Length; i++) 159 | { 160 | if (GetHardwareTemperature(hardware->SubHardware[i], temperature)) 161 | return true; 162 | } 163 | return false; 164 | } 165 | 166 | bool COpenHardwareMonitor::GetCpuTemperature(IHardware^ hardware, float& temperature) 167 | { 168 | temperature = -1; 169 | m_all_cpu_temperature.clear(); 170 | for (int i = 0; i < hardware->Sensors->Length; i++) 171 | { 172 | //找到温度传感器 173 | if (hardware->Sensors[i]->SensorType == SensorType::Temperature) 174 | { 175 | String^ name = hardware->Sensors[i]->Name; 176 | //保存每个CPU传感器的温度 177 | m_all_cpu_temperature[ClrStringToStdWstring(name)] = Convert::ToDouble(hardware->Sensors[i]->Value); 178 | } 179 | } 180 | //计算平均温度 181 | if (!m_all_cpu_temperature.empty()) 182 | { 183 | float sum{}; 184 | for (const auto& item : m_all_cpu_temperature) 185 | sum += item.second; 186 | temperature = sum / m_all_cpu_temperature.size(); 187 | } 188 | return temperature > 0; 189 | } 190 | 191 | bool COpenHardwareMonitor::GetGpuUsage(IHardware^ hardware, float& gpu_usage) 192 | { 193 | for (int i = 0; i < hardware->Sensors->Length; i++) 194 | { 195 | //找到负载 196 | if (hardware->Sensors[i]->SensorType == SensorType::Load) 197 | { 198 | if (hardware->Sensors[i]->Name == L"GPU Core") 199 | { 200 | gpu_usage = Convert::ToDouble(hardware->Sensors[i]->Value); 201 | return true; 202 | } 203 | } 204 | } 205 | return false; 206 | } 207 | 208 | bool COpenHardwareMonitor::GetHddUsage(IHardware^ hardware, float& hdd_usage) 209 | { 210 | for (int i = 0; i < hardware->Sensors->Length; i++) 211 | { 212 | //找到负载 213 | if (hardware->Sensors[i]->SensorType == SensorType::Load) 214 | { 215 | if (hardware->Sensors[i]->Name == L"Total Activity") 216 | { 217 | hdd_usage = Convert::ToDouble(hardware->Sensors[i]->Value); 218 | return true; 219 | } 220 | } 221 | } 222 | return false; 223 | } 224 | 225 | COpenHardwareMonitor::COpenHardwareMonitor() 226 | { 227 | ResetAllValues(); 228 | } 229 | 230 | COpenHardwareMonitor::~COpenHardwareMonitor() 231 | { 232 | MonitorGlobal::Instance()->UnInit(); 233 | } 234 | 235 | void COpenHardwareMonitor::ResetAllValues() 236 | { 237 | m_cpu_temperature = -1; 238 | m_gpu_nvidia_temperature = -1; 239 | m_gpu_ati_temperature = -1; 240 | m_hdd_temperature = -1; 241 | m_main_board_temperature = -1; 242 | m_gpu_nvidia_usage = -1; 243 | m_gpu_ati_usage = -1; 244 | m_all_hdd_temperature.clear(); 245 | m_all_hdd_usage.clear(); 246 | } 247 | 248 | void COpenHardwareMonitor::InsertValueToMap(std::map& value_map, const std::wstring& key, float value) 249 | { 250 | auto iter = value_map.find(key); 251 | if (iter == value_map.end()) 252 | { 253 | value_map[key] = value; 254 | } 255 | else 256 | { 257 | std::wstring key_exist = iter->first; 258 | size_t index = key_exist.rfind(L'#'); //查找字符串是否含有#号 259 | if (index != std::wstring::npos) 260 | { 261 | //取到#号后面的数字,将其加1 262 | int num = _wtoi(key_exist.substr(index + 1).c_str()); 263 | num++; 264 | key_exist = key_exist.substr(0, index + 1); 265 | key_exist += std::to_wstring(num); 266 | } 267 | else //没有#号则在末尾添加" #1" 268 | { 269 | key_exist += L" #1"; 270 | } 271 | value_map[key_exist] = value; 272 | } 273 | } 274 | 275 | void COpenHardwareMonitor::GetHardwareInfo() 276 | { 277 | ResetAllValues(); 278 | error_message.clear(); 279 | try 280 | { 281 | wchar_t nDisk=L'0'; 282 | auto computer = MonitorGlobal::Instance()->computer; 283 | computer->Accept(MonitorGlobal::Instance()->updateVisitor); 284 | for (int i = 0; i < computer->Hardware->Count; i++) 285 | { 286 | //查找硬件类型 287 | switch (computer->Hardware[i]->HardwareType) 288 | { 289 | case HardwareType::Cpu: 290 | if (m_cpu_temperature < 0) 291 | GetCpuTemperature(computer->Hardware[i], m_cpu_temperature); 292 | break; 293 | case HardwareType::GpuNvidia: 294 | if (m_gpu_nvidia_temperature < 0) 295 | GetHardwareTemperature(computer->Hardware[i], m_gpu_nvidia_temperature); 296 | if (m_gpu_nvidia_usage < 0) 297 | GetGpuUsage(computer->Hardware[i], m_gpu_nvidia_usage); 298 | break; 299 | case HardwareType::GpuAmd: 300 | if (m_gpu_ati_temperature < 0) 301 | GetHardwareTemperature(computer->Hardware[i], m_gpu_ati_temperature); 302 | if (m_gpu_ati_usage < 0) 303 | GetGpuUsage(computer->Hardware[i], m_gpu_ati_usage); 304 | break; 305 | case HardwareType::Storage: 306 | { 307 | float cur_hdd_temperature = -1; 308 | GetHardwareTemperature(computer->Hardware[i], cur_hdd_temperature); 309 | //m_all_hdd_temperature[ClrStringToStdWstring(computer->Hardware[i]->Name)] = cur_hdd_temperature; 310 | InsertValueToMap(m_all_hdd_temperature,nDisk + ClrStringToStdWstring(computer->Hardware[i]->Name), cur_hdd_temperature); 311 | float cur_hdd_usage = -1; 312 | GetHddUsage(computer->Hardware[i], cur_hdd_usage); 313 | //m_all_hdd_usage[ClrStringToStdWstring(computer->Hardware[i]->Name)] = cur_hdd_usage; 314 | InsertValueToMap(m_all_hdd_usage,nDisk+ ClrStringToStdWstring(computer->Hardware[i]->Name), cur_hdd_usage); 315 | if (m_hdd_temperature < 0) 316 | m_hdd_temperature = cur_hdd_temperature; 317 | ++nDisk; 318 | } 319 | break; 320 | case HardwareType::Motherboard: 321 | if (m_main_board_temperature < 0) 322 | { 323 | float fMain; 324 | GetHardwareTemperature(computer->Hardware[i], fMain); 325 | if (fMain > m_main_board_temperature) 326 | m_main_board_temperature = fMain; 327 | } 328 | break; 329 | default: 330 | break; 331 | } 332 | } 333 | } 334 | catch (System::Exception^ e) 335 | { 336 | error_message = ClrStringToStdWstring(e->Message); 337 | } 338 | } 339 | 340 | //////////////////////////////////////////////////////////////////////////////////// 341 | MonitorGlobal::MonitorGlobal() 342 | { 343 | 344 | } 345 | 346 | MonitorGlobal::~MonitorGlobal() 347 | { 348 | 349 | } 350 | 351 | void MonitorGlobal::Init() 352 | { 353 | updateVisitor = gcnew UpdateVisitor(); 354 | computer = gcnew Computer(); 355 | computer->Open(); 356 | } 357 | 358 | void MonitorGlobal::UnInit() 359 | { 360 | computer->Close(); 361 | } 362 | 363 | } 364 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/OpenHardwareMonitorImp.h: -------------------------------------------------------------------------------- 1 | // OpenHardwareMonitorApi.h 2 | 3 | #pragma once 4 | #include 5 | #include "OpenHardwareMonitorApi.h" 6 | #include "UpdateVisitor.h" 7 | #include 8 | 9 | using namespace System; 10 | using namespace LibreHardwareMonitor::Hardware; 11 | 12 | namespace OpenHardwareMonitorApi { 13 | 14 | public class COpenHardwareMonitor : public IOpenHardwareMonitor 15 | { 16 | public: 17 | COpenHardwareMonitor(); 18 | virtual ~COpenHardwareMonitor(); 19 | 20 | virtual void GetHardwareInfo() override; 21 | virtual float CpuTemperature() override; 22 | virtual float GpuTemperature() override; 23 | virtual float HDDTemperature() override; 24 | virtual float MainboardTemperature() override; 25 | virtual float GpuUsage() override; 26 | virtual const std::map& AllHDDTemperature() override; 27 | virtual const std::map& AllCpuTemperature() override; 28 | virtual const std::map& AllHDDUsage() override; 29 | 30 | virtual void SetCpuEnable(bool enable) override; 31 | virtual void SetGpuEnable(bool enable) override; 32 | virtual void SetHddEnable(bool enable) override; 33 | virtual void SetMainboardEnable(bool enable) override; 34 | 35 | private: 36 | bool GetHardwareTemperature(IHardware^ hardware, float& temperature); 37 | bool GetCpuTemperature(IHardware^ hardware, float& temperature); 38 | bool GetGpuUsage(IHardware^ hardware, float& gpu_usage); 39 | bool GetHddUsage(IHardware^ hardware, float& hdd_usage); 40 | 41 | void ResetAllValues(); 42 | //向map中插入一个数值,如果key已经存在,则自动对新插入的key重命名 43 | static void InsertValueToMap(std::map& value_map, const std::wstring& key, float value); 44 | 45 | private: 46 | float m_cpu_temperature{}; 47 | float m_gpu_nvidia_temperature{}; 48 | float m_gpu_ati_temperature{}; 49 | float m_hdd_temperature{}; 50 | float m_main_board_temperature{}; 51 | float m_gpu_nvidia_usage{}; 52 | float m_gpu_ati_usage{}; 53 | std::map m_all_hdd_temperature; 54 | std::map m_all_cpu_temperature; 55 | std::map m_all_hdd_usage; 56 | }; 57 | 58 | //一个单实例类 59 | //由于COpenHardwareMonitor是非托管类,不能将托管类的对象作为成员变量,此类用于保存托管类的对象 60 | public ref class MonitorGlobal 61 | { 62 | public: 63 | MonitorGlobal(); 64 | ~MonitorGlobal(); 65 | static MonitorGlobal^ Instance() 66 | { 67 | if (m_instance == nullptr) 68 | { 69 | m_instance = gcnew MonitorGlobal(); 70 | } 71 | return m_instance; 72 | } 73 | 74 | void Init(); 75 | void UnInit(); 76 | 77 | Computer^ computer; 78 | UpdateVisitor^ updateVisitor{}; 79 | 80 | private: 81 | static MonitorGlobal^ m_instance{}; 82 | }; 83 | } 84 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/Stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/OpenHardwareMonitorApi/Stdafx.cpp -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/Stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/OpenHardwareMonitorApi/Stdafx.h -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/UpdateVisitor.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UpdateVisitor.h" 3 | 4 | namespace OpenHardwareMonitorApi 5 | { 6 | void UpdateVisitor::VisitComputer(IComputer ^ computer) 7 | { 8 | computer->Traverse(this); 9 | } 10 | 11 | void UpdateVisitor::VisitHardware(IHardware ^ hardware) 12 | { 13 | hardware->Update(); 14 | for each (IHardware^ subHardware in hardware->SubHardware) 15 | { 16 | subHardware->Accept(this); 17 | } 18 | } 19 | 20 | void UpdateVisitor::VisitSensor(ISensor ^ sensor) 21 | { 22 | } 23 | 24 | void UpdateVisitor::VisitParameter(IParameter ^ parameter) 25 | { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/UpdateVisitor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace LibreHardwareMonitor::Hardware; 4 | 5 | namespace OpenHardwareMonitorApi 6 | { 7 | public ref class UpdateVisitor : IVisitor 8 | { 9 | public: 10 | virtual void VisitComputer(IComputer^ computer); 11 | virtual void VisitHardware(IHardware^ hardware); 12 | virtual void VisitSensor(ISensor^ sensor); 13 | virtual void VisitParameter(IParameter^ parameter); 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /OpenHardwareMonitorApi/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/OpenHardwareMonitorApi/resource.h -------------------------------------------------------------------------------- /TrayS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32505.426 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrayS", "TrayS\TrayS.vcxproj", "{6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenHardwareMonitorApi", "OpenHardwareMonitorApi\OpenHardwareMonitorApi.vcxproj", "{C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|ARM = Debug|ARM 14 | Debug|ARM64 = Debug|ARM64 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|ARM = Release|ARM 19 | Release|ARM64 = Release|ARM64 20 | Release|x64 = Release|x64 21 | Release|x86 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|Any CPU.ActiveCfg = Debug|x64 25 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|Any CPU.Build.0 = Debug|x64 26 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|ARM.ActiveCfg = Debug|x64 27 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|ARM.Build.0 = Debug|x64 28 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|ARM64.ActiveCfg = Debug|x64 29 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|ARM64.Build.0 = Debug|x64 30 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|x64.ActiveCfg = Debug|x64 31 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|x64.Build.0 = Debug|x64 32 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|x86.ActiveCfg = Debug|Win32 33 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Debug|x86.Build.0 = Debug|Win32 34 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|Any CPU.ActiveCfg = Release|x64 35 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|Any CPU.Build.0 = Release|x64 36 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|ARM.ActiveCfg = Release|x64 37 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|ARM.Build.0 = Release|x64 38 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|ARM64.ActiveCfg = Release|x64 39 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|ARM64.Build.0 = Release|x64 40 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|x64.ActiveCfg = Release|x64 41 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|x64.Build.0 = Release|x64 42 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|x86.ActiveCfg = Release|Win32 43 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3}.Release|x86.Build.0 = Release|Win32 44 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|Any CPU.ActiveCfg = Debug|x64 45 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|Any CPU.Build.0 = Debug|x64 46 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|ARM.ActiveCfg = Debug|x64 47 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|ARM.Build.0 = Debug|x64 48 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|ARM64.ActiveCfg = Debug|x64 49 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|ARM64.Build.0 = Debug|x64 50 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|x64.ActiveCfg = Debug|x64 51 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|x64.Build.0 = Debug|x64 52 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|x86.ActiveCfg = Debug|Win32 53 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Debug|x86.Build.0 = Debug|Win32 54 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|Any CPU.ActiveCfg = Release|x64 55 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|Any CPU.Build.0 = Release|x64 56 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|ARM.ActiveCfg = Release|x64 57 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|ARM.Build.0 = Release|x64 58 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|ARM64.ActiveCfg = Release|x64 59 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|ARM64.Build.0 = Release|x64 60 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|x64.ActiveCfg = Release|x64 61 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|x64.Build.0 = Release|x64 62 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|x86.ActiveCfg = Release|Win32 63 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}.Release|x86.Build.0 = Release|Win32 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | GlobalSection(ExtensibilityGlobals) = postSolution 69 | SolutionGuid = {380AFE77-3EE9-4333-A092-6D0FAAD20734} 70 | EndGlobalSection 71 | EndGlobal 72 | -------------------------------------------------------------------------------- /TrayS/1280.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/1280.ico -------------------------------------------------------------------------------- /TrayS/576.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/576.ico -------------------------------------------------------------------------------- /TrayS/800.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/800.ico -------------------------------------------------------------------------------- /TrayS/960.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/960.ico -------------------------------------------------------------------------------- /TrayS/Function.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/Function.cpp -------------------------------------------------------------------------------- /TrayS/Function.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/Function.h -------------------------------------------------------------------------------- /TrayS/OlsApiInit.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : http://openlibsys.org/ 5 | // License : The modified BSD license 6 | // 7 | // Copyright 2007-2020 OpenLibSys.org. All rights reserved. 8 | //----------------------------------------------------------------------------- 9 | // for WinRing0 3.0.x 10 | 11 | #pragma once 12 | 13 | //#include "stdafx.h" 14 | #include "OlsDef.h" 15 | #include "OlsApiInitDef.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | // 19 | // Prototypes 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | BOOL InitOpenLibSys(HMODULE *hModule); 24 | BOOL DeinitOpenLibSys(HMODULE *hModule); 25 | 26 | //----------------------------------------------------------------------------- 27 | // 28 | // Funtions 29 | // 30 | //----------------------------------------------------------------------------- 31 | 32 | // DLL 33 | _GetDllStatus GetDllStatus = NULL; 34 | _GetDllVersion GetDllVersion = NULL; 35 | _GetDriverVersion GetDriverVersion = NULL; 36 | _GetDriverType GetDriverType = NULL; 37 | 38 | _InitializeOls InitializeOls = NULL; 39 | _DeinitializeOls DeinitializeOls = NULL; 40 | 41 | // CPU 42 | _IsCpuid IsCpuid = NULL; 43 | _IsMsr IsMsr = NULL; 44 | _IsTsc IsTsc = NULL; 45 | 46 | _Hlt Hlt = NULL; 47 | _Rdmsr Rdmsr = NULL; 48 | _Wrmsr Wrmsr = NULL; 49 | _Rdpmc Rdpmc = NULL; 50 | _Cpuid Cpuid = NULL; 51 | _Rdtsc Rdtsc = NULL; 52 | 53 | _HltTx HltTx = NULL; 54 | _RdmsrTx RdmsrTx = NULL; 55 | _WrmsrTx WrmsrTx = NULL; 56 | _RdpmcTx RdpmcTx = NULL; 57 | _CpuidTx CpuidTx = NULL; 58 | _RdtscTx RdtscTx = NULL; 59 | 60 | _HltPx HltPx = NULL; 61 | _RdmsrPx RdmsrPx = NULL; 62 | _WrmsrPx WrmsrPx = NULL; 63 | _RdpmcPx RdpmcPx = NULL; 64 | _CpuidPx CpuidPx = NULL; 65 | _RdtscPx RdtscPx = NULL; 66 | 67 | // I/O 68 | _ReadIoPortByte ReadIoPortByte = NULL; 69 | _ReadIoPortWord ReadIoPortWord = NULL; 70 | _ReadIoPortDword ReadIoPortDword = NULL; 71 | 72 | _ReadIoPortByteEx ReadIoPortByteEx = NULL; 73 | _ReadIoPortWordEx ReadIoPortWordEx = NULL; 74 | _ReadIoPortDwordEx ReadIoPortDwordEx = NULL; 75 | 76 | _WriteIoPortByte WriteIoPortByte = NULL; 77 | _WriteIoPortWord WriteIoPortWord = NULL; 78 | _WriteIoPortDword WriteIoPortDword = NULL; 79 | 80 | _WriteIoPortByteEx WriteIoPortByteEx = NULL; 81 | _WriteIoPortWordEx WriteIoPortWordEx = NULL; 82 | _WriteIoPortDwordEx WriteIoPortDwordEx = NULL; 83 | 84 | // PCI 85 | _SetPciMaxBusIndex SetPciMaxBusIndex = NULL; 86 | 87 | _ReadPciConfigByte ReadPciConfigByte = NULL; 88 | _ReadPciConfigWord ReadPciConfigWord = NULL; 89 | _ReadPciConfigDword ReadPciConfigDword = NULL; 90 | 91 | _ReadPciConfigByteEx ReadPciConfigByteEx = NULL; 92 | _ReadPciConfigWordEx ReadPciConfigWordEx = NULL; 93 | _ReadPciConfigDwordEx ReadPciConfigDwordEx = NULL; 94 | 95 | _WritePciConfigByte WritePciConfigByte = NULL; 96 | _WritePciConfigWord WritePciConfigWord = NULL; 97 | _WritePciConfigDword WritePciConfigDword = NULL; 98 | 99 | _WritePciConfigByteEx WritePciConfigByteEx = NULL; 100 | _WritePciConfigWordEx WritePciConfigWordEx = NULL; 101 | _WritePciConfigDwordEx WritePciConfigDwordEx = NULL; 102 | 103 | _FindPciDeviceById FindPciDeviceById = NULL; 104 | _FindPciDeviceByClass FindPciDeviceByClass = NULL; 105 | 106 | // Memory 107 | #ifdef _PHYSICAL_MEMORY_SUPPORT 108 | _ReadDmiMemory ReadDmiMemory = NULL; 109 | _ReadPhysicalMemory ReadPhysicalMemory = NULL; 110 | _WritePhysicalMemory WritePhysicalMemory = NULL; 111 | #endif 112 | 113 | #ifdef _OPEN_LIB_SYS 114 | #ifdef _UNICODE 115 | #define GetOlsString GetOlsStringW 116 | #else 117 | #define GetOlsString GetOlsStringA 118 | #endif 119 | 120 | _InstallOpenLibSys InstallOpenLibSys = NULL; 121 | _UninstallOpenLibSys UninstallOpenLibSys = NULL; 122 | _GetDriverStatus GetDriverStatus = NULL; 123 | 124 | _GetOlsStringA GetOlsStringA = NULL; 125 | _GetOlsStringW GetOlsStringW = NULL; 126 | _GetOlsValue GetOlsValue = NULL; 127 | _SetOlsValue SetOlsValue = NULL; 128 | #endif 129 | 130 | //----------------------------------------------------------------------------- 131 | // 132 | // Initialize 133 | // 134 | //----------------------------------------------------------------------------- 135 | 136 | BOOL InitOpenLibSys(HMODULE *hModule) 137 | { 138 | #ifdef _M_X64 139 | *hModule = LoadLibrary(L"WinRing0x64.dll"); 140 | #else 141 | *hModule = LoadLibrary(L"WinRing0x32.dll"); 142 | #endif 143 | 144 | if(*hModule == NULL) 145 | { 146 | return FALSE; 147 | } 148 | 149 | //----------------------------------------------------------------------------- 150 | // GetProcAddress 151 | //----------------------------------------------------------------------------- 152 | // DLL 153 | GetDllStatus = (_GetDllStatus) GetProcAddress (*hModule, "GetDllStatus"); 154 | GetDllVersion = (_GetDllVersion) GetProcAddress (*hModule, "GetDllVersion"); 155 | GetDriverVersion = (_GetDriverVersion) GetProcAddress (*hModule, "GetDriverVersion"); 156 | GetDriverType = (_GetDriverType) GetProcAddress (*hModule, "GetDriverType"); 157 | 158 | InitializeOls = (_InitializeOls) GetProcAddress (*hModule, "InitializeOls"); 159 | DeinitializeOls = (_DeinitializeOls) GetProcAddress (*hModule, "DeinitializeOls"); 160 | 161 | // CPU 162 | IsCpuid = (_IsCpuid) GetProcAddress (*hModule, "IsCpuid"); 163 | IsMsr = (_IsMsr) GetProcAddress (*hModule, "IsMsr"); 164 | IsTsc = (_IsTsc) GetProcAddress (*hModule, "IsTsc"); 165 | Hlt = (_Hlt) GetProcAddress (*hModule, "Hlt"); 166 | Rdmsr = (_Rdmsr) GetProcAddress (*hModule, "Rdmsr"); 167 | Wrmsr = (_Wrmsr) GetProcAddress (*hModule, "Wrmsr"); 168 | Rdpmc = (_Rdpmc) GetProcAddress (*hModule, "Rdpmc"); 169 | Cpuid = (_Cpuid) GetProcAddress (*hModule, "Cpuid"); 170 | Rdtsc = (_Rdtsc) GetProcAddress (*hModule, "Rdtsc"); 171 | HltTx = (_HltTx) GetProcAddress (*hModule, "HltTx"); 172 | RdmsrTx = (_RdmsrTx) GetProcAddress (*hModule, "RdmsrTx"); 173 | WrmsrTx = (_WrmsrTx) GetProcAddress (*hModule, "WrmsrTx"); 174 | RdpmcTx = (_RdpmcTx) GetProcAddress (*hModule, "RdpmcTx"); 175 | CpuidTx = (_CpuidTx) GetProcAddress (*hModule, "CpuidTx"); 176 | RdtscTx = (_RdtscTx) GetProcAddress (*hModule, "RdtscTx"); 177 | HltPx = (_HltPx) GetProcAddress (*hModule, "HltPx"); 178 | RdmsrPx = (_RdmsrPx) GetProcAddress (*hModule, "RdmsrPx"); 179 | WrmsrPx = (_WrmsrPx) GetProcAddress (*hModule, "WrmsrPx"); 180 | RdpmcPx = (_RdpmcPx) GetProcAddress (*hModule, "RdpmcPx"); 181 | CpuidPx = (_CpuidPx) GetProcAddress (*hModule, "CpuidPx"); 182 | RdtscPx = (_RdtscPx) GetProcAddress (*hModule, "RdtscPx"); 183 | 184 | // I/O 185 | ReadIoPortByte = (_ReadIoPortByte) GetProcAddress (*hModule, "ReadIoPortByte"); 186 | ReadIoPortWord = (_ReadIoPortWord) GetProcAddress (*hModule, "ReadIoPortWord"); 187 | ReadIoPortDword = (_ReadIoPortDword) GetProcAddress (*hModule, "ReadIoPortDword"); 188 | 189 | ReadIoPortByteEx = (_ReadIoPortByteEx) GetProcAddress (*hModule, "ReadIoPortByteEx"); 190 | ReadIoPortWordEx = (_ReadIoPortWordEx) GetProcAddress (*hModule, "ReadIoPortWordEx"); 191 | ReadIoPortDwordEx = (_ReadIoPortDwordEx) GetProcAddress (*hModule, "ReadIoPortDwordEx"); 192 | 193 | WriteIoPortByte = (_WriteIoPortByte) GetProcAddress (*hModule, "WriteIoPortByte"); 194 | WriteIoPortWord = (_WriteIoPortWord) GetProcAddress (*hModule, "WriteIoPortWord"); 195 | WriteIoPortDword = (_WriteIoPortDword) GetProcAddress (*hModule, "WriteIoPortDword"); 196 | 197 | WriteIoPortByteEx = (_WriteIoPortByteEx) GetProcAddress (*hModule, "WriteIoPortByteEx"); 198 | WriteIoPortWordEx = (_WriteIoPortWordEx) GetProcAddress (*hModule, "WriteIoPortWordEx"); 199 | WriteIoPortDwordEx = (_WriteIoPortDwordEx) GetProcAddress (*hModule, "WriteIoPortDwordEx"); 200 | 201 | // PCI 202 | SetPciMaxBusIndex = (_SetPciMaxBusIndex) GetProcAddress (*hModule, "SetPciMaxBusIndex"); 203 | 204 | ReadPciConfigByte = (_ReadPciConfigByte) GetProcAddress (*hModule, "ReadPciConfigByte"); 205 | ReadPciConfigWord = (_ReadPciConfigWord) GetProcAddress (*hModule, "ReadPciConfigWord"); 206 | ReadPciConfigDword = (_ReadPciConfigDword) GetProcAddress (*hModule, "ReadPciConfigDword"); 207 | 208 | ReadPciConfigByteEx = (_ReadPciConfigByteEx) GetProcAddress (*hModule, "ReadPciConfigByteEx"); 209 | ReadPciConfigWordEx = (_ReadPciConfigWordEx) GetProcAddress (*hModule, "ReadPciConfigWordEx"); 210 | ReadPciConfigDwordEx = (_ReadPciConfigDwordEx) GetProcAddress (*hModule, "ReadPciConfigDwordEx"); 211 | 212 | WritePciConfigByte = (_WritePciConfigByte) GetProcAddress (*hModule, "WritePciConfigByte"); 213 | WritePciConfigWord = (_WritePciConfigWord) GetProcAddress (*hModule, "WritePciConfigWord"); 214 | WritePciConfigDword = (_WritePciConfigDword) GetProcAddress (*hModule, "WritePciConfigDword"); 215 | 216 | WritePciConfigByteEx = (_WritePciConfigByteEx) GetProcAddress (*hModule, "WritePciConfigByteEx"); 217 | WritePciConfigWordEx = (_WritePciConfigWordEx) GetProcAddress (*hModule, "WritePciConfigWordEx"); 218 | WritePciConfigDwordEx = (_WritePciConfigDwordEx)GetProcAddress (*hModule, "WritePciConfigDwordEx"); 219 | 220 | FindPciDeviceById = (_FindPciDeviceById) GetProcAddress (*hModule, "FindPciDeviceById"); 221 | FindPciDeviceByClass = (_FindPciDeviceByClass) GetProcAddress (*hModule, "FindPciDeviceByClass"); 222 | 223 | // Memory 224 | #ifdef _PHYSICAL_MEMORY_SUPPORT 225 | ReadDmiMemory = (_ReadDmiMemory) GetProcAddress (*hModule, "ReadDmiMemory"); 226 | ReadPhysicalMemory = (_ReadPhysicalMemory) GetProcAddress (*hModule, "ReadPhysicalMemory"); 227 | WritePhysicalMemory = (_WritePhysicalMemory) GetProcAddress (*hModule, "WritePhysicalMemory"); 228 | #endif 229 | 230 | //----------------------------------------------------------------------------- 231 | // Check Functions 232 | //----------------------------------------------------------------------------- 233 | if(!( 234 | GetDllStatus 235 | && GetDllVersion 236 | && GetDriverVersion 237 | && GetDriverType 238 | && InitializeOls 239 | && DeinitializeOls 240 | && IsCpuid 241 | && IsMsr 242 | && IsTsc 243 | && Hlt 244 | && HltTx 245 | && HltPx 246 | && Rdmsr 247 | && RdmsrTx 248 | && RdmsrPx 249 | && Wrmsr 250 | && WrmsrTx 251 | && WrmsrPx 252 | && Rdpmc 253 | && RdpmcTx 254 | && RdpmcPx 255 | && Cpuid 256 | && CpuidTx 257 | && CpuidPx 258 | && Rdtsc 259 | && RdtscTx 260 | && RdtscPx 261 | && ReadIoPortByte 262 | && ReadIoPortWord 263 | && ReadIoPortDword 264 | && ReadIoPortByteEx 265 | && ReadIoPortWordEx 266 | && ReadIoPortDwordEx 267 | && WriteIoPortByte 268 | && WriteIoPortWord 269 | && WriteIoPortDword 270 | && WriteIoPortByteEx 271 | && WriteIoPortWordEx 272 | && WriteIoPortDwordEx 273 | && SetPciMaxBusIndex 274 | && ReadPciConfigByte 275 | && ReadPciConfigWord 276 | && ReadPciConfigDword 277 | && ReadPciConfigByteEx 278 | && ReadPciConfigWordEx 279 | && ReadPciConfigDwordEx 280 | && WritePciConfigByte 281 | && WritePciConfigWord 282 | && WritePciConfigDword 283 | && WritePciConfigByteEx 284 | && WritePciConfigWordEx 285 | && WritePciConfigDwordEx 286 | && FindPciDeviceById 287 | && FindPciDeviceByClass 288 | #ifdef _PHYSICAL_MEMORY_SUPPORT 289 | && ReadDmiMemory 290 | && ReadPhysicalMemory 291 | && WritePhysicalMemory 292 | #endif 293 | )) 294 | { 295 | return FALSE; 296 | } 297 | 298 | return InitializeOls(); 299 | } 300 | 301 | //----------------------------------------------------------------------------- 302 | // 303 | // Deinitialize 304 | // 305 | //----------------------------------------------------------------------------- 306 | 307 | BOOL DeinitOpenLibSys(HMODULE *hModule) 308 | { 309 | BOOL result = FALSE; 310 | 311 | if(*hModule == NULL) 312 | { 313 | return TRUE; 314 | } 315 | else 316 | { 317 | DeinitializeOls(); 318 | result = FreeLibrary(*hModule); 319 | *hModule = NULL; 320 | 321 | return result; 322 | } 323 | } 324 | 325 | //----------------------------------------------------------------------------- 326 | // 327 | // Io - Read/Write 328 | // 329 | //----------------------------------------------------------------------------- 330 | 331 | BYTE InPortB(WORD Port) 332 | { 333 | return (BYTE)ReadIoPortByte(Port); 334 | } 335 | 336 | WORD InPortW(WORD Port) 337 | { 338 | return (WORD)ReadIoPortWord(Port); 339 | } 340 | 341 | DWORD InPortDW(WORD Port) 342 | { 343 | return ReadIoPortDword(Port); 344 | } 345 | 346 | void OutPortB(WORD Port, BYTE Data) 347 | { 348 | WriteIoPortByte(Port, Data); 349 | } 350 | 351 | void OutPortW(WORD Port, WORD Data) 352 | { 353 | WriteIoPortWord(Port, Data); 354 | } 355 | 356 | void OutPortDW(WORD Port, DWORD Data) 357 | { 358 | WriteIoPortDword(Port, Data); 359 | } 360 | -------------------------------------------------------------------------------- /TrayS/OlsApiInitDef.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : http://openlibsys.org/ 5 | // License : The modified BSD license 6 | // 7 | // Copyright 2007-2020 OpenLibSys.org. All rights reserved. 8 | //----------------------------------------------------------------------------- 9 | // for WinRing0 3.0.x 10 | 11 | #pragma once 12 | 13 | //----------------------------------------------------------------------------- 14 | // 15 | // Type Defines 16 | // 17 | //----------------------------------------------------------------------------- 18 | 19 | // DLL 20 | typedef DWORD (WINAPI *_GetDllStatus) (); 21 | typedef DWORD (WINAPI *_GetDllVersion) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release); 22 | typedef DWORD (WINAPI *_GetDriverVersion) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release); 23 | typedef DWORD (WINAPI *_GetDriverType) (); 24 | 25 | typedef BOOL (WINAPI *_InitializeOls) (); 26 | typedef VOID (WINAPI *_DeinitializeOls) (); 27 | 28 | // CPU 29 | typedef BOOL (WINAPI *_IsCpuid) (); 30 | typedef BOOL (WINAPI *_IsMsr) (); 31 | typedef BOOL (WINAPI *_IsTsc) (); 32 | 33 | typedef BOOL (WINAPI *_Hlt) (); 34 | typedef DWORD (WINAPI *_Rdmsr) (DWORD index, PDWORD eax, PDWORD edx); 35 | typedef DWORD (WINAPI *_Wrmsr) (DWORD index, DWORD eax, DWORD edx); 36 | typedef DWORD (WINAPI *_Rdpmc) (DWORD index, PDWORD eax, PDWORD edx); 37 | typedef DWORD (WINAPI *_Cpuid) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx); 38 | typedef DWORD (WINAPI *_Rdtsc) (PDWORD eax, PDWORD edx); 39 | 40 | typedef BOOL (WINAPI *_HltTx) (DWORD_PTR threadAffinityMask); 41 | typedef DWORD (WINAPI *_RdmsrTx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask); 42 | typedef DWORD (WINAPI *_WrmsrTx) (DWORD index, DWORD eax, DWORD edx, DWORD_PTR threadAffinityMask); 43 | typedef DWORD (WINAPI *_RdpmcTx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask); 44 | typedef DWORD (WINAPI *_CpuidTx) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx, DWORD_PTR threadAffinityMask); 45 | typedef DWORD (WINAPI *_RdtscTx) (PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask); 46 | 47 | typedef BOOL (WINAPI *_HltPx) (DWORD_PTR processAffinityMask); 48 | typedef DWORD (WINAPI *_RdmsrPx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask); 49 | typedef DWORD (WINAPI *_WrmsrPx) (DWORD index, DWORD eax, DWORD edx, DWORD_PTR processAffinityMask); 50 | typedef DWORD (WINAPI *_RdpmcPx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask); 51 | typedef DWORD (WINAPI *_CpuidPx) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx, DWORD_PTR processAffinityMask); 52 | typedef DWORD (WINAPI *_RdtscPx) (PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask); 53 | 54 | // I/O 55 | typedef BYTE (WINAPI *_ReadIoPortByte) (WORD address); 56 | typedef WORD (WINAPI *_ReadIoPortWord) (WORD address); 57 | typedef DWORD (WINAPI *_ReadIoPortDword) (WORD address); 58 | 59 | typedef BOOL (WINAPI *_ReadIoPortByteEx) (WORD address, PBYTE value); 60 | typedef BOOL (WINAPI *_ReadIoPortWordEx) (WORD address, PWORD value); 61 | typedef BOOL (WINAPI *_ReadIoPortDwordEx) (WORD address, PDWORD value); 62 | 63 | typedef VOID (WINAPI *_WriteIoPortByte) (WORD address, BYTE value); 64 | typedef VOID (WINAPI *_WriteIoPortWord) (WORD address, WORD value); 65 | typedef VOID (WINAPI *_WriteIoPortDword) (WORD address, DWORD value); 66 | 67 | typedef BOOL (WINAPI *_WriteIoPortByteEx) (WORD address, BYTE value); 68 | typedef BOOL (WINAPI *_WriteIoPortWordEx) (WORD address, WORD value); 69 | typedef BOOL (WINAPI *_WriteIoPortDwordEx) (WORD address, DWORD value); 70 | 71 | // PCI 72 | typedef VOID (WINAPI *_SetPciMaxBusIndex) (BYTE max); 73 | 74 | typedef BYTE (WINAPI *_ReadPciConfigByte) (DWORD pciAddress, BYTE regAddress); 75 | typedef WORD (WINAPI *_ReadPciConfigWord) (DWORD pciAddress, BYTE regAddress); 76 | typedef DWORD (WINAPI *_ReadPciConfigDword) (DWORD pciAddress, BYTE regAddress); 77 | 78 | typedef BOOL (WINAPI *_ReadPciConfigByteEx) (DWORD pciAddress, DWORD regAddress, PBYTE value); 79 | typedef BOOL (WINAPI *_ReadPciConfigWordEx) (DWORD pciAddress, DWORD regAddress, PWORD value); 80 | typedef BOOL (WINAPI *_ReadPciConfigDwordEx) (DWORD pciAddress, DWORD regAddress, PDWORD value); 81 | 82 | typedef VOID (WINAPI *_WritePciConfigByte) (DWORD pciAddress, BYTE regAddress, BYTE value); 83 | typedef VOID (WINAPI *_WritePciConfigWord) (DWORD pciAddress, BYTE regAddress, WORD value); 84 | typedef VOID (WINAPI *_WritePciConfigDword) (DWORD pciAddress, BYTE regAddress, DWORD value); 85 | 86 | typedef BOOL (WINAPI *_WritePciConfigByteEx) (DWORD pciAddress, DWORD regAddress, BYTE value); 87 | typedef BOOL (WINAPI *_WritePciConfigWordEx) (DWORD pciAddress, DWORD regAddress, WORD value); 88 | typedef BOOL (WINAPI *_WritePciConfigDwordEx) (DWORD pciAddress, DWORD regAddress, DWORD value); 89 | 90 | typedef DWORD (WINAPI *_FindPciDeviceById) (WORD vendorId, WORD deviceId, BYTE index); 91 | typedef DWORD (WINAPI *_FindPciDeviceByClass) (BYTE baseClass, BYTE subClass, BYTE programIf, BYTE index); 92 | 93 | // Memory 94 | #ifdef _PHYSICAL_MEMORY_SUPPORT 95 | typedef DWORD (WINAPI *_ReadDmiMemory) (PBYTE buffer, DWORD count, DWORD unitSize); 96 | typedef DWORD (WINAPI *_ReadPhysicalMemory) (DWORD_PTR address, PBYTE buffer, DWORD count, DWORD unitSize); 97 | typedef DWORD (WINAPI *_WritePhysicalMemory) (DWORD_PTR address, PBYTE buffer, DWORD count, DWORD unitSize); 98 | #endif 99 | -------------------------------------------------------------------------------- /TrayS/OlsDef.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Author : hiyohiyo 3 | // Mail : hiyohiyo@crystalmark.info 4 | // Web : http://openlibsys.org/ 5 | // License : The modified BSD license 6 | // 7 | // Copyright 2007-2020 OpenLibSys.org. All rights reserved. 8 | //----------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | //----------------------------------------------------------------------------- 13 | // 14 | // DLL Status Code 15 | // 16 | //----------------------------------------------------------------------------- 17 | 18 | #define OLS_DLL_NO_ERROR 0 19 | #define OLS_DLL_UNSUPPORTED_PLATFORM 1 20 | #define OLS_DLL_DRIVER_NOT_LOADED 2 21 | #define OLS_DLL_DRIVER_NOT_FOUND 3 22 | #define OLS_DLL_DRIVER_UNLOADED 4 23 | #define OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK 5 24 | #define OLS_DLL_UNKNOWN_ERROR 9 25 | 26 | //----------------------------------------------------------------------------- 27 | // 28 | // Driver Type 29 | // 30 | //----------------------------------------------------------------------------- 31 | 32 | #define OLS_DRIVER_TYPE_UNKNOWN 0 33 | #define OLS_DRIVER_TYPE_WIN_9X 1 34 | #define OLS_DRIVER_TYPE_WIN_NT 2 35 | #define OLS_DRIVER_TYPE_WIN_NT4 3 // Obsolete 36 | #define OLS_DRIVER_TYPE_WIN_NT_X64 4 37 | #define OLS_DRIVER_TYPE_WIN_NT_IA64 5 // Reseved 38 | 39 | //----------------------------------------------------------------------------- 40 | // 41 | // PCI Error Code 42 | // 43 | //----------------------------------------------------------------------------- 44 | 45 | #define OLS_ERROR_PCI_BUS_NOT_EXIST (0xE0000001L) 46 | #define OLS_ERROR_PCI_NO_DEVICE (0xE0000002L) 47 | #define OLS_ERROR_PCI_WRITE_CONFIG (0xE0000003L) 48 | #define OLS_ERROR_PCI_READ_CONFIG (0xE0000004L) 49 | 50 | //----------------------------------------------------------------------------- 51 | // 52 | // Support Macros 53 | // 54 | //----------------------------------------------------------------------------- 55 | 56 | // Bus Number, Device Number and Function Number to PCI Device Address 57 | #define PciBusDevFunc(Bus, Dev, Func) ((Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7) 58 | // PCI Device Address to Bus Number 59 | #define PciGetBus(address) ((address>>8) & 0xFF) 60 | // PCI Device Address to Device Number 61 | #define PciGetDev(address) ((address>>3) & 0x1F) 62 | // PCI Device Address to Function Number 63 | #define PciGetFunc(address) (address&7) 64 | -------------------------------------------------------------------------------- /TrayS/OpenHardwareMonitorApi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "OpenHardwareMonitorGlobal.h" 4 | #include 5 | #include 6 | 7 | namespace OpenHardwareMonitorApi 8 | { 9 | class IOpenHardwareMonitor 10 | { 11 | public: 12 | virtual void GetHardwareInfo() = 0; //获取一次硬件信息 13 | virtual float CpuTemperature() = 0; //返回获取到的CPU温度 14 | virtual float GpuTemperature() = 0; //返回获取到的GPU温度 15 | virtual float HDDTemperature() = 0; //返回获取到的硬盘温度 16 | virtual float MainboardTemperature() = 0; //返回获取到的主板温度 17 | virtual float GpuUsage() = 0; //返回获取到的GPU利用率 18 | virtual const std::map& AllHDDTemperature() = 0; //返回所有硬盘的温度。map的key是硬盘的名称,value是硬盘的温度 19 | virtual const std::map& AllCpuTemperature() = 0; //返回所有CPU(核心)的温度。map的key是CPU的名称,value是硬盘的温度 20 | virtual const std::map& AllHDDUsage() = 0; //返回所有硬盘的使用率 21 | 22 | virtual void SetCpuEnable(bool enable) = 0; 23 | virtual void SetGpuEnable(bool enable) = 0; 24 | virtual void SetHddEnable(bool enable) = 0; 25 | virtual void SetMainboardEnable(bool enable) = 0; 26 | }; 27 | 28 | OPENHARDWAREMONITOR_API std::shared_ptr CreateInstance(); 29 | OPENHARDWAREMONITOR_API std::wstring GetErrorMessage(); 30 | } 31 | -------------------------------------------------------------------------------- /TrayS/OpenHardwareMonitorApi.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/OpenHardwareMonitorApi.lib -------------------------------------------------------------------------------- /TrayS/OpenHardwareMonitorGlobal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef OPENHARDWAREMONITOR_EXPORTS 4 | #define OPENHARDWAREMONITOR_API __declspec(dllexport) 5 | #else 6 | #define OPENHARDWAREMONITOR_API __declspec(dllimport) 7 | #endif 8 | -------------------------------------------------------------------------------- /TrayS/TrayS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "resource.h" 3 | #include "function.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | //WINRING0 14 | #include "OlsDef.h" 15 | #include "OlsApiInit.h" 16 | 17 | //ATIGPU 18 | #include "adl_sdk.h" 19 | 20 | #define MSG_APPBAR_MSGID WM_USER+15//全屏幕消息 21 | #define WM_IAWENTRAY WM_USER+8//通知栏消息 22 | #define WM_TRAYS WM_USER+8888//打开设置消息 23 | #define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) 24 | #define KEYUP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) 25 | /* 26 | //窗口图标结构 27 | typedef HANDLE HTHUMBNAIL; 28 | typedef HTHUMBNAIL* PHTHUMBNAIL; 29 | typedef struct _WINDOW_INFO 30 | { 31 | HICON hIcon;//图标 32 | // TCHAR szFileName[MAX_PATH];//文件名 33 | TCHAR szWindowTitle[MAX_PATH];//窗口标题 34 | //非显示项目 35 | // TCHAR szFilePath[MAX_PATH];//文件路径 36 | HWND hWnd;//窗口句柄 37 | BOOL bForegorund;//是否焦点 38 | BOOL bIconic;//是否最小化 39 | BOOL bTopMost;//是否置顶 40 | BOOL bHide; 41 | // bool bDesktopItem;//「デスクトップ」である 42 | // bool bCancelItem;//「キャンセル」である 43 | BOOL bUWPApp;//UWPApp 44 | HWND hUICoreWnd;//UWPApp的Windows.UI.Core.CoreWindow子窗口 45 | // HTHUMBNAIL hThumbnail; 46 | }WINDOW_INFO, * LPWINDOW_INFO; 47 | int g_iWindowCount = 0; 48 | LPWINDOW_INFO g_WindowInfo; 49 | HANDLE g_hHeapWindowInfo; 50 | HWND hTaskIcon=NULL; 51 | HWND hThumbnail = NULL; 52 | HTHUMBNAIL hThumb=NULL; 53 | HWND hThumbWnd = NULL; 54 | HWND hThumbUWP = NULL; 55 | int iTaskIconXY; 56 | int iTaskIconWidth=48; 57 | HICON hThumbIcon[14]; 58 | ULONG_PTR ulToken; 59 | int IconSize; 60 | HRESULT(WINAPI* pDwmRegisterThumbnail)(HWND, HWND, PHTHUMBNAIL); 61 | HRESULT(WINAPI* pDwmUnregisterThumbnail)(HTHUMBNAIL); 62 | HRESULT(WINAPI* pDwmUpdateThumbnailProperties)(HTHUMBNAIL, const DWM_THUMBNAIL_PROPERTIES*); 63 | HRESULT(WINAPI* pDwmQueryThumbnailSourceSize)(HTHUMBNAIL, PSIZE); 64 | void AddItem(LPWINDOW_INFO lpWindowInfo) 65 | { 66 | bool bFirstTime = g_iWindowCount == 0; 67 | WINDOW_INFO* pTmp = NULL; 68 | if (bFirstTime)pTmp = (WINDOW_INFO*)HeapAlloc(g_hHeapWindowInfo, HEAP_ZERO_MEMORY, (++g_iWindowCount) * sizeof(WINDOW_INFO)); 69 | else pTmp = (WINDOW_INFO*)HeapReAlloc(g_hHeapWindowInfo, HEAP_ZERO_MEMORY, g_WindowInfo, (++g_iWindowCount) * sizeof(WINDOW_INFO)); 70 | g_WindowInfo = pTmp; 71 | g_WindowInfo[g_iWindowCount - 1] = *lpWindowInfo; 72 | return; 73 | } 74 | */ 75 | /////////////////////////////////////////////自定义网卡数据结构 76 | typedef struct _TRAFFIC 77 | { 78 | ULONG64 in_bytes; 79 | ULONG64 out_bytes; 80 | ULONG64 in_byte; 81 | ULONG64 out_byte; 82 | PWCHAR FriendlyName; 83 | PCHAR AdapterName; 84 | WCHAR IP4[16]; 85 | }TRAFFIC; 86 | ////////////////////////////////////////////进程的内存使用数据结构 87 | typedef struct _PROCESSMEMORYUSAGE 88 | { 89 | WCHAR szExe[37]; 90 | DWORD dwProcessID; 91 | SIZE_T dwMemUsage; 92 | }PROCESSMEMORYUSAGE; 93 | ///////////////////////////////////////////进程的CPU使用率数据结构 94 | typedef struct _PROCESSCPUUSAGE 95 | { 96 | WCHAR szExe[37]; 97 | DWORD dwProcessID; 98 | float fCpuUsage; 99 | }PROCESSCPUUSAGE; 100 | //////////////////////////////////////////进程使用时间 101 | typedef struct _PROCESSTIME 102 | { 103 | DWORD dwProcessID; 104 | LARGE_INTEGER g_slgProcessTimeOld; 105 | }PROCESSTIME; 106 | DWORD dNumProcessor = 0;//CPU数量 107 | HINSTANCE hInst;// 当前实例 108 | HWND hMain;//主窗口句柄 109 | HWND hSetting;//设置窗口句柄 110 | HWND hTaskBar;//工具窗口句柄 111 | HWND hTaskTips;//提示窗口句柄 112 | HWND hTime;//秒窗口 113 | HWND hPrice;//行情窗口 114 | //HWND hForeground; 115 | HWND hTray=NULL;//系统主任务栏窗口句柄 116 | HWND hTaskWnd;//系统主任务列表窗口句柄 117 | HWND hReBarWnd=NULL;//系统主任务工具窗口句柄 118 | HWND hTaskListWnd = NULL; 119 | HWND hWin11UI = NULL; 120 | HWND hStartWnd = NULL; 121 | HWND hTrayNotifyWnd = NULL; 122 | HWND hTrayClockWnd = NULL; 123 | HICON iMain;//窗口图标 124 | HANDLE hMutex;//只能运行一个程序 125 | const WCHAR szAppName[] = L"TrayS";//程序名 126 | const WCHAR szNetCpl[] = L" cncpa.cpl";//打开网络设置 127 | const WCHAR szTaskmgr[] = L" oTaskmgr";//打开任务管理器 128 | const WCHAR szPerfmon[] = L" operfmon.exe /res";//打开资源监测器 129 | const WCHAR szOpenPerfDisk[] = L" olodctr /E:PerfDisk";//修复磁盘计数器 130 | const WCHAR szCompmgmt[] = L" ocompmgmt.msc";//计算机管理 131 | const WCHAR szPowerCpl[] = L" cpowercfg.cpl";//打开电源设置 132 | const WCHAR szTimeDateCpl[] = L" ctimedate.cpl";//打开时间日期 133 | const WCHAR szTraySave[] = L"TrayS.dat"; 134 | //PIP_ADAPTER_INFO ipinfo; 135 | typedef struct _TRAYDATA 136 | { 137 | BOOL bExit;//是否退出 138 | ULONG64 m_last_in_bytes;//总上一秒下载速度 139 | ULONG64 m_last_out_bytes;//总上一秒上传速度 140 | ULONG64 s_in_byte;//总下载速度 141 | ULONG64 s_out_byte;//总上传速度 142 | float fLastPrice1,fLastPrice2, fOpenPrice1, fOpenPrice2, fLastPrice3, fLastPrice4, fOpenPrice3, fOpenPrice4;//行情当前与昨天 143 | WCHAR szLastPrice1[16];//行情数值字符串 144 | WCHAR szLastPrice2[16];//行情数值字符串 145 | WCHAR szLastPrice3[16];//行情数值字符串 146 | WCHAR szLastPrice4[16];//行情数值字符串 147 | int iPriceUpDown[4];//行情升降提醒 148 | DWORD iHddTemperature;//硬盘温度 149 | DWORD iTemperature1;//CPU温度 150 | DWORD iTemperature2;//GPU温度 151 | double diskreadbyte; 152 | double diskwritebyte; 153 | DWORD disktime; 154 | /* 155 | int rNum=60; 156 | DWORD s_in_bytes[60];//一分钟内的下载数据 157 | DWORD s_out_bytes[60];//一分钟内的上传数据 158 | int iBytes = 0;//当前数据指针 159 | */ 160 | }TRAYDATA; 161 | TRAYDATA* TrayData; 162 | PMIB_IFTABLE mi;//网速结构 163 | PIP_ADAPTER_ADDRESSES piaa;//网卡结构 164 | PMIB_IF_TABLE2 mit2;//网速结构 165 | TRAFFIC* traffic;//每个网卡速度 166 | int nTraffic = 0;//有几张网卡 167 | 168 | int mWidth;//工具窗口宽度 169 | int mHeight;//工具窗口竖排高度 170 | int wSpace;//模块间隔 171 | int iDPI = 96;//当前DPI 172 | BOOL VTray = FALSE;//竖的任务栏 173 | BOOL bRealClose = FALSE; 174 | BOOL bSetting = FALSE; 175 | /////////////////////////////////////////////////获取数据线程 176 | DWORD WINAPI MainThreadProc(PVOID pParam); 177 | DWORD WINAPI GetDataThreadProc(PVOID pParam); 178 | //HANDLE hMainThread = NULL; 179 | HANDLE hGetDataThread = NULL; 180 | HANDLE hPriceThread = NULL; 181 | HANDLE hMap = NULL; 182 | BOOL bShadow = FALSE;//显示阴影文字 183 | COLORREF bColor = 0x181818;//阴影颜色 184 | DWORD bThemeMode = 0;//颜色模式 185 | 186 | 187 | RTL_OSVERSIONINFOW rovi;//WIN系统版本号 188 | ///////////////////////////////////////////是否在全屏幕 189 | BOOL bFullScreen = FALSE; 190 | 191 | typedef struct _TRAYSAVE//默认参数 192 | { 193 | DWORD Ver;//数据版本 194 | ACCENT_STATE aMode[2];//任务栏透明模式 195 | DWORD dAlphaColor[2];//任务栏颜色 196 | DWORD bAlpha[2];// 197 | DWORD dNumValues[12]; 198 | BOOL bSound;//声音警告 199 | int iPos;//任务栏图标位置 200 | int iUnit;//流量单位 201 | BOOL bTrayIcon;//显示托盘图标 202 | BOOL bMonitor;//显示监控主窗口 203 | BOOL bMonitorLeft;//左上显示窗口 204 | BOOL bMonitorFloat;//浮动显示窗口 205 | BOOL bMonitorTransparent;//鼠标穿透//透明显示窗口 206 | BOOL bMonitorTraffic;//显示流量 207 | BOOL bMonitorTemperature;//显示温度 208 | BOOL bMonitorUsage;//显示占用 209 | BOOL bMonitorPDH;//高精度占用 210 | int iMonitorSimple;//简约显示 211 | COLORREF cMonitorColor[8];//颜色 212 | POINT dMonitorPoint;//浮动位置 213 | CHAR AdpterName[39];//网卡名 214 | DWORD FlushTime;//刷新时间 215 | BOOL bMonitorTips;//显示提示窗口 216 | LOGFONT TraybarFont;//监控窗口字体 217 | int TraybarFontSize;//监控字体大小 218 | LOGFONT TipsFont;//提示窗口字体 219 | int TipsFontSize;//提示窗口大小 220 | WCHAR szTrafficOut[8];//流量上传显示的文字 221 | WCHAR szTrafficIn[8];//流量正传显示的文字 222 | WCHAR szTemperatureCPU[8];//CPU温度显示的文字 223 | WCHAR szTemperatureCPUUnit[4];//CPU温度显示的单位 224 | WCHAR szTemperatureGPU[8];//GPU温度显示的文字 225 | WCHAR szTemperatureGPUUnit[4];//GPU温度显示的单位 226 | WCHAR szUsageCPU[8];//CPU占用显示的文字 227 | WCHAR szUsageCPUUnit[4];//CPU占用显示的单位 228 | WCHAR szUsageMEM[8];//内存占用显示的文字 229 | WCHAR szUsageMEMUnit[4];//内存占用显示的单位 230 | BOOL bMonitorFuse;//背景融合 231 | BOOL bMonitorTrafficUpDown;//上传下载位置调换 232 | BOOL bMonitorFloatVRow;//浮动竖排 233 | BOOL bMonitorTime;//显示时间 234 | BOOL bSecond;//在系统原来显示秒 235 | BOOL bNear;//靠近图标 236 | BOOL bMonitorTopmost;//任务栏窗口保持置顶 237 | BOOL bMonitorDisk;//显示硬盘 238 | DWORD dNumValues2[9]; 239 | WCHAR szDiskReadSec[8];//硬盘读取显示的文字 240 | WCHAR szDiskWriteSec[8];//硬盘写入显示的文字 241 | WCHAR szDiskName[8];//硬盘名称 242 | WCHAR szDisk;//盘符 243 | BOOL bMonitorPrice;//显示行情 244 | float HighRemind[12];//超过价格提醒 245 | float LowRemind[12];//低过价格提醒 246 | BOOL bCheckHighRemind[12]; 247 | BOOL bCheckLowRemind[12]; 248 | WCHAR szPriceName1[64]; 249 | WCHAR szPriceName2[64]; 250 | WCHAR szPriceName3[64]; 251 | WCHAR szPriceName4[64]; 252 | int iPriceInterface[4]; 253 | WCHAR szOKXWeb[32]; 254 | BOOL bTwoFour; 255 | COLORREF cPriceColor[4];//行情颜色 256 | BOOL bTrayStyle;//任务栏风格开关 257 | }TRAYSAVE; 258 | TRAYSAVE TraySave = { 259 | 116, 260 | { ACCENT_ENABLE_TRANSPARENTGRADIENT,ACCENT_ENABLE_BLURBEHIND } , 261 | { 0x00111111,0x66000000 },{ 255,255 } , 262 | { 10 * 1024 * 1024,64 * 1024 * 1024,66,96,81,96,61,88,98 * 1048576,88,0,0 } , 263 | FALSE, 264 | 1, 265 | 2, 266 | TRUE, 267 | TRUE, 268 | FALSE, 269 | FALSE, 270 | FALSE, 271 | TRUE, 272 | FALSE, 273 | TRUE, 274 | FALSE, 275 | 0, 276 | { RGB(0,0,1),RGB(128,128,128),RGB(255,255,255),RGB(255,0,0),RGB(0,168,0),RGB(255,128,0),RGB(255,0,0),RGB(0,0,0) }, 277 | { 666,666 }, 278 | {0}, 279 | 11, 280 | TRUE, 281 | {-14,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,L"微软雅黑"} , 282 | -14, 283 | {-14,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,L"微软雅黑"} , 284 | -14, 285 | L"上传:", 286 | L"下载:", 287 | L"CPU:", 288 | L"℃", 289 | L"GPU:", 290 | L"℃", 291 | L"CPU:" , 292 | L"%", 293 | L"内存:", 294 | L"%", 295 | TRUE, 296 | TRUE, 297 | FALSE, 298 | TRUE, 299 | FALSE, 300 | FALSE, 301 | FALSE, 302 | FALSE, 303 | {18,111,88,0,0,0,0,0,0}, 304 | L"读取:", 305 | L"写入:", 306 | L"硬盘:", 307 | 0, 308 | FALSE, 309 | {0}, 310 | {0}, 311 | {0}, 312 | {0}, 313 | L"sh000001", 314 | L"sz399001", 315 | L"BTC-USDT-SWAP", 316 | L"ETH-USDT-SWAP", 317 | {0,0,1,1}, 318 | L"www.okx.com", 319 | FALSE, 320 | {RGB(0, 168, 0), RGB(255, 0, 0),RGB(0,255,128),RGB(255,128,0)}, 321 | TRUE 322 | }; 323 | int wTraffic;//流量宽度 324 | int wTemperature;//温度宽度 325 | int wUsage;//利用率宽度 326 | int wDisk;//硬盘流量宽度 327 | int wTime;//时间宽度 328 | int wPrice;//行情宽度 329 | int wHeight;//监控字符高度 330 | POINT pTime;//秒位置 331 | HFONT hFont;//监控窗口字体 332 | BOOL bSettingInit=FALSE;//设置在初始化 333 | int wTipsHeight;//提示字符高度 334 | BOOL inTipsProcessX = FALSE;//是否在X按键中 335 | NOTIFYICONDATA nid = { 0 };//通知栏传入结构 336 | //BOOL bErasebkgnd = TRUE; 337 | int iProject = -1; 338 | int iWindowMode=FALSE; 339 | //BOOL bAccentNormal = FALSE; 340 | MEMORYSTATUSEX MemoryStatusEx;/////////////////虚拟内存/内存大小 341 | BOOL bTaskBarMoveing = FALSE;///////////////////窗口是否正在移动中 342 | PROCESSMEMORYUSAGE pmu[6]; 343 | PROCESSMEMORYUSAGE *ppmu[6]; 344 | PROCESSCPUUSAGE pcu[6]; 345 | PROCESSCPUUSAGE *ppcu[6]; 346 | int nProcess; 347 | PROCESSTIME * pProcessTime; 348 | 349 | //BOOL bTaskOther = FALSE; 350 | 351 | ////////////////////////////////////////LibHardware库 352 | HMODULE hOHMA = NULL; 353 | typedef void(WINAPI* pfnGetTemperature)(float* fCpu, float* fGpu, float* fMain, float* fHdd,int iHdd, float* fCpuPackge); 354 | pfnGetTemperature GetTemperature; 355 | 356 | HMODULE hPDH = NULL; 357 | ////////////////////////////////////////////////查找隐藏试最大化窗口 358 | HMODULE hDwmapi=NULL; 359 | typedef BOOL(WINAPI* pfnDwmGetWindowAttribute)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); 360 | pfnDwmGetWindowAttribute pDwmGetWindowAttribute; 361 | 362 | ////////////////////////////////////////////////获取网速 363 | HMODULE hIphlpapi=NULL; 364 | typedef ULONG(WINAPI* pfnGetAdaptersAddresses)(_In_ ULONG Family, _In_ ULONG Flags, _Reserved_ PVOID Reserved, _Out_writes_bytes_opt_(*SizePointer) PIP_ADAPTER_ADDRESSES AdapterAddresses, _Inout_ PULONG SizePointer); 365 | typedef DWORD(WINAPI* pfnGetIfTable)(_Out_writes_bytes_opt_(*pdwSize) PMIB_IFTABLE pIfTable, _Inout_ PULONG pdwSize, _In_ BOOL bOrder); 366 | pfnGetAdaptersAddresses GetAdaptersAddressesT; 367 | pfnGetIfTable GetIfTableT; 368 | typedef DWORD(WINAPI* pfnGetIfTable2)(PMIB_IF_TABLE2* Table); 369 | pfnGetIfTable2 getIfTable2; 370 | typedef VOID (WINAPI* pfnFreeMibTable)(PVOID Memory); 371 | pfnFreeMibTable freeMibTable; 372 | HMODULE hOleacc=NULL; 373 | typedef ULONG(WINAPI* pfnAccessibleObjectFromWindow)(_In_ HWND hwnd, _In_ DWORD dwId, _In_ REFIID riid, _Outptr_ void** ppvObject); 374 | typedef ULONG(WINAPI* pfnAccessibleChildren)(_In_ IAccessible* paccContainer, _In_ LONG iChildStart, _In_ LONG cChildren, _Out_writes_(cChildren) VARIANT* rgvarChildren, _Out_ LONG* pcObtained); 375 | pfnAccessibleObjectFromWindow AccessibleObjectFromWindowT; 376 | pfnAccessibleChildren AccessibleChildrenT; 377 | 378 | /////////////////////////////////////////////////CPU温度 379 | BOOL bRing0=NULL; 380 | HMODULE m_hOpenLibSys = NULL; 381 | BOOL bIntel; 382 | ////////////////////////////////////////////////ATI显卡温度 383 | // Memory allocation function 384 | void* __stdcall ADL_Main_Memory_Alloc(int iSize) 385 | { 386 | void* lpBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iSize); 387 | return lpBuffer; 388 | } 389 | // Optional Memory de-allocation function 390 | void __stdcall ADL_Main_Memory_Free(void** lpBuffer) 391 | { 392 | if (NULL != *lpBuffer) 393 | { 394 | HeapFree(GetProcessHeap(), 0, *lpBuffer); 395 | *lpBuffer = NULL; 396 | } 397 | } 398 | // Definitions of the used function pointers. Add more if you use other ADL APIs 399 | typedef int(*ADL_MAIN_CONTROL_CREATE)(ADL_MAIN_MALLOC_CALLBACK, int); 400 | typedef int(*ADL_MAIN_CONTROL_DESTROY)(); 401 | typedef int(*ADL_OVERDRIVE5_TEMPERATURE_GET) (int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature); 402 | ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; 403 | ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; 404 | ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get; 405 | ADLTemperature adlTemperature = { 0 }; 406 | HMODULE hATIDLL=NULL; 407 | ///////////////////////////////////////////////NVIDIA显卡温度 408 | // 接口ID值 409 | #define ID_NvAPI_Initialize 0x0150E828 410 | #define ID_NvAPI_GPU_GetFullName 0xCEEE8E9F 411 | #define ID_NvAPI_GPU_GetThermalSettings 0xE3640A56 412 | #define ID_NvAPI_EnumNvidiaDisplayHandle 0x9ABDD40D 413 | #define ID_NvAPI_GetPhysicalGPUsFromDisplay 0x34EF9506 414 | #define ID_NvAPI_EnumPhysicalGPUs 0xE5AC921F 415 | #define ID_NvAPI_GPU_GetTachReading 0x5F608315 416 | #define ID_NvAPI_GPU_GetAllClocks 0x1BD69F49 417 | #define ID_NvAPI_GPU_GetPStates 0x60DED2ED 418 | #define ID_NvAPI_GPU_GetUsages 0x189A1FDF 419 | #define ID_NvAPI_GPU_GetCoolerSettings 0xDA141340 420 | #define ID_NvAPI_GPU_SetCoolerLevels 0x891FA0AE 421 | #define ID_NvAPI_GPU_GetMemoryInfo 0x774AA982 422 | #define ID_NvAPI_GetDisplayDriverVersion 0xF951A4D1 423 | #define ID_NvAPI_GetInterfaceVersionString 0x01053FA5 424 | #define ID_NvAPI_GPU_GetPCIIdentifiers 0x2DDFB66E 425 | #define NVAPI_MAX_THERMAL_SENSORS_PER_GPU 3 426 | #define NVAPI_MAX_PHYSICAL_GPUS 64 427 | #define NvU32 unsigned long 428 | #define NvS32 signed int 429 | #define MAKE_NVAPI_VERSION(typeName,ver)(NvU32)(sizeof(typeName) | ((ver) << 16)) 430 | typedef int NvPhysicalGpuHandle; 431 | typedef int NvDisplayHandle; 432 | #define MAX_THERMAL_SENSORS_PER_GPU 3 433 | typedef enum _NV_THERMAL_CONTROLLER 434 | { 435 | NVAPI_THERMAL_CONTROLLER_NONE = 0, 436 | NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL, 437 | NVAPI_THERMAL_CONTROLLER_ADM1032, 438 | NVAPI_THERMAL_CONTROLLER_MAX6649, 439 | NVAPI_THERMAL_CONTROLLER_MAX1617, 440 | NVAPI_THERMAL_CONTROLLER_LM99, 441 | NVAPI_THERMAL_CONTROLLER_LM89, 442 | NVAPI_THERMAL_CONTROLLER_LM64, 443 | NVAPI_THERMAL_CONTROLLER_ADT7473, 444 | NVAPI_THERMAL_CONTROLLER_SBMAX6649, 445 | NVAPI_THERMAL_CONTROLLER_VBIOSEVT, 446 | NVAPI_THERMAL_CONTROLLER_OS, 447 | NVAPI_THERMAL_CONTROLLER_UNKNOWN = -1, 448 | } NV_THERMAL_CONTROLLER; 449 | typedef enum _NV_THERMAL_TARGET 450 | { 451 | NVAPI_THERMAL_TARGET_NONE = 0, 452 | NVAPI_THERMAL_TARGET_GPU = 1, //!< GPU core temperature requires NvPhysicalGpuHandle 453 | NVAPI_THERMAL_TARGET_MEMORY = 2, //!< GPU memory temperature requires NvPhysicalGpuHandle 454 | NVAPI_THERMAL_TARGET_POWER_SUPPLY = 4, //!< GPU power supply temperature requires NvPhysicalGpuHandle 455 | NVAPI_THERMAL_TARGET_BOARD = 8, //!< GPU board ambient temperature requires NvPhysicalGpuHandle 456 | NVAPI_THERMAL_TARGET_VCD_BOARD = 9, //!< Visual Computing Device Board temperature requires NvVisualComputingDeviceHandle 457 | NVAPI_THERMAL_TARGET_VCD_INLET = 10, //!< Visual Computing Device Inlet temperature requires NvVisualComputingDeviceHandle 458 | NVAPI_THERMAL_TARGET_VCD_OUTLET = 11, //!< Visual Computing Device Outlet temperature requires NvVisualComputingDeviceHandle 459 | 460 | NVAPI_THERMAL_TARGET_ALL = 15, 461 | NVAPI_THERMAL_TARGET_UNKNOWN = -1, 462 | } NV_THERMAL_TARGET; 463 | typedef struct _NV_GPU_THERMAL_SETTINGS_V1 464 | { 465 | NvU32 version; //!< structure version 466 | NvU32 count; //!< number of associated thermal sensors 467 | struct 468 | { 469 | NV_THERMAL_CONTROLLER controller; //!< internal, ADM1032, MAX6649... 470 | NvU32 defaultMinTemp; //!< The min default temperature value of the thermal sensor in degree Celsius 471 | NvU32 defaultMaxTemp; //!< The max default temperature value of the thermal sensor in degree Celsius 472 | NvU32 currentTemp; //!< The current temperature value of the thermal sensor in degree Celsius 473 | NV_THERMAL_TARGET target; //!< Thermal sensor targeted @ GPU, memory, chipset, powersupply, Visual Computing Device, etc. 474 | } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU]; 475 | 476 | } NV_GPU_THERMAL_SETTINGS_V1; 477 | typedef struct _NV_GPU_THERMAL_SETTINGS_V2 478 | { 479 | NvU32 version; //!< structure version 480 | NvU32 count; //!< number of associated thermal sensors 481 | struct 482 | { 483 | NV_THERMAL_CONTROLLER controller; //!< internal, ADM1032, MAX6649... 484 | NvS32 defaultMinTemp; //!< Minimum default temperature value of the thermal sensor in degree Celsius 485 | NvS32 defaultMaxTemp; //!< Maximum default temperature value of the thermal sensor in degree Celsius 486 | NvS32 currentTemp; //!< Current temperature value of the thermal sensor in degree Celsius 487 | NV_THERMAL_TARGET target; //!< Thermal sensor targeted - GPU, memory, chipset, powersupply, Visual Computing Device, etc 488 | } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU]; 489 | 490 | } NV_GPU_THERMAL_SETTINGS_V2; 491 | typedef NV_GPU_THERMAL_SETTINGS_V2 NV_GPU_THERMAL_SETTINGS; 492 | #define NV_GPU_THERMAL_SETTINGS_VER_1 MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS_V1,1) 493 | #define NV_GPU_THERMAL_SETTINGS_VER_2 MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS_V2,2) 494 | #define NV_GPU_THERMAL_SETTINGS_VER NV_GPU_THERMAL_SETTINGS_VER_2 495 | typedef UINT32 NvAPI_Status; 496 | typedef void* (*NvAPI_QueryInterface_t)(UINT32 offset); 497 | typedef NvAPI_Status(__cdecl *NvAPI_Initialize_t)(void); 498 | typedef NvAPI_Status(*NvAPI_EnumPhysicalGPUs_t)(NvPhysicalGpuHandle *pGpuHandles, int *pGpuCount); 499 | typedef NvAPI_Status(__cdecl *NvAPI_GPU_GetThermalSettings_t)(const NvPhysicalGpuHandle gpuHandle, int sensorIndex, NV_GPU_THERMAL_SETTINGS *pnvGPUThermalSettings); 500 | NvAPI_QueryInterface_t NvAPI_QueryInterface; 501 | NvAPI_GPU_GetThermalSettings_t NvAPI_GPU_GetThermalSettings; 502 | HMODULE hNVDLL = NULL; 503 | NvPhysicalGpuHandle hPhysicalGpu[4]; 504 | /////////////////////////////////////////////////////CPU频率 505 | typedef struct _PROCESSOR_POWER_INFORMATION { 506 | ULONG Number; 507 | ULONG MaxMhz; 508 | ULONG CurrentMhz; 509 | ULONG MhzLimit; 510 | ULONG MaxIdleState; 511 | ULONG CurrentIdleState; 512 | } PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; 513 | 514 | 515 | INT_PTR CALLBACK ColorButtonProc(HWND, UINT, WPARAM, LPARAM);//颜色按钮子类化过程 516 | WNDPROC oldColorButtonPoroc;//原来的颜色按钮控件过程 517 | void AdjustWindowPos();//////////////////////////////////////////调整窗口大小位置 518 | BOOL InitInstance(HINSTANCE, int);//////////////////////////////////////初始化 519 | INT_PTR CALLBACK MainProc(HWND, UINT, WPARAM, LPARAM);//主窗口过程 520 | INT_PTR CALLBACK SettingProc(HWND, UINT, WPARAM, LPARAM);//设置窗口过程 521 | INT_PTR CALLBACK TaskBarProc(HWND, UINT, WPARAM, LPARAM);//任务栏监控窗口过程 522 | INT_PTR CALLBACK TaskTipsProc(HWND, UINT, WPARAM, LPARAM);//提示窗口过程 523 | INT_PTR CALLBACK TimeProc(HWND, UINT, WPARAM, LPARAM);//秒窗口过程 524 | INT_PTR CALLBACK PriceProc(HWND, UINT, WPARAM, LPARAM);//行情窗口过程 525 | void SetTaskBarPos(HWND, HWND, HWND, HWND, BOOL);//设置任务栏图标位置 526 | int DrawShadowText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);//绘制阴影文字 527 | void FreeTemperatureDLL();// 528 | void LoadTemperatureDLL();//加载DLL 529 | void SetWH();//计算监控窗口高宽 530 | int GetProcessMemUsage();//获取内存使用大小 531 | void GetProcessCpuUsage();//获取进程CPU使用率 532 | void GetTrafficStr(WCHAR* sz, ULONG64 uByte, BOOL bBit,int iUnit=0);//流量转字符串 533 | void ShowSelectMenu(BOOL bNet);//显示网卡/硬盘菜单 534 | void DrawPrice(HDC mdc, LPRECT crc, float fLast, float fOpen, WCHAR* szLast, int iPriceUpDown);//绘制行情 -------------------------------------------------------------------------------- /TrayS/TrayS.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/TrayS.ico -------------------------------------------------------------------------------- /TrayS/TrayS.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/TrayS.rc -------------------------------------------------------------------------------- /TrayS/TrayS.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {6E7FFDF7-FC64-4A7C-9554-8A8677D81FE3} 24 | Win32Proj 25 | TrayS 26 | 10.0.22000.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v141_xp 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | 88 | 89 | Level3 90 | Disabled 91 | true 92 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 93 | true 94 | 95 | 96 | Windows 97 | true 98 | 99 | 100 | 101 | 102 | 103 | 104 | Level3 105 | Disabled 106 | true 107 | _DEBUG;_WINDOWS;%(PreprocessorDefinitions) 108 | true 109 | 110 | 111 | Windows 112 | true 113 | RequireAdministrator 114 | OpenHardwareMonitorApi.lib;ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 115 | 116 | 117 | PerMonitorHighDPIAware 118 | 119 | 120 | 121 | 122 | 123 | 124 | Level3 125 | MinSpace 126 | true 127 | true 128 | 129 | 130 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 131 | false 132 | Size 133 | MultiThreadedDLL 134 | false 135 | /Gs32768 %(AdditionalOptions) 136 | false 137 | false 138 | false 139 | false 140 | 141 | Classic 142 | true 143 | 144 | 145 | Windows 146 | true 147 | true 148 | true 149 | RequireAdministrator 150 | OLEAUT32.dll;ole32.dll; 151 | true 152 | ucrt.lib;%(AdditionalDependencies)psapi.lib 153 | .rdata=.text 154 | Default 155 | 5.01 156 | false 157 | 158 | 159 | 160 | 161 | PerMonitorHighDPIAware 162 | 163 | 164 | 165 | 166 | 167 | 168 | TurnOffAllWarnings 169 | MinSpace 170 | true 171 | true 172 | 173 | 174 | NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 175 | false 176 | Size 177 | MultiThreadedDLL 178 | Default 179 | false 180 | false 181 | 182 | 183 | 184 | false 185 | false 186 | Column 187 | /Gs32768 %(AdditionalOptions) 188 | 189 | 190 | 191 | 192 | Windows 193 | true 194 | true 195 | false 196 | RequireAdministrator 197 | 198 | 199 | 200 | 201 | %(AdditionalDependencies) 202 | user32.dll;gdi32.dll;advapi32.dll;OLEAUT32.dll;ole32.dll; 203 | 204 | 205 | .rdata=.text 206 | 207 | 208 | 209 | 210 | Default 211 | 212 | 213 | 5.01 214 | true 215 | 216 | 217 | PerMonitorHighDPIAware 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | -------------------------------------------------------------------------------- /TrayS/TrayS.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;hh;hpp;hxx;hm;inl;inc;ipp;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;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 头文件 20 | 21 | 22 | 头文件 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 头文件 41 | 42 | 43 | 44 | 45 | 源文件 46 | 47 | 48 | 头文件 49 | 50 | 51 | 52 | 53 | 资源文件 54 | 55 | 56 | 57 | 58 | 资源文件 59 | 60 | 61 | 资源文件 62 | 63 | 64 | 资源文件 65 | 66 | 67 | 资源文件 68 | 69 | 70 | 资源文件 71 | 72 | 73 | 资源文件 74 | 75 | 76 | 资源文件 77 | 78 | 79 | 资源文件 80 | 81 | 82 | 资源文件 83 | 84 | 85 | 资源文件 86 | 87 | 88 | 资源文件 89 | 90 | 91 | 资源文件 92 | 93 | 94 | 资源文件 95 | 96 | 97 | 资源文件 98 | 99 | 100 | 资源文件 101 | 102 | 103 | -------------------------------------------------------------------------------- /TrayS/WinRing0x32.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/WinRing0x32.sys -------------------------------------------------------------------------------- /TrayS/WinRing0x64.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/WinRing0x64.sys -------------------------------------------------------------------------------- /TrayS/adl_sdk.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // MIT LICENSE: 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | /// \file adl_sdk.h 24 | /// \brief Contains the definition of the Memory Allocation Callback.\n Included in ADL SDK 25 | /// 26 | /// \n\n 27 | /// This file contains the definition of the Memory Allocation Callback.\n 28 | /// It also includes definitions of the respective structures and constants.\n 29 | /// This is the only header file to be included in a C/C++ project using ADL 30 | 31 | #ifndef ADL_SDK_H_ 32 | #define ADL_SDK_H_ 33 | 34 | #include "adl_structures.h" 35 | 36 | #if defined (LINUX) 37 | #define __stdcall 38 | #endif /* (LINUX) */ 39 | 40 | /// Memory Allocation Call back 41 | typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int ); 42 | 43 | 44 | #endif /* ADL_SDK_H_ */ 45 | -------------------------------------------------------------------------------- /TrayS/close.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/close.ico -------------------------------------------------------------------------------- /TrayS/framework.h: -------------------------------------------------------------------------------- 1 | // header.h: 标准系统包含文件的包含文件, 2 | // 或特定于项目的包含文件 3 | // 4 | 5 | #pragma once 6 | #include "targetver.h" 7 | #define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 8 | // Windows 头文件 9 | #include 10 | // C 运行时头文件 11 | //#include 12 | //#include 13 | //#include 14 | //#include 15 | /* 16 | #include 17 | #include 18 | #pragma comment(lib, "taskschd.lib") 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | //#pragma comment(lib, "comctl32.lib") 25 | //#define SECURITY_WIN32 26 | //#include 27 | //#pragma comment(lib,"Secur32.lib") 28 | //#pragma comment(lib, "Oleacc.lib") 29 | //#pragma comment(lib, "Iphlpapi.lib") 30 | //#include 31 | //#pragma comment(lib, "Powrprof.lib") 32 | //#include 33 | //#pragma comment(lib, "WtsApi32.lib") 34 | //#include 35 | //#pragma comment(lib, "Userenv.lib") 36 | //#include 37 | //#pragma comment(lib, "pdh.lib") 38 | */ 39 | #include "framework.h" 40 | #ifndef _DEBUG 41 | #ifdef _MSC_VER 42 | #pragma function(memset) 43 | void* __cdecl memset(void* pTarget, int value, size_t cb) { 44 | char* p = (char*)pTarget; 45 | while (cb--)*p++ = (char)value; 46 | return pTarget; 47 | } 48 | #pragma function(memcpy) 49 | void* __cdecl memcpy(void* pDest, const void* pSrc, size_t cb) 50 | { 51 | void* pResult = pDest; 52 | char* bDest = (char*)pDest; 53 | char* bSrc = (char*)pSrc; 54 | for (size_t i = 0; i < cb; ++i) 55 | { 56 | *bDest++ = *bSrc++; 57 | } 58 | return pResult; 59 | } 60 | #endif 61 | #if __cplusplus 62 | extern "C" 63 | #endif 64 | int _fltused = 1; 65 | #endif 66 | #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) 67 | #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -------------------------------------------------------------------------------- /TrayS/lb.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/lb.ico -------------------------------------------------------------------------------- /TrayS/lt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/lt.ico -------------------------------------------------------------------------------- /TrayS/mute.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/mute.ico -------------------------------------------------------------------------------- /TrayS/nomute.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/nomute.ico -------------------------------------------------------------------------------- /TrayS/notopmost.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/notopmost.ico -------------------------------------------------------------------------------- /TrayS/path.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/path.ico -------------------------------------------------------------------------------- /TrayS/rb.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/rb.ico -------------------------------------------------------------------------------- /TrayS/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ 生成的包含文件。 3 | // 供 TrayS.rc 使用 4 | // 5 | #define IDC_MYICON 2 6 | #define IDD_TRAYS_DIALOG 102 7 | #define IDS_APP_TITLE 103 8 | #define IDD_ABOUTBOX 103 9 | #define IDD_MAIN 103 10 | #define IDS_TIPS 104 11 | #define IDD_SETTING 105 12 | #define IDS_XML1 105 13 | #define IDS_XML2 106 14 | #define IDI_TRAYS 107 15 | #define IDC_TRAYS 109 16 | #define IDR_MAINFRAME 128 17 | #define IDD_DIALOG1 130 18 | #define IDD_TASKBAR 131 19 | #define IDD_TIPS 132 20 | #define IDD_TIME 133 21 | #define IDR_MENU 134 22 | #define IDI_CLOSE1 141 23 | #define IDD_PRICE 142 24 | #define IDC_RADIO_DEFAULT 1001 25 | #define IDC_RADIO_TRANSPARENT 1002 26 | #define IDC_RADIO_BLURBEHIND 1003 27 | #define IDC_RADIO_ACRYLIC 1004 28 | #define IDC_BUTTON_COLOR 1005 29 | #define IDC_SLIDER_ALPHA_B 1006 30 | #define IDC_SLIDER_ALPHA 1007 31 | #define IDC_CLOSE 1008 32 | #define IDC_CHECK_AUTORUN 1009 33 | #define IDC_RADIO_LEFT 1010 34 | #define IDC_RADIO_CENTER 1011 35 | #define IDC_RADIO_RIGHT 1012 36 | #define IDC_CHECK_TRAYICON 1013 37 | #define IDC_SYSLINK 1014 38 | #define IDC_CHECK_MONITOR 1015 39 | #define IDC_CHECK_MONITOR_LEFT 1016 40 | #define IDC_SYSLINK_52PJ 1017 41 | #define IDC_RADIO_NORMAL 1018 42 | #define IDC_RADIO_MAXIMIZE 1019 43 | #define IDC_CHECK_MONITOR_FLOAT 1020 44 | #define IDC_CHECK_MONITOR_FLOAT2 1021 45 | #define IDC_CHECK_TRANSPARENT 1021 46 | #define IDC_CHECK_TRAFFIC 1022 47 | #define IDC_CHECK_USAGE 1023 48 | #define IDC_CHECK_TEMPERATURE 1024 49 | #define IDC_CHECK_MONITOR2 1025 50 | #define IDC_CHECK_TRAY_STYLE 1025 51 | #define IDC_RADIO_BYTE 1032 52 | #define IDC_RADIO_BIT 1033 53 | #define IDC_RADIO_AUTO 1034 54 | #define IDC_RADIO_KB 1035 55 | #define IDC_RADIO_MB 1036 56 | #define IDC_CHECK_MONITOR_PDH 1037 57 | #define IDC_EDIT1 1038 58 | #define IDC_EDIT2 1039 59 | #define IDC_EDIT3 1040 60 | #define IDC_EDIT4 1041 61 | #define IDC_EDIT5 1042 62 | #define IDC_EDIT6 1043 63 | #define IDC_EDIT7 1044 64 | #define IDC_EDIT8 1045 65 | #define IDC_EDIT9 1046 66 | #define IDC_EDIT10 1047 67 | #define IDC_EDIT11 1048 68 | #define IDC_EDIT12 1049 69 | #define IDC_CHECK_SOUND 1050 70 | #define IDC_EDIT_OKX_WEB 1050 71 | #define IDC_CHECK_MONITOR_SIMPLE 1051 72 | #define IDC_CHECK1 1051 73 | #define IDC_RESTORE_DEFAULT 1052 74 | #define IDC_CHECK2 1052 75 | #define IDC_EDIT13 1053 76 | #define IDC_EDIT_TIME 1053 77 | #define IDC_CHECK3 1053 78 | #define IDC_CHECK_TIPS 1054 79 | #define IDC_CHECK4 1054 80 | #define IDC_BUTTON_FONT 1055 81 | #define IDC_CHECK5 1055 82 | #define IDC_BUTTON_TIPS_FONT 1056 83 | #define IDC_CHECK6 1056 84 | #define IDC_EDIT14 1057 85 | #define IDC_CHECK7 1057 86 | #define IDC_EDIT15 1058 87 | #define IDC_CHECK8 1058 88 | #define IDC_EDIT16 1059 89 | #define IDC_CHECK9 1059 90 | #define IDC_EDIT17 1060 91 | #define IDC_CHECK10 1060 92 | #define IDC_CHECK_TASKICON 1061 93 | #define IDC_CHECK_FUSE 1061 94 | #define IDC_CHECK11 1061 95 | #define IDC_CHECK_TASKICON_BIG 1062 96 | #define IDC_CHECK_MONITOR_UPDOWN 1062 97 | #define IDC_CHECK12 1062 98 | #define IDC_EDIT18 1063 99 | #define IDC_EDIT19 1064 100 | #define IDC_CHECK_MONITOR_FLOAT_VROW 1065 101 | #define IDC_CHECK_MONITOR_TIME 1066 102 | #define IDC_EDIT_14 1066 103 | #define IDC_CHECK_TIME 1067 104 | #define IDC_EDIT_15 1067 105 | #define IDC_CHECK_MONITOR_NEAR 1068 106 | #define IDC_EDIT_16 1068 107 | #define IDC_CHECK_TOPMOST 1069 108 | #define IDC_CHECK_13 1069 109 | #define IDC_CHECK_DISK 1070 110 | #define IDC_EDIT_13 1070 111 | #define IDC_EDIT24 1071 112 | #define IDC_CHECK_14 1071 113 | #define IDC_EDIT25 1072 114 | #define IDC_EDIT_17 1072 115 | #define IDC_EDIT26 1073 116 | #define IDC_CHECK_15 1073 117 | #define IDC_EDIT27 1074 118 | #define IDC_EDIT_18 1074 119 | #define IDC_EDIT20 1075 120 | #define IDC_CHECK_16 1075 121 | #define IDC_EDIT21 1076 122 | #define IDC_EDIT22 1077 123 | #define IDC_CHECK_17 1077 124 | #define IDC_EDIT23 1078 125 | #define IDC_EDIT28 1079 126 | #define IDC_CHECK_18 1079 127 | #define IDC_EDIT29 1080 128 | #define IDC_CHECK_PRICE 1081 129 | #define IDC_CHECK_22 1081 130 | #define IDC_EDIT_22 1082 131 | #define IDC_BUTTON_SELECT_NET 1082 132 | #define IDC_CHECK_23 1083 133 | #define IDC_BUTTON_SELECT_DISK 1083 134 | #define IDC_EDIT_23 1084 135 | #define IDC_CHECK_24 1085 136 | #define IDC_EDIT_24 1086 137 | #define IDC_CHECK_19 1087 138 | #define IDC_EDIT_19 1088 139 | #define IDC_CHECK_20 1089 140 | #define IDC_EDIT_20 1090 141 | #define IDC_CHECK_21 1091 142 | #define IDC_EDIT_21 1092 143 | #define IDC_EDIT37 1093 144 | #define IDC_EDIT38 1094 145 | #define IDC_BUTTON_COLOR_BACKGROUND 1095 146 | #define IDC_BUTTON_COLOR_TRAFFIC_LOW 1096 147 | #define IDC_BUTTON_COLOR_TRAFFIC_MEDIUM 1097 148 | #define IDC_BUTTON_COLOR_TRAFFIC_HIGH 1098 149 | #define IDC_BUTTON_COLOR_LOW 1099 150 | #define IDC_BUTTON_COLOR_MEDUIM 1100 151 | #define IDC_TWOFOUR 1100 152 | #define IDC_BUTTON_COLOR_HIGH 1101 153 | #define IDC_BUTTON_COLOR_PRICE_LOW 1102 154 | #define IDC_BUTTON_COLOR_PRICE_HIGH 1103 155 | #define ID_32800 32800 156 | #define IDC_SELECT_ALL 33000 157 | #define IDC_DISK_ALL 33200 158 | #define IDC_STATIC -1 159 | 160 | // Next default values for new objects 161 | // 162 | #ifdef APSTUDIO_INVOKED 163 | #ifndef APSTUDIO_READONLY_SYMBOLS 164 | #define _APS_NO_MFC 1 165 | #define _APS_NEXT_RESOURCE_VALUE 143 166 | #define _APS_NEXT_COMMAND_VALUE 32802 167 | #define _APS_NEXT_CONTROL_VALUE 1083 168 | #define _APS_NEXT_SYMED_VALUE 110 169 | #endif 170 | #endif 171 | -------------------------------------------------------------------------------- /TrayS/rt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/rt.ico -------------------------------------------------------------------------------- /TrayS/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // // 包含 SDKDDKVer.h 可定义可用的最高版本的 Windows 平台。 4 | // 如果希望为之前的 Windows 平台构建应用程序,在包含 SDKDDKVer.h 之前请先包含 WinSDKVer.h 并 5 | // 将 _WIN32_WINNT 宏设置为想要支持的平台。 6 | #include 7 | -------------------------------------------------------------------------------- /TrayS/topmost.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/topmost.ico -------------------------------------------------------------------------------- /TrayS/window.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgbsmy/TrayS/9f60dd535195274a9ea6e863aa119dfb849189ac/TrayS/window.ico --------------------------------------------------------------------------------