win32-systray 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +393 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/example/pnow.ico +0 -0
- data/example/run.rb +18 -0
- data/lib/win32/c/build.bat +3 -0
- data/lib/win32/c/msvc/systray/pnow.ico +0 -0
- data/lib/win32/c/msvc/systray/systray.sln +31 -0
- data/lib/win32/c/msvc/systray/systray.vcxproj +135 -0
- data/lib/win32/c/msvc/systray/systray.vcxproj.filters +22 -0
- data/lib/win32/c/systray.cpp +234 -0
- data/lib/win32/systray/version.rb +5 -0
- data/lib/win32/systray.dll +0 -0
- data/lib/win32/systray.rb +56 -0
- data/win32-systray.gemspec +28 -0
- metadata +64 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ee203f964af8097b0407a9f627aef1cdb0291cb5dd4e80f4ced62ffa53a20b56
|
|
4
|
+
data.tar.gz: '09215c8aa5bf6a5833e71ceacf345d2339f16ca56d27bb962b1ce1762eaff11f'
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 802fe7a2cb9ae1150e8c3b451bcd041f55c04edfb5785f46323a808716f13408a369dd82f6f4d4877b996cfe3a120b00baf5f9a47aad13a21af62ed5c1efe852
|
|
7
|
+
data.tar.gz: fc036069b0fae610c356a595954417fb7acc1ab11ae20d084f9e930c56f0edfa21aaed8f7566f62f6d8fac58e3b48d81d6b15d9f008d35a0f42a437c59e30d64
|
data/.gitignore
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
# Used by dotenv library to load environment variables.
|
|
14
|
+
# .env
|
|
15
|
+
|
|
16
|
+
## Specific to RubyMotion:
|
|
17
|
+
.dat*
|
|
18
|
+
.repl_history
|
|
19
|
+
build/
|
|
20
|
+
*.bridgesupport
|
|
21
|
+
build-iPhoneOS/
|
|
22
|
+
build-iPhoneSimulator/
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
25
|
+
#
|
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
29
|
+
#
|
|
30
|
+
# vendor/Pods/
|
|
31
|
+
|
|
32
|
+
## Documentation cache and generated files:
|
|
33
|
+
/.yardoc/
|
|
34
|
+
/_yardoc/
|
|
35
|
+
/doc/
|
|
36
|
+
/rdoc/
|
|
37
|
+
|
|
38
|
+
## Environment normalization:
|
|
39
|
+
/.bundle/
|
|
40
|
+
/vendor/bundle
|
|
41
|
+
/lib/bundler/man/
|
|
42
|
+
|
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
45
|
+
# Gemfile.lock
|
|
46
|
+
# .ruby-version
|
|
47
|
+
# .ruby-gemset
|
|
48
|
+
|
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
|
+
.rvmrc
|
|
51
|
+
## Ignore Visual Studio temporary files, build results, and
|
|
52
|
+
## files generated by popular Visual Studio add-ons.
|
|
53
|
+
##
|
|
54
|
+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
55
|
+
|
|
56
|
+
# User-specific files
|
|
57
|
+
*.rsuser
|
|
58
|
+
*.suo
|
|
59
|
+
*.user
|
|
60
|
+
*.userosscache
|
|
61
|
+
*.sln.docstates
|
|
62
|
+
|
|
63
|
+
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
64
|
+
*.userprefs
|
|
65
|
+
|
|
66
|
+
# Build results
|
|
67
|
+
[Dd]ebug/
|
|
68
|
+
[Dd]ebugPublic/
|
|
69
|
+
[Rr]elease/
|
|
70
|
+
[Rr]eleases/
|
|
71
|
+
x64/
|
|
72
|
+
x86/
|
|
73
|
+
[Aa][Rr][Mm]/
|
|
74
|
+
[Aa][Rr][Mm]64/
|
|
75
|
+
bld/
|
|
76
|
+
[Bb]in/
|
|
77
|
+
[Oo]bj/
|
|
78
|
+
[Ll]og/
|
|
79
|
+
|
|
80
|
+
# Visual Studio 2015/2017 cache/options directory
|
|
81
|
+
.vs/
|
|
82
|
+
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
83
|
+
#wwwroot/
|
|
84
|
+
|
|
85
|
+
# Visual Studio 2017 auto generated files
|
|
86
|
+
Generated\ Files/
|
|
87
|
+
|
|
88
|
+
# MSTest test Results
|
|
89
|
+
[Tt]est[Rr]esult*/
|
|
90
|
+
[Bb]uild[Ll]og.*
|
|
91
|
+
|
|
92
|
+
# NUNIT
|
|
93
|
+
*.VisualState.xml
|
|
94
|
+
TestResult.xml
|
|
95
|
+
|
|
96
|
+
# Build Results of an ATL Project
|
|
97
|
+
[Dd]ebugPS/
|
|
98
|
+
[Rr]eleasePS/
|
|
99
|
+
dlldata.c
|
|
100
|
+
|
|
101
|
+
# Benchmark Results
|
|
102
|
+
BenchmarkDotNet.Artifacts/
|
|
103
|
+
|
|
104
|
+
# .NET Core
|
|
105
|
+
project.lock.json
|
|
106
|
+
project.fragment.lock.json
|
|
107
|
+
artifacts/
|
|
108
|
+
|
|
109
|
+
# StyleCop
|
|
110
|
+
StyleCopReport.xml
|
|
111
|
+
|
|
112
|
+
# Files built by Visual Studio
|
|
113
|
+
*_i.c
|
|
114
|
+
*_p.c
|
|
115
|
+
*_h.h
|
|
116
|
+
*.ilk
|
|
117
|
+
*.meta
|
|
118
|
+
*.obj
|
|
119
|
+
*.iobj
|
|
120
|
+
*.pch
|
|
121
|
+
*.pdb
|
|
122
|
+
*.ipdb
|
|
123
|
+
*.pgc
|
|
124
|
+
*.pgd
|
|
125
|
+
*.rsp
|
|
126
|
+
*.sbr
|
|
127
|
+
*.tlb
|
|
128
|
+
*.tli
|
|
129
|
+
*.tlh
|
|
130
|
+
*.tmp
|
|
131
|
+
*.tmp_proj
|
|
132
|
+
*_wpftmp.csproj
|
|
133
|
+
*.log
|
|
134
|
+
*.vspscc
|
|
135
|
+
*.vssscc
|
|
136
|
+
.builds
|
|
137
|
+
*.pidb
|
|
138
|
+
*.svclog
|
|
139
|
+
*.scc
|
|
140
|
+
|
|
141
|
+
# Chutzpah Test files
|
|
142
|
+
_Chutzpah*
|
|
143
|
+
|
|
144
|
+
# Visual C++ cache files
|
|
145
|
+
ipch/
|
|
146
|
+
*.aps
|
|
147
|
+
*.ncb
|
|
148
|
+
*.opendb
|
|
149
|
+
*.opensdf
|
|
150
|
+
*.sdf
|
|
151
|
+
*.cachefile
|
|
152
|
+
*.VC.db
|
|
153
|
+
*.VC.VC.opendb
|
|
154
|
+
|
|
155
|
+
# Visual Studio profiler
|
|
156
|
+
*.psess
|
|
157
|
+
*.vsp
|
|
158
|
+
*.vspx
|
|
159
|
+
*.sap
|
|
160
|
+
|
|
161
|
+
# Visual Studio Trace Files
|
|
162
|
+
*.e2e
|
|
163
|
+
|
|
164
|
+
# TFS 2012 Local Workspace
|
|
165
|
+
$tf/
|
|
166
|
+
|
|
167
|
+
# Guidance Automation Toolkit
|
|
168
|
+
*.gpState
|
|
169
|
+
|
|
170
|
+
# ReSharper is a .NET coding add-in
|
|
171
|
+
_ReSharper*/
|
|
172
|
+
*.[Rr]e[Ss]harper
|
|
173
|
+
*.DotSettings.user
|
|
174
|
+
|
|
175
|
+
# JustCode is a .NET coding add-in
|
|
176
|
+
.JustCode
|
|
177
|
+
|
|
178
|
+
# TeamCity is a build add-in
|
|
179
|
+
_TeamCity*
|
|
180
|
+
|
|
181
|
+
# DotCover is a Code Coverage Tool
|
|
182
|
+
*.dotCover
|
|
183
|
+
|
|
184
|
+
# AxoCover is a Code Coverage Tool
|
|
185
|
+
.axoCover/*
|
|
186
|
+
!.axoCover/settings.json
|
|
187
|
+
|
|
188
|
+
# Visual Studio code coverage results
|
|
189
|
+
*.coverage
|
|
190
|
+
*.coveragexml
|
|
191
|
+
|
|
192
|
+
# NCrunch
|
|
193
|
+
_NCrunch_*
|
|
194
|
+
.*crunch*.local.xml
|
|
195
|
+
nCrunchTemp_*
|
|
196
|
+
|
|
197
|
+
# MightyMoose
|
|
198
|
+
*.mm.*
|
|
199
|
+
AutoTest.Net/
|
|
200
|
+
|
|
201
|
+
# Web workbench (sass)
|
|
202
|
+
.sass-cache/
|
|
203
|
+
|
|
204
|
+
# Installshield output folder
|
|
205
|
+
[Ee]xpress/
|
|
206
|
+
|
|
207
|
+
# DocProject is a documentation generator add-in
|
|
208
|
+
DocProject/buildhelp/
|
|
209
|
+
DocProject/Help/*.HxT
|
|
210
|
+
DocProject/Help/*.HxC
|
|
211
|
+
DocProject/Help/*.hhc
|
|
212
|
+
DocProject/Help/*.hhk
|
|
213
|
+
DocProject/Help/*.hhp
|
|
214
|
+
DocProject/Help/Html2
|
|
215
|
+
DocProject/Help/html
|
|
216
|
+
|
|
217
|
+
# Click-Once directory
|
|
218
|
+
publish/
|
|
219
|
+
|
|
220
|
+
# Publish Web Output
|
|
221
|
+
*.[Pp]ublish.xml
|
|
222
|
+
*.azurePubxml
|
|
223
|
+
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
224
|
+
# but database connection strings (with potential passwords) will be unencrypted
|
|
225
|
+
*.pubxml
|
|
226
|
+
*.publishproj
|
|
227
|
+
|
|
228
|
+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
229
|
+
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
230
|
+
# in these scripts will be unencrypted
|
|
231
|
+
PublishScripts/
|
|
232
|
+
|
|
233
|
+
# NuGet Packages
|
|
234
|
+
*.nupkg
|
|
235
|
+
# The packages folder can be ignored because of Package Restore
|
|
236
|
+
**/[Pp]ackages/*
|
|
237
|
+
# except build/, which is used as an MSBuild target.
|
|
238
|
+
!**/[Pp]ackages/build/
|
|
239
|
+
# Uncomment if necessary however generally it will be regenerated when needed
|
|
240
|
+
#!**/[Pp]ackages/repositories.config
|
|
241
|
+
# NuGet v3's project.json files produces more ignorable files
|
|
242
|
+
*.nuget.props
|
|
243
|
+
*.nuget.targets
|
|
244
|
+
|
|
245
|
+
# Microsoft Azure Build Output
|
|
246
|
+
csx/
|
|
247
|
+
*.build.csdef
|
|
248
|
+
|
|
249
|
+
# Microsoft Azure Emulator
|
|
250
|
+
ecf/
|
|
251
|
+
rcf/
|
|
252
|
+
|
|
253
|
+
# Windows Store app package directories and files
|
|
254
|
+
AppPackages/
|
|
255
|
+
BundleArtifacts/
|
|
256
|
+
Package.StoreAssociation.xml
|
|
257
|
+
_pkginfo.txt
|
|
258
|
+
*.appx
|
|
259
|
+
|
|
260
|
+
# Visual Studio cache files
|
|
261
|
+
# files ending in .cache can be ignored
|
|
262
|
+
*.[Cc]ache
|
|
263
|
+
# but keep track of directories ending in .cache
|
|
264
|
+
!?*.[Cc]ache/
|
|
265
|
+
|
|
266
|
+
# Others
|
|
267
|
+
ClientBin/
|
|
268
|
+
~$*
|
|
269
|
+
*~
|
|
270
|
+
*.dbmdl
|
|
271
|
+
*.dbproj.schemaview
|
|
272
|
+
*.jfm
|
|
273
|
+
*.pfx
|
|
274
|
+
*.publishsettings
|
|
275
|
+
orleans.codegen.cs
|
|
276
|
+
|
|
277
|
+
# Including strong name files can present a security risk
|
|
278
|
+
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
279
|
+
#*.snk
|
|
280
|
+
|
|
281
|
+
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
282
|
+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
283
|
+
#bower_components/
|
|
284
|
+
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
|
|
285
|
+
**/wwwroot/lib/
|
|
286
|
+
|
|
287
|
+
# RIA/Silverlight projects
|
|
288
|
+
Generated_Code/
|
|
289
|
+
|
|
290
|
+
# Backup & report files from converting an old project file
|
|
291
|
+
# to a newer Visual Studio version. Backup files are not needed,
|
|
292
|
+
# because we have git ;-)
|
|
293
|
+
_UpgradeReport_Files/
|
|
294
|
+
Backup*/
|
|
295
|
+
UpgradeLog*.XML
|
|
296
|
+
UpgradeLog*.htm
|
|
297
|
+
ServiceFabricBackup/
|
|
298
|
+
*.rptproj.bak
|
|
299
|
+
|
|
300
|
+
# SQL Server files
|
|
301
|
+
*.mdf
|
|
302
|
+
*.ldf
|
|
303
|
+
*.ndf
|
|
304
|
+
|
|
305
|
+
# Business Intelligence projects
|
|
306
|
+
*.rdl.data
|
|
307
|
+
*.bim.layout
|
|
308
|
+
*.bim_*.settings
|
|
309
|
+
*.rptproj.rsuser
|
|
310
|
+
|
|
311
|
+
# Microsoft Fakes
|
|
312
|
+
FakesAssemblies/
|
|
313
|
+
|
|
314
|
+
# GhostDoc plugin setting file
|
|
315
|
+
*.GhostDoc.xml
|
|
316
|
+
|
|
317
|
+
# Node.js Tools for Visual Studio
|
|
318
|
+
.ntvs_analysis.dat
|
|
319
|
+
node_modules/
|
|
320
|
+
|
|
321
|
+
# Visual Studio 6 build log
|
|
322
|
+
*.plg
|
|
323
|
+
|
|
324
|
+
# Visual Studio 6 workspace options file
|
|
325
|
+
*.opt
|
|
326
|
+
|
|
327
|
+
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
328
|
+
*.vbw
|
|
329
|
+
|
|
330
|
+
# Visual Studio LightSwitch build output
|
|
331
|
+
**/*.HTMLClient/GeneratedArtifacts
|
|
332
|
+
**/*.DesktopClient/GeneratedArtifacts
|
|
333
|
+
**/*.DesktopClient/ModelManifest.xml
|
|
334
|
+
**/*.Server/GeneratedArtifacts
|
|
335
|
+
**/*.Server/ModelManifest.xml
|
|
336
|
+
_Pvt_Extensions
|
|
337
|
+
|
|
338
|
+
# Paket dependency manager
|
|
339
|
+
.paket/paket.exe
|
|
340
|
+
paket-files/
|
|
341
|
+
|
|
342
|
+
# FAKE - F# Make
|
|
343
|
+
.fake/
|
|
344
|
+
|
|
345
|
+
# JetBrains Rider
|
|
346
|
+
.idea/
|
|
347
|
+
*.sln.iml
|
|
348
|
+
|
|
349
|
+
# CodeRush personal settings
|
|
350
|
+
.cr/personal
|
|
351
|
+
|
|
352
|
+
# Python Tools for Visual Studio (PTVS)
|
|
353
|
+
__pycache__/
|
|
354
|
+
*.pyc
|
|
355
|
+
|
|
356
|
+
# Cake - Uncomment if you are using it
|
|
357
|
+
# tools/**
|
|
358
|
+
# !tools/packages.config
|
|
359
|
+
|
|
360
|
+
# Tabs Studio
|
|
361
|
+
*.tss
|
|
362
|
+
|
|
363
|
+
# Telerik's JustMock configuration file
|
|
364
|
+
*.jmconfig
|
|
365
|
+
|
|
366
|
+
# BizTalk build output
|
|
367
|
+
*.btp.cs
|
|
368
|
+
*.btm.cs
|
|
369
|
+
*.odx.cs
|
|
370
|
+
*.xsd.cs
|
|
371
|
+
|
|
372
|
+
# OpenCover UI analysis results
|
|
373
|
+
OpenCover/
|
|
374
|
+
|
|
375
|
+
# Azure Stream Analytics local run output
|
|
376
|
+
ASALocalRun/
|
|
377
|
+
|
|
378
|
+
# MSBuild Binary and Structured Log
|
|
379
|
+
*.binlog
|
|
380
|
+
|
|
381
|
+
# NVidia Nsight GPU debugger configuration file
|
|
382
|
+
*.nvuser
|
|
383
|
+
|
|
384
|
+
# MFractors (Xamarin productivity tool) working folder
|
|
385
|
+
.mfractor/
|
|
386
|
+
|
|
387
|
+
# Local History for Visual Studio
|
|
388
|
+
.localhistory/
|
|
389
|
+
.vscode/*
|
|
390
|
+
!.vscode/settings.json
|
|
391
|
+
!.vscode/tasks.json
|
|
392
|
+
!.vscode/launch.json
|
|
393
|
+
!.vscode/extensions.json
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 kmasa
|
|
4
|
+
|
|
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 all
|
|
13
|
+
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# win32-systray
|
|
2
|
+
ruby gems, easy to make system tray application for windows
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'win32-systray'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle install
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install win32-systray
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
require "win32/systray"
|
|
25
|
+
|
|
26
|
+
Win32::Systray.run! do |sys|
|
|
27
|
+
sys.tip = "pnow"
|
|
28
|
+
sys.icon = File.join(__dir__, "pnow.ico")
|
|
29
|
+
|
|
30
|
+
sys.menu do
|
|
31
|
+
sys.popup "テスト1" do
|
|
32
|
+
sys.item "テスト2" do
|
|
33
|
+
puts "hi test2"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
sys.separator
|
|
37
|
+
sys.item "終了" do
|
|
38
|
+
sys.quit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Contributing
|
|
46
|
+
|
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kmasa/win32-systray.
|
|
48
|
+
|
data/Rakefile
ADDED
data/example/pnow.ico
ADDED
|
Binary file
|
data/example/run.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "win32/systray"
|
|
2
|
+
|
|
3
|
+
Win32::Systray.run! do |sys|
|
|
4
|
+
sys.tip = "pnow"
|
|
5
|
+
sys.icon = File.join(__dir__, "pnow.ico")
|
|
6
|
+
|
|
7
|
+
sys.menu do
|
|
8
|
+
sys.popup "テスト1" do
|
|
9
|
+
sys.item "テスト2" do
|
|
10
|
+
puts "hi test2"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
sys.separator
|
|
14
|
+
sys.item "終了" do
|
|
15
|
+
sys.quit
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
3
|
+
# Visual Studio Version 17
|
|
4
|
+
VisualStudioVersion = 17.6.33829.357
|
|
5
|
+
MinimumVisualStudioVersion = 10.0.40219.1
|
|
6
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "systray", "systray.vcxproj", "{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}"
|
|
7
|
+
EndProject
|
|
8
|
+
Global
|
|
9
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
10
|
+
Debug|x64 = Debug|x64
|
|
11
|
+
Debug|x86 = Debug|x86
|
|
12
|
+
Release|x64 = Release|x64
|
|
13
|
+
Release|x86 = Release|x86
|
|
14
|
+
EndGlobalSection
|
|
15
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
16
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Debug|x64.ActiveCfg = Debug|x64
|
|
17
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Debug|x64.Build.0 = Debug|x64
|
|
18
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Debug|x86.ActiveCfg = Debug|Win32
|
|
19
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Debug|x86.Build.0 = Debug|Win32
|
|
20
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Release|x64.ActiveCfg = Release|x64
|
|
21
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Release|x64.Build.0 = Release|x64
|
|
22
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Release|x86.ActiveCfg = Release|Win32
|
|
23
|
+
{4A3F9E70-D5E7-4087-B1BA-A1F7A3A2E329}.Release|x86.Build.0 = Release|Win32
|
|
24
|
+
EndGlobalSection
|
|
25
|
+
GlobalSection(SolutionProperties) = preSolution
|
|
26
|
+
HideSolutionNode = FALSE
|
|
27
|
+
EndGlobalSection
|
|
28
|
+
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
29
|
+
SolutionGuid = {8C389F4E-4F76-407E-8AE0-362B92D0E2D2}
|
|
30
|
+
EndGlobalSection
|
|
31
|
+
EndGlobal
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
+
<ProjectConfiguration Include="Debug|Win32">
|
|
5
|
+
<Configuration>Debug</Configuration>
|
|
6
|
+
<Platform>Win32</Platform>
|
|
7
|
+
</ProjectConfiguration>
|
|
8
|
+
<ProjectConfiguration Include="Release|Win32">
|
|
9
|
+
<Configuration>Release</Configuration>
|
|
10
|
+
<Platform>Win32</Platform>
|
|
11
|
+
</ProjectConfiguration>
|
|
12
|
+
<ProjectConfiguration Include="Debug|x64">
|
|
13
|
+
<Configuration>Debug</Configuration>
|
|
14
|
+
<Platform>x64</Platform>
|
|
15
|
+
</ProjectConfiguration>
|
|
16
|
+
<ProjectConfiguration Include="Release|x64">
|
|
17
|
+
<Configuration>Release</Configuration>
|
|
18
|
+
<Platform>x64</Platform>
|
|
19
|
+
</ProjectConfiguration>
|
|
20
|
+
</ItemGroup>
|
|
21
|
+
<PropertyGroup Label="Globals">
|
|
22
|
+
<VCProjectVersion>16.0</VCProjectVersion>
|
|
23
|
+
<Keyword>Win32Proj</Keyword>
|
|
24
|
+
<ProjectGuid>{4a3f9e70-d5e7-4087-b1ba-a1f7a3a2e329}</ProjectGuid>
|
|
25
|
+
<RootNamespace>systray</RootNamespace>
|
|
26
|
+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
27
|
+
</PropertyGroup>
|
|
28
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
29
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
30
|
+
<ConfigurationType>Application</ConfigurationType>
|
|
31
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
|
32
|
+
<PlatformToolset>v143</PlatformToolset>
|
|
33
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
34
|
+
</PropertyGroup>
|
|
35
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
36
|
+
<ConfigurationType>Application</ConfigurationType>
|
|
37
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
|
38
|
+
<PlatformToolset>v143</PlatformToolset>
|
|
39
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
40
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
41
|
+
</PropertyGroup>
|
|
42
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
43
|
+
<ConfigurationType>Application</ConfigurationType>
|
|
44
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
|
45
|
+
<PlatformToolset>v143</PlatformToolset>
|
|
46
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
47
|
+
</PropertyGroup>
|
|
48
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
49
|
+
<ConfigurationType>Application</ConfigurationType>
|
|
50
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
|
51
|
+
<PlatformToolset>v143</PlatformToolset>
|
|
52
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
53
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
54
|
+
</PropertyGroup>
|
|
55
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
56
|
+
<ImportGroup Label="ExtensionSettings">
|
|
57
|
+
</ImportGroup>
|
|
58
|
+
<ImportGroup Label="Shared">
|
|
59
|
+
</ImportGroup>
|
|
60
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
61
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
62
|
+
</ImportGroup>
|
|
63
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
64
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
65
|
+
</ImportGroup>
|
|
66
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
67
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
68
|
+
</ImportGroup>
|
|
69
|
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
70
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
71
|
+
</ImportGroup>
|
|
72
|
+
<PropertyGroup Label="UserMacros" />
|
|
73
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
74
|
+
<ClCompile>
|
|
75
|
+
<WarningLevel>Level3</WarningLevel>
|
|
76
|
+
<SDLCheck>true</SDLCheck>
|
|
77
|
+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
78
|
+
<ConformanceMode>true</ConformanceMode>
|
|
79
|
+
</ClCompile>
|
|
80
|
+
<Link>
|
|
81
|
+
<SubSystem>Console</SubSystem>
|
|
82
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
83
|
+
</Link>
|
|
84
|
+
</ItemDefinitionGroup>
|
|
85
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
86
|
+
<ClCompile>
|
|
87
|
+
<WarningLevel>Level3</WarningLevel>
|
|
88
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
89
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
90
|
+
<SDLCheck>true</SDLCheck>
|
|
91
|
+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
92
|
+
<ConformanceMode>true</ConformanceMode>
|
|
93
|
+
</ClCompile>
|
|
94
|
+
<Link>
|
|
95
|
+
<SubSystem>Console</SubSystem>
|
|
96
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
97
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
98
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
99
|
+
</Link>
|
|
100
|
+
</ItemDefinitionGroup>
|
|
101
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
102
|
+
<ClCompile>
|
|
103
|
+
<WarningLevel>Level3</WarningLevel>
|
|
104
|
+
<SDLCheck>true</SDLCheck>
|
|
105
|
+
<PreprocessorDefinitions>EXE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
106
|
+
<ConformanceMode>true</ConformanceMode>
|
|
107
|
+
</ClCompile>
|
|
108
|
+
<Link>
|
|
109
|
+
<SubSystem>Windows</SubSystem>
|
|
110
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
111
|
+
</Link>
|
|
112
|
+
</ItemDefinitionGroup>
|
|
113
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
114
|
+
<ClCompile>
|
|
115
|
+
<WarningLevel>Level3</WarningLevel>
|
|
116
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
117
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
118
|
+
<SDLCheck>true</SDLCheck>
|
|
119
|
+
<PreprocessorDefinitions>EXE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
120
|
+
<ConformanceMode>true</ConformanceMode>
|
|
121
|
+
</ClCompile>
|
|
122
|
+
<Link>
|
|
123
|
+
<SubSystem>Console</SubSystem>
|
|
124
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
125
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
126
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
127
|
+
</Link>
|
|
128
|
+
</ItemDefinitionGroup>
|
|
129
|
+
<ItemGroup>
|
|
130
|
+
<ClCompile Include="..\..\systray.cpp" />
|
|
131
|
+
</ItemGroup>
|
|
132
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
133
|
+
<ImportGroup Label="ExtensionTargets">
|
|
134
|
+
</ImportGroup>
|
|
135
|
+
</Project>
|
|
@@ -0,0 +1,22 @@
|
|
|
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>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
6
|
+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
7
|
+
</Filter>
|
|
8
|
+
<Filter Include="ヘッダー ファイル">
|
|
9
|
+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
10
|
+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
|
11
|
+
</Filter>
|
|
12
|
+
<Filter Include="リソース ファイル">
|
|
13
|
+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
14
|
+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
15
|
+
</Filter>
|
|
16
|
+
</ItemGroup>
|
|
17
|
+
<ItemGroup>
|
|
18
|
+
<ClCompile Include="..\..\systray.cpp">
|
|
19
|
+
<Filter>ソース ファイル</Filter>
|
|
20
|
+
</ClCompile>
|
|
21
|
+
</ItemGroup>
|
|
22
|
+
</Project>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#ifndef EXE
|
|
2
|
+
#define UNICODE
|
|
3
|
+
#endif
|
|
4
|
+
|
|
5
|
+
#include <windows.h>
|
|
6
|
+
#include <map>
|
|
7
|
+
#include <vector>
|
|
8
|
+
|
|
9
|
+
#ifdef SYSTRAY_IMPORT
|
|
10
|
+
#define DLLIF __declspec(dllimport)
|
|
11
|
+
#else
|
|
12
|
+
#define DLLIF extern "C" __declspec(dllexport)
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
typedef void (*Action)();
|
|
16
|
+
|
|
17
|
+
DLLIF void Systray(const wchar_t* tip, const wchar_t* icon_path, void (*Action)());
|
|
18
|
+
DLLIF void Quit();
|
|
19
|
+
DLLIF void* MenuPopup(const wchar_t* text, void (*Action)());
|
|
20
|
+
DLLIF void* MenuItem(const wchar_t* text, void (*Action)());
|
|
21
|
+
DLLIF void* MenuSeparator();
|
|
22
|
+
|
|
23
|
+
static Action _MenuCreateCallbackType;
|
|
24
|
+
static std::vector<HMENU> vecHMENU;
|
|
25
|
+
static std::map<int, Action> map_MenuCreateCallbackType;
|
|
26
|
+
static std::map<HMENU, int> s_counter;
|
|
27
|
+
static int menu_id = 100;
|
|
28
|
+
static HWND s_hwnd = 0;
|
|
29
|
+
#define ID_MYTRAY (WM_APP + 1)
|
|
30
|
+
#define MYTRAY_MESSAGE (WM_APP + 2)
|
|
31
|
+
|
|
32
|
+
DLLIF void Quit()
|
|
33
|
+
{
|
|
34
|
+
PostMessage(s_hwnd, WM_QUIT, 0, 0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
|
|
38
|
+
|
|
39
|
+
if (msg == WM_COMMAND)
|
|
40
|
+
{
|
|
41
|
+
auto fn = map_MenuCreateCallbackType[LOWORD(wp)];
|
|
42
|
+
if (fn) {
|
|
43
|
+
fn();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (msg == MYTRAY_MESSAGE) {
|
|
47
|
+
if (lp == WM_RBUTTONUP)
|
|
48
|
+
{
|
|
49
|
+
s_counter.clear();
|
|
50
|
+
menu_id = 0;
|
|
51
|
+
vecHMENU.clear();
|
|
52
|
+
|
|
53
|
+
auto hMenu = CreateMenu();
|
|
54
|
+
vecHMENU.push_back(hMenu);
|
|
55
|
+
s_counter[hMenu] = 0;
|
|
56
|
+
HMENU sub = (HMENU)MenuPopup(L"", []() {
|
|
57
|
+
_MenuCreateCallbackType();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
POINT pt;
|
|
61
|
+
GetCursorPos(&pt);
|
|
62
|
+
SetForegroundWindow(hwnd);
|
|
63
|
+
TrackPopupMenu(sub, TPM_NONOTIFY | TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, hwnd, 0);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return DefWindowProc(hwnd, msg, wp, lp);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// �E�C���h�E�쐬
|
|
71
|
+
// �E�C���h�E�v���V�[�W��
|
|
72
|
+
// �R�[���o�b�N�o�^
|
|
73
|
+
|
|
74
|
+
void Systray(const wchar_t* tip, const wchar_t* icon_path, Action mcb)
|
|
75
|
+
{
|
|
76
|
+
_MenuCreateCallbackType = mcb;
|
|
77
|
+
HWND hwnd;
|
|
78
|
+
WNDCLASS winc;
|
|
79
|
+
|
|
80
|
+
winc.style = CS_HREDRAW | CS_VREDRAW;
|
|
81
|
+
winc.lpfnWndProc = WndProc;
|
|
82
|
+
winc.cbClsExtra = winc.cbWndExtra = 0;
|
|
83
|
+
winc.hInstance = 0;
|
|
84
|
+
winc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
|
85
|
+
winc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
86
|
+
winc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
87
|
+
winc.lpszMenuName = NULL;
|
|
88
|
+
winc.lpszClassName = TEXT("KITTY");
|
|
89
|
+
|
|
90
|
+
if (!RegisterClass(&winc)) return;
|
|
91
|
+
|
|
92
|
+
hwnd = CreateWindow(
|
|
93
|
+
TEXT("KITTY"), TEXT("Kitty on your lap"),
|
|
94
|
+
WS_OVERLAPPEDWINDOW | ~WS_VISIBLE,
|
|
95
|
+
100, 100, 200, 200, NULL, NULL,
|
|
96
|
+
0, NULL
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
HICON hicon = 0;
|
|
100
|
+
if (icon_path != 0) {
|
|
101
|
+
//hicon = LoadIcon(0, icon_path);
|
|
102
|
+
hicon = (HICON)LoadImageW(0, icon_path, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
|
|
103
|
+
int n = GetLastError();
|
|
104
|
+
int nn = 0;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
hicon = ExtractIcon(0, L"C:\\WINDOWS\\SYSTEM32\\INETCPL.CPL", 21); // # Green tick
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
NOTIFYICONDATA dt;
|
|
111
|
+
|
|
112
|
+
dt.cbSize = sizeof(dt);
|
|
113
|
+
dt.hWnd = (HWND)hwnd;
|
|
114
|
+
dt.uID = ID_MYTRAY;
|
|
115
|
+
dt.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
|
116
|
+
dt.hIcon = hicon; // @icon;
|
|
117
|
+
dt.uCallbackMessage = MYTRAY_MESSAGE;
|
|
118
|
+
wcscpy_s(dt.szTip, tip);
|
|
119
|
+
|
|
120
|
+
Shell_NotifyIcon(NIM_ADD, &dt);
|
|
121
|
+
|
|
122
|
+
MSG msg;
|
|
123
|
+
BOOL bRet;
|
|
124
|
+
|
|
125
|
+
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
|
|
126
|
+
{
|
|
127
|
+
if (bRet == -1)
|
|
128
|
+
{
|
|
129
|
+
// handle the error and possibly exit
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
{
|
|
133
|
+
TranslateMessage(&msg);
|
|
134
|
+
DispatchMessage(&msg);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Shell_NotifyIcon(NIM_DELETE, &dt);
|
|
139
|
+
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
DLLIF void* MenuPopup(const wchar_t* text, Action mcb)
|
|
144
|
+
{
|
|
145
|
+
auto hMenu = CreateMenu();
|
|
146
|
+
s_counter[hMenu] = 0;
|
|
147
|
+
vecHMENU.push_back(hMenu);
|
|
148
|
+
mcb();
|
|
149
|
+
vecHMENU.pop_back();
|
|
150
|
+
|
|
151
|
+
MENUITEMINFO mii;
|
|
152
|
+
::ZeroMemory(&mii, sizeof(mii));
|
|
153
|
+
mii.cbSize = sizeof(mii);
|
|
154
|
+
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
|
|
155
|
+
mii.fMask |= MIIM_SUBMENU; // if @menu
|
|
156
|
+
mii.fType = MFT_STRING;
|
|
157
|
+
mii.hSubMenu = hMenu; //if @menu
|
|
158
|
+
mii.fState = 0; ///@check ? MFS_CHECKED : 0;
|
|
159
|
+
mii.wID = menu_id++;
|
|
160
|
+
mii.dwTypeData = (LPWSTR)text;
|
|
161
|
+
|
|
162
|
+
auto parent = vecHMENU.back();
|
|
163
|
+
|
|
164
|
+
InsertMenuItem(parent, s_counter[parent], 1, &mii);
|
|
165
|
+
s_counter[parent] += 1;
|
|
166
|
+
|
|
167
|
+
return hMenu;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
DLLIF void* MenuItem(const wchar_t* text, Action mcb)
|
|
171
|
+
{
|
|
172
|
+
map_MenuCreateCallbackType[menu_id] = mcb;
|
|
173
|
+
|
|
174
|
+
MENUITEMINFO mii;
|
|
175
|
+
::ZeroMemory(&mii, sizeof(mii));
|
|
176
|
+
mii.cbSize = sizeof(mii);
|
|
177
|
+
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
|
|
178
|
+
//mii.fMask |= MIIM_SUBMENU; // if @menu
|
|
179
|
+
mii.fType = MFT_STRING;
|
|
180
|
+
//mii.hSubMenu = hMenu; //if @menu
|
|
181
|
+
mii.fState = 0; ///@check ? MFS_CHECKED : 0;
|
|
182
|
+
mii.wID = menu_id++;
|
|
183
|
+
mii.dwTypeData = (LPWSTR)text;
|
|
184
|
+
|
|
185
|
+
auto parent = vecHMENU.back();
|
|
186
|
+
|
|
187
|
+
InsertMenuItem(parent, s_counter[parent], 1, &mii);
|
|
188
|
+
s_counter[parent] += 1;
|
|
189
|
+
|
|
190
|
+
return 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
DLLIF void* MenuSeparator()
|
|
194
|
+
{
|
|
195
|
+
MENUITEMINFO mii;
|
|
196
|
+
::ZeroMemory(&mii, sizeof(mii));
|
|
197
|
+
mii.fMask = MIIM_TYPE;
|
|
198
|
+
mii.cbSize = sizeof(mii);
|
|
199
|
+
mii.fType = MF_SEPARATOR;
|
|
200
|
+
|
|
201
|
+
auto parent = vecHMENU.back();
|
|
202
|
+
InsertMenuItem(parent, s_counter[parent], 1, &mii);
|
|
203
|
+
s_counter[parent] += 1;
|
|
204
|
+
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
#ifdef EXE
|
|
209
|
+
static void MenuCreateCallbackTypeFn()
|
|
210
|
+
{
|
|
211
|
+
MenuPopup(L"�e�X�g", []() {
|
|
212
|
+
MenuItem(L"�e�X�g", []() {
|
|
213
|
+
int n = 0;
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
MenuItem(L"�e�X�g2", []() {
|
|
217
|
+
int n = 0;
|
|
218
|
+
});
|
|
219
|
+
MenuSeparator();
|
|
220
|
+
MenuItem(L"�I��", []() {
|
|
221
|
+
int n = 0;
|
|
222
|
+
Quit();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|
227
|
+
PSTR lpCmdLine, int nCmdShow)
|
|
228
|
+
{
|
|
229
|
+
Systray(L"tip", L"pnow.ico", MenuCreateCallbackTypeFn);
|
|
230
|
+
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
#endif
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require "win32/systray/version"
|
|
2
|
+
|
|
3
|
+
require "fiddle/import"
|
|
4
|
+
|
|
5
|
+
module Win32
|
|
6
|
+
module ApiSystray
|
|
7
|
+
extend Fiddle::Importer
|
|
8
|
+
dlload File.join(__dir__, "systray.dll")
|
|
9
|
+
|
|
10
|
+
extern "void Systray(const wchar_t* tip, const wchar_t* icon_path, void*);"
|
|
11
|
+
extern "void Quit();"
|
|
12
|
+
extern "void* MenuPopup(const wchar_t* text, void void*);"
|
|
13
|
+
extern "void* MenuItem(const wchar_t* text, void void*);"
|
|
14
|
+
extern "void* MenuSeparator();"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Systray
|
|
18
|
+
attr_accessor :tip, :icon
|
|
19
|
+
def Systray.run!(&b)
|
|
20
|
+
t = Systray.new(&b)
|
|
21
|
+
t.run!
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def initialize(&b)
|
|
25
|
+
@menu_stack = []
|
|
26
|
+
@menu_root = nil
|
|
27
|
+
b.call(self)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def run!()
|
|
31
|
+
ApiSystray.Systray(@tip&.encode("UTF-16LE"), @icon&.encode("UTF-16LE"), @block)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def menu(&b)
|
|
35
|
+
@block = ApiSystray.bind("void Action()", &b)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def popup(text, &block)
|
|
39
|
+
b = ApiSystray.bind("void Action()", &block)
|
|
40
|
+
ApiSystray.MenuPopup(text.encode("UTF-16LE"), b)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def item(text, &block)
|
|
44
|
+
b = ApiSystray.bind("void Action()", &block)
|
|
45
|
+
ApiSystray.MenuItem(text.encode("UTF-16LE"), b)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def separator
|
|
49
|
+
ApiSystray.MenuSeparator()
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def quit
|
|
53
|
+
ApiSystray.Quit()
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_relative "lib/win32/systray/version"
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "win32-systray"
|
|
5
|
+
spec.version = Win32::Systray::VERSION
|
|
6
|
+
spec.authors = ["Kimihiko Masamoto"]
|
|
7
|
+
spec.email = ["kmasamoto1980@gmail.com"]
|
|
8
|
+
|
|
9
|
+
spec.summary = %q{easy to make system tray application for windows}
|
|
10
|
+
spec.description = %q{easy to make system tray application for windows, few dependency light weight, forcus for windows}
|
|
11
|
+
spec.homepage = "https://rubygems.org/gems/win32-systray"
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
13
|
+
|
|
14
|
+
#spec.metadata["allowed_push_host"] = "https://github.com/kmasa/win32-systray"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/kmasa/win32-systray"
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/kmasa/win32-systray/blob/main/CHANGELOG.md"
|
|
19
|
+
|
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
24
|
+
end
|
|
25
|
+
spec.bindir = "exe"
|
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
|
+
spec.require_paths = ["lib"]
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: win32-systray
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kimihiko Masamoto
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2023-07-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: easy to make system tray application for windows, few dependency light
|
|
14
|
+
weight, forcus for windows
|
|
15
|
+
email:
|
|
16
|
+
- kmasamoto1980@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- ".gitignore"
|
|
22
|
+
- CHANGELOG.md
|
|
23
|
+
- Gemfile
|
|
24
|
+
- LICENSE
|
|
25
|
+
- README.md
|
|
26
|
+
- Rakefile
|
|
27
|
+
- example/pnow.ico
|
|
28
|
+
- example/run.rb
|
|
29
|
+
- lib/win32/c/build.bat
|
|
30
|
+
- lib/win32/c/msvc/systray/pnow.ico
|
|
31
|
+
- lib/win32/c/msvc/systray/systray.sln
|
|
32
|
+
- lib/win32/c/msvc/systray/systray.vcxproj
|
|
33
|
+
- lib/win32/c/msvc/systray/systray.vcxproj.filters
|
|
34
|
+
- lib/win32/c/systray.cpp
|
|
35
|
+
- lib/win32/systray.dll
|
|
36
|
+
- lib/win32/systray.rb
|
|
37
|
+
- lib/win32/systray/version.rb
|
|
38
|
+
- win32-systray.gemspec
|
|
39
|
+
homepage: https://rubygems.org/gems/win32-systray
|
|
40
|
+
licenses: []
|
|
41
|
+
metadata:
|
|
42
|
+
homepage_uri: https://rubygems.org/gems/win32-systray
|
|
43
|
+
source_code_uri: https://github.com/kmasa/win32-systray
|
|
44
|
+
changelog_uri: https://github.com/kmasa/win32-systray/blob/main/CHANGELOG.md
|
|
45
|
+
post_install_message:
|
|
46
|
+
rdoc_options: []
|
|
47
|
+
require_paths:
|
|
48
|
+
- lib
|
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 2.7.0
|
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
requirements: []
|
|
60
|
+
rubygems_version: 3.1.2
|
|
61
|
+
signing_key:
|
|
62
|
+
specification_version: 4
|
|
63
|
+
summary: easy to make system tray application for windows
|
|
64
|
+
test_files: []
|