taskbar-progress 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +17 -0
- package/build/binding.sln +19 -0
- package/build/taskbar_progress.vcxproj +148 -0
- package/build/taskbar_progress.vcxproj.filters +46 -0
- package/demo.js +18 -0
- package/index.js +29 -0
- package/package.json +46 -0
- package/src/taskbar.cc +116 -0
package/binding.gyp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"targets": [{
|
|
3
|
+
"target_name": "taskbar_progress",
|
|
4
|
+
"sources": ["src/taskbar.cc"],
|
|
5
|
+
"conditions": [[
|
|
6
|
+
"OS=='win'", {
|
|
7
|
+
"libraries": ["shell32.lib", "ole32.lib", "uuid.lib"],
|
|
8
|
+
"msvs_settings": {
|
|
9
|
+
"VCCLCompilerTool": {
|
|
10
|
+
"Optimization": "2",
|
|
11
|
+
"RuntimeLibrary": "0"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
]]
|
|
16
|
+
}]
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
2
|
+
# Visual Studio 2015
|
|
3
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "taskbar_progress", "taskbar_progress.vcxproj", "{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}"
|
|
4
|
+
EndProject
|
|
5
|
+
Global
|
|
6
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
7
|
+
Release|x64 = Release|x64
|
|
8
|
+
Debug|x64 = Debug|x64
|
|
9
|
+
EndGlobalSection
|
|
10
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
11
|
+
{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}.Release|x64.ActiveCfg = Release|x64
|
|
12
|
+
{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}.Release|x64.Build.0 = Release|x64
|
|
13
|
+
{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}.Debug|x64.ActiveCfg = Debug|x64
|
|
14
|
+
{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}.Debug|x64.Build.0 = Debug|x64
|
|
15
|
+
EndGlobalSection
|
|
16
|
+
GlobalSection(SolutionProperties) = preSolution
|
|
17
|
+
HideSolutionNode = FALSE
|
|
18
|
+
EndGlobalSection
|
|
19
|
+
EndGlobal
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
+
<ProjectConfiguration Include="Debug|x64">
|
|
5
|
+
<Configuration>Debug</Configuration>
|
|
6
|
+
<Platform>x64</Platform>
|
|
7
|
+
</ProjectConfiguration>
|
|
8
|
+
<ProjectConfiguration Include="Release|x64">
|
|
9
|
+
<Configuration>Release</Configuration>
|
|
10
|
+
<Platform>x64</Platform>
|
|
11
|
+
</ProjectConfiguration>
|
|
12
|
+
</ItemGroup>
|
|
13
|
+
<PropertyGroup Label="Globals">
|
|
14
|
+
<ProjectGuid>{29B51BA0-65C6-4770-ED5A-71ACE8829C8D}</ProjectGuid>
|
|
15
|
+
<Keyword>Win32Proj</Keyword>
|
|
16
|
+
<RootNamespace>taskbar_progress</RootNamespace>
|
|
17
|
+
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
|
18
|
+
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
|
19
|
+
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
|
20
|
+
</PropertyGroup>
|
|
21
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
|
22
|
+
<PropertyGroup Label="Configuration">
|
|
23
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
24
|
+
</PropertyGroup>
|
|
25
|
+
<PropertyGroup Label="Locals">
|
|
26
|
+
<PlatformToolset>v145</PlatformToolset>
|
|
27
|
+
</PropertyGroup>
|
|
28
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
|
29
|
+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
|
|
30
|
+
<ImportGroup Label="ExtensionSettings"/>
|
|
31
|
+
<ImportGroup Label="PropertySheets">
|
|
32
|
+
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
|
33
|
+
</ImportGroup>
|
|
34
|
+
<PropertyGroup Label="UserMacros"/>
|
|
35
|
+
<PropertyGroup>
|
|
36
|
+
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
|
|
37
|
+
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
38
|
+
<IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
|
|
39
|
+
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
|
40
|
+
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
|
41
|
+
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
|
42
|
+
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
|
43
|
+
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
|
44
|
+
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
|
45
|
+
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
|
46
|
+
<TargetName>$(ProjectName)</TargetName>
|
|
47
|
+
<TargetPath>$(OutDir)\$(ProjectName).node</TargetPath>
|
|
48
|
+
</PropertyGroup>
|
|
49
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
50
|
+
<ClCompile>
|
|
51
|
+
<AdditionalIncludeDirectories>C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\include\node;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\src;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\config;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\openssl\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\uv\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\zlib;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
52
|
+
<AdditionalOptions>/Zc:__cplusplus -std:c++20 /Zm2000 %(AdditionalOptions)</AdditionalOptions>
|
|
53
|
+
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
54
|
+
<BufferSecurityCheck>true</BufferSecurityCheck>
|
|
55
|
+
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
|
56
|
+
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
57
|
+
<ExceptionHandling>false</ExceptionHandling>
|
|
58
|
+
<MinimalRebuild>false</MinimalRebuild>
|
|
59
|
+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
60
|
+
<OmitFramePointers>false</OmitFramePointers>
|
|
61
|
+
<Optimization>Disabled</Optimization>
|
|
62
|
+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
63
|
+
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=taskbar_progress;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
64
|
+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
65
|
+
<StringPooling>true</StringPooling>
|
|
66
|
+
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
67
|
+
<TreatWarningAsError>false</TreatWarningAsError>
|
|
68
|
+
<WarningLevel>Level3</WarningLevel>
|
|
69
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
70
|
+
</ClCompile>
|
|
71
|
+
<Lib>
|
|
72
|
+
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
|
73
|
+
</Lib>
|
|
74
|
+
<Link>
|
|
75
|
+
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;odbc32.lib;delayimp.lib;"C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\22.22.3\\x64\\node.lib";shell32.lib;ole32.lib;uuid.lib</AdditionalDependencies>
|
|
76
|
+
<AdditionalOptions>/LTCG:INCREMENTAL /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
|
77
|
+
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
78
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
79
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
80
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
81
|
+
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
|
82
|
+
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
83
|
+
<TargetExt>.node</TargetExt>
|
|
84
|
+
<TargetMachine>MachineX64</TargetMachine>
|
|
85
|
+
</Link>
|
|
86
|
+
<ResourceCompile>
|
|
87
|
+
<AdditionalIncludeDirectories>C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\include\node;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\src;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\config;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\openssl\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\uv\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\zlib;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
88
|
+
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=taskbar_progress;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
89
|
+
</ResourceCompile>
|
|
90
|
+
</ItemDefinitionGroup>
|
|
91
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
92
|
+
<ClCompile>
|
|
93
|
+
<AdditionalIncludeDirectories>C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\include\node;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\src;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\config;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\openssl\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\uv\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\zlib;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
94
|
+
<AdditionalOptions>/Zc:__cplusplus -std:c++20 /Zm2000 %(AdditionalOptions)</AdditionalOptions>
|
|
95
|
+
<BufferSecurityCheck>true</BufferSecurityCheck>
|
|
96
|
+
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
|
97
|
+
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
98
|
+
<ExceptionHandling>false</ExceptionHandling>
|
|
99
|
+
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
|
100
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
101
|
+
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
|
102
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
103
|
+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
104
|
+
<OmitFramePointers>true</OmitFramePointers>
|
|
105
|
+
<Optimization>Full</Optimization>
|
|
106
|
+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
107
|
+
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=taskbar_progress;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
108
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
109
|
+
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
|
110
|
+
<StringPooling>true</StringPooling>
|
|
111
|
+
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
112
|
+
<TreatWarningAsError>false</TreatWarningAsError>
|
|
113
|
+
<WarningLevel>Level3</WarningLevel>
|
|
114
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
115
|
+
</ClCompile>
|
|
116
|
+
<Lib>
|
|
117
|
+
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
|
118
|
+
</Lib>
|
|
119
|
+
<Link>
|
|
120
|
+
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;oleaut32.lib;odbc32.lib;delayimp.lib;"C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\22.22.3\\x64\\node.lib";shell32.lib;ole32.lib;uuid.lib</AdditionalDependencies>
|
|
121
|
+
<AdditionalOptions>/LTCG:INCREMENTAL /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
|
122
|
+
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
123
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
124
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
125
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
126
|
+
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
|
127
|
+
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
128
|
+
<TargetExt>.node</TargetExt>
|
|
129
|
+
<TargetMachine>MachineX64</TargetMachine>
|
|
130
|
+
</Link>
|
|
131
|
+
<ResourceCompile>
|
|
132
|
+
<AdditionalIncludeDirectories>C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\include\node;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\src;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\config;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\openssl\openssl\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\uv\include;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\zlib;C:\Users\Administrator\AppData\Local\node-gyp\Cache\22.22.3\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
133
|
+
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=taskbar_progress;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
134
|
+
</ResourceCompile>
|
|
135
|
+
</ItemDefinitionGroup>
|
|
136
|
+
<ItemGroup>
|
|
137
|
+
<None Include="..\binding.gyp"/>
|
|
138
|
+
</ItemGroup>
|
|
139
|
+
<ItemGroup>
|
|
140
|
+
<ClCompile Include="..\src\taskbar.cc">
|
|
141
|
+
<ObjectFileName>$(IntDir)\src\taskbar.obj</ObjectFileName>
|
|
142
|
+
</ClCompile>
|
|
143
|
+
<ClCompile Include="C:\code\pigman18\taskbar-progress\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
|
|
144
|
+
</ItemGroup>
|
|
145
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
|
146
|
+
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
|
|
147
|
+
<ImportGroup Label="ExtensionTargets"/>
|
|
148
|
+
</Project>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup>
|
|
4
|
+
<Filter Include="..">
|
|
5
|
+
<UniqueIdentifier>{13ED4249-1F9C-5F0F-2651-29A73F3A7059}</UniqueIdentifier>
|
|
6
|
+
</Filter>
|
|
7
|
+
<Filter Include="..\src">
|
|
8
|
+
<UniqueIdentifier>{F1003AD6-4B6D-45DF-3F56-5CAC869BF55E}</UniqueIdentifier>
|
|
9
|
+
</Filter>
|
|
10
|
+
<Filter Include="C:">
|
|
11
|
+
<UniqueIdentifier>{F87FD356-0FEB-9BC5-D1FA-368C81420008}</UniqueIdentifier>
|
|
12
|
+
</Filter>
|
|
13
|
+
<Filter Include="C:\code">
|
|
14
|
+
<UniqueIdentifier>{E7F7D613-D7C6-2386-B304-D47A8300029F}</UniqueIdentifier>
|
|
15
|
+
</Filter>
|
|
16
|
+
<Filter Include="C:\code\pigman18">
|
|
17
|
+
<UniqueIdentifier>{3ADC0B70-A590-0FA7-BEB2-3240E7B6E85E}</UniqueIdentifier>
|
|
18
|
+
</Filter>
|
|
19
|
+
<Filter Include="C:\code\pigman18\taskbar-progress">
|
|
20
|
+
<UniqueIdentifier>{02F027DE-09D9-0B04-A9A8-F08F09C14E40}</UniqueIdentifier>
|
|
21
|
+
</Filter>
|
|
22
|
+
<Filter Include="C:\code\pigman18\taskbar-progress\node_modules">
|
|
23
|
+
<UniqueIdentifier>{126A39EA-1D28-5689-C126-0DA0AB5837A0}</UniqueIdentifier>
|
|
24
|
+
</Filter>
|
|
25
|
+
<Filter Include="C:\code\pigman18\taskbar-progress\node_modules\node-gyp">
|
|
26
|
+
<UniqueIdentifier>{49558BB4-6D34-CA91-A65D-85A65792DC11}</UniqueIdentifier>
|
|
27
|
+
</Filter>
|
|
28
|
+
<Filter Include="C:\code\pigman18\taskbar-progress\node_modules\node-gyp\src">
|
|
29
|
+
<UniqueIdentifier>{F1003AD6-4B6D-45DF-3F56-5CAC869BF55E}</UniqueIdentifier>
|
|
30
|
+
</Filter>
|
|
31
|
+
<Filter Include="..">
|
|
32
|
+
<UniqueIdentifier>{13ED4249-1F9C-5F0F-2651-29A73F3A7059}</UniqueIdentifier>
|
|
33
|
+
</Filter>
|
|
34
|
+
</ItemGroup>
|
|
35
|
+
<ItemGroup>
|
|
36
|
+
<ClCompile Include="..\src\taskbar.cc">
|
|
37
|
+
<Filter>..\src</Filter>
|
|
38
|
+
</ClCompile>
|
|
39
|
+
<ClCompile Include="C:\code\pigman18\taskbar-progress\node_modules\node-gyp\src\win_delay_load_hook.cc">
|
|
40
|
+
<Filter>C:\code\pigman18\taskbar-progress\node_modules\node-gyp\src</Filter>
|
|
41
|
+
</ClCompile>
|
|
42
|
+
<None Include="..\binding.gyp">
|
|
43
|
+
<Filter>..</Filter>
|
|
44
|
+
</None>
|
|
45
|
+
</ItemGroup>
|
|
46
|
+
</Project>
|
package/demo.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { setProgress, setIndeterminate, setError } = require('./index.js');
|
|
2
|
+
|
|
3
|
+
// 不确定进度
|
|
4
|
+
setIndeterminate();
|
|
5
|
+
|
|
6
|
+
// 模拟进度
|
|
7
|
+
let i = 0;
|
|
8
|
+
const timer = setInterval(() => {
|
|
9
|
+
i += 5;
|
|
10
|
+
setProgress(i / 100);
|
|
11
|
+
if (i >= 100) {
|
|
12
|
+
clearInterval(timer);
|
|
13
|
+
setTimeout(() => setProgress(-1), 1000);
|
|
14
|
+
}
|
|
15
|
+
}, 200);
|
|
16
|
+
|
|
17
|
+
// 出错时
|
|
18
|
+
// setError();
|
package/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const addon = require(path.resolve(__dirname, 'build/Release/taskbar_progress.node'));
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 设置任务栏进度条
|
|
6
|
+
* @param {number} value -1 清除,0~1 显示进度
|
|
7
|
+
*/
|
|
8
|
+
function setProgress(value) {
|
|
9
|
+
if (process.platform !== 'win32') return;
|
|
10
|
+
try { addon.setProgress(value); } catch {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 不确定进度(滚动绿光)
|
|
15
|
+
*/
|
|
16
|
+
function setIndeterminate() {
|
|
17
|
+
if (process.platform !== 'win32') return;
|
|
18
|
+
try { addon.setIndeterminate(); } catch {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 错误态(红色)
|
|
23
|
+
*/
|
|
24
|
+
function setError() {
|
|
25
|
+
if (process.platform !== 'win32') return;
|
|
26
|
+
try { addon.setError(); } catch {}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { setProgress, setIndeterminate, setError };
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "taskbar-progress",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "任务栏进度",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"windows",
|
|
8
|
+
"taskbar",
|
|
9
|
+
"progress",
|
|
10
|
+
"addon",
|
|
11
|
+
"native",
|
|
12
|
+
"ITaskbarList3",
|
|
13
|
+
"node-gyp",
|
|
14
|
+
"pkg"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node demo.js",
|
|
18
|
+
"install": "node-gyp rebuild",
|
|
19
|
+
"build": "node-gyp rebuild",
|
|
20
|
+
"clean": "node-gyp clean",
|
|
21
|
+
"pub": "npm run build && npm publish"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"node-gyp": "^13.0.0"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16.0.0"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/pigman18/taskbar-progress.git"
|
|
32
|
+
},
|
|
33
|
+
"author": "pigman18",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"os": [
|
|
36
|
+
"win32"
|
|
37
|
+
],
|
|
38
|
+
"cpu": [
|
|
39
|
+
"x64"
|
|
40
|
+
],
|
|
41
|
+
"gypfile": true,
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/pigman18/taskbar-progress/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/pigman18/taskbar-progress#readme"
|
|
46
|
+
}
|
package/src/taskbar.cc
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#include <windows.h>
|
|
2
|
+
#include <shobjidl.h>
|
|
3
|
+
#include <ole2.h>
|
|
4
|
+
#include <node_api.h>
|
|
5
|
+
|
|
6
|
+
// 获取当前进程窗口句柄
|
|
7
|
+
HWND GetHwnd() {
|
|
8
|
+
return GetConsoleWindow();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 设置进度
|
|
12
|
+
napi_value SetProgress(napi_env env, napi_callback_info info) {
|
|
13
|
+
size_t argc = 1;
|
|
14
|
+
napi_value args[1];
|
|
15
|
+
napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
|
|
16
|
+
|
|
17
|
+
double value = -1;
|
|
18
|
+
napi_get_value_double(env, args[0], &value);
|
|
19
|
+
|
|
20
|
+
HWND hwnd = GetHwnd();
|
|
21
|
+
if (!hwnd) return nullptr;
|
|
22
|
+
|
|
23
|
+
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
24
|
+
if (FAILED(hr)) return nullptr;
|
|
25
|
+
|
|
26
|
+
ITaskbarList3* taskbar = nullptr;
|
|
27
|
+
hr = CoCreateInstance(
|
|
28
|
+
CLSID_TaskbarList,
|
|
29
|
+
nullptr,
|
|
30
|
+
CLSCTX_INPROC_SERVER,
|
|
31
|
+
IID_ITaskbarList3,
|
|
32
|
+
(void**)&taskbar
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (SUCCEEDED(hr)) {
|
|
36
|
+
taskbar->HrInit();
|
|
37
|
+
|
|
38
|
+
if (value < 0) {
|
|
39
|
+
taskbar->SetProgressState(hwnd, TBPF_NOPROGRESS);
|
|
40
|
+
} else if (value >= 1.0) {
|
|
41
|
+
taskbar->SetProgressState(hwnd, TBPF_NORMAL);
|
|
42
|
+
taskbar->SetProgressValue(hwnd, 100, 100);
|
|
43
|
+
} else {
|
|
44
|
+
taskbar->SetProgressState(hwnd, TBPF_NORMAL);
|
|
45
|
+
taskbar->SetProgressValue(
|
|
46
|
+
hwnd,
|
|
47
|
+
static_cast<ULONGLONG>(value * 100),
|
|
48
|
+
100
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
taskbar->Release();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
CoUninitialize();
|
|
56
|
+
return nullptr;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 不确定进度(滚动动画)
|
|
60
|
+
napi_value SetIndeterminate(napi_env env, napi_callback_info info) {
|
|
61
|
+
HWND hwnd = GetHwnd();
|
|
62
|
+
if (!hwnd) return nullptr;
|
|
63
|
+
|
|
64
|
+
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
65
|
+
|
|
66
|
+
ITaskbarList3* taskbar = nullptr;
|
|
67
|
+
if (SUCCEEDED(CoCreateInstance(
|
|
68
|
+
CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER,
|
|
69
|
+
IID_ITaskbarList3, (void**)&taskbar
|
|
70
|
+
))) {
|
|
71
|
+
taskbar->HrInit();
|
|
72
|
+
taskbar->SetProgressState(hwnd, TBPF_INDETERMINATE);
|
|
73
|
+
taskbar->Release();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
CoUninitialize();
|
|
77
|
+
return nullptr;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 错误态
|
|
81
|
+
napi_value SetError(napi_env env, napi_callback_info info) {
|
|
82
|
+
HWND hwnd = GetHwnd();
|
|
83
|
+
if (!hwnd) return nullptr;
|
|
84
|
+
|
|
85
|
+
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
86
|
+
|
|
87
|
+
ITaskbarList3* taskbar = nullptr;
|
|
88
|
+
if (SUCCEEDED(CoCreateInstance(
|
|
89
|
+
CLSID_TaskbarList, nullptr, CLSCTX_INPROC_SERVER,
|
|
90
|
+
IID_ITaskbarList3, (void**)&taskbar
|
|
91
|
+
))) {
|
|
92
|
+
taskbar->HrInit();
|
|
93
|
+
taskbar->SetProgressState(hwnd, TBPF_ERROR);
|
|
94
|
+
taskbar->Release();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
CoUninitialize();
|
|
98
|
+
return nullptr;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 模块导出
|
|
102
|
+
napi_value Init(napi_env env, napi_value exports) {
|
|
103
|
+
napi_value fn_progress, fn_indeterminate, fn_error;
|
|
104
|
+
|
|
105
|
+
napi_create_function(env, nullptr, 0, SetProgress, nullptr, &fn_progress);
|
|
106
|
+
napi_create_function(env, nullptr, 0, SetIndeterminate, nullptr, &fn_indeterminate);
|
|
107
|
+
napi_create_function(env, nullptr, 0, SetError, nullptr, &fn_error);
|
|
108
|
+
|
|
109
|
+
napi_set_named_property(env, exports, "setProgress", fn_progress);
|
|
110
|
+
napi_set_named_property(env, exports, "setIndeterminate", fn_indeterminate);
|
|
111
|
+
napi_set_named_property(env, exports, "setError", fn_error);
|
|
112
|
+
|
|
113
|
+
return exports;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
NAPI_MODULE(taskbar_progress, Init)
|