Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a3e3ef4b1 | |||
| b0a14f731a | |||
| b12bfe08be | |||
| febb3bda2f | |||
| 2d90c60a1c | |||
| 382428e6fa | |||
| 1f8fb92dbe | |||
| 14ee12cb85 | |||
| 56e6a5b6b2 | |||
| 251b965073 | |||
| b855b0d624 | |||
| 0403415607 | |||
| 18959b1ef0 | |||
| 4299d9b89f | |||
| 049375a2d7 | |||
| 5bf973347f | |||
| b71793cfed | |||
| 0150121c02 | |||
|
|
8303665159 | ||
| f2ef0f9bb4 | |||
| 10db7316fa | |||
| 5e9a553b67 | |||
| e74c775f90 | |||
| aadba59546 | |||
| b58039b4ab | |||
| 9dd557311e | |||
| 8df89dc8e1 | |||
| cf16651ae2 | |||
| 9fe46f867c | |||
| bb904723fa | |||
| eaed0ae8dc | |||
| 854a9a473b | |||
|
|
61b5f1d39c | ||
| 1dd9883f42 | |||
| 90b281d3a5 | |||
| bf609d3c08 | |||
| 582cce5b20 | |||
| 710d9d9d3e | |||
| b6a6ec685d | |||
| 28ea979492 | |||
| 8cd54374ab | |||
| 9b3b505ec6 | |||
| d81f43b4a3 | |||
| a1db2f16e9 | |||
| 117c4f780f | |||
| 266afddfe5 | |||
| 6b3a90d682 | |||
| 0f8304ef23 | |||
| c035b8a980 | |||
| cc2e5b5654 | |||
| 1929e3dc4f | |||
| 93ea96bca0 | |||
| 6fb8d35643 | |||
| 7d0e5ee0a7 | |||
| 146208bd03 | |||
| 342c6e3009 | |||
| bcf45417d8 | |||
| 2763bbd12d | |||
| a256184737 | |||
| 2510b74aa1 | |||
| 96940111aa | |||
| bad4d37e7a | |||
| fe10e4ec72 | |||
| 6edbf1f9c6 | |||
| 79acd5d110 | |||
| 4d503f6421 | |||
| dcf844ddd3 | |||
| 517cfdcc82 | |||
| 5c3e15b949 | |||
| 790ae9ab67 | |||
| 52364a228a | |||
|
|
73b91259c8 | ||
| cb01a4b815 | |||
| e15f08d521 | |||
| 28de2585a8 | |||
| 3cd3faea01 | |||
| 19660bb346 | |||
| b332c7476f | |||
| d5b3ef1040 | |||
| 76099356cd | |||
| 750ac44696 | |||
| 0a0fe05555 | |||
| b6a0f9a3c5 | |||
| e7c06ec4b6 | |||
| f58e6a99cb | |||
| b5e040f3d5 | |||
| fee7025323 | |||
|
|
6c9855ab38 | ||
|
|
3f438f6038 | ||
| 7491ed2ca7 | |||
| 166cdd0d88 | |||
| d1ab2b86e2 | |||
| 690f621f5b | |||
| 01eb9075b4 | |||
| 5137eed759 | |||
| b8d3db9289 | |||
| a4af63ed34 | |||
|
|
f394d436cf |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -6,6 +6,7 @@
|
|||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
[Vv]ersion.h
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
@@ -326,7 +327,7 @@ var/
|
|||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
*.manifest
|
#*.manifest
|
||||||
*.spec
|
*.spec
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
@@ -436,3 +437,7 @@ lightgbm.Rcheck/
|
|||||||
# GraphViz artifacts
|
# GraphViz artifacts
|
||||||
*.gv
|
*.gv
|
||||||
*.gv.*
|
*.gv.*
|
||||||
|
|
||||||
|
/wCenterWindow/VersionInfo.h
|
||||||
|
[Pp]atches/
|
||||||
|
*.patch
|
||||||
|
|||||||
25
README.md
25
README.md
@@ -1,6 +1,23 @@
|
|||||||
# wCenterWindow
|
## wCenterWindow
|
||||||
This program centers the current active window by a 'LCTRL + LWIN + C' hotkey.
|
|
||||||
|
|
||||||
'LCTRL + LWIN + I' hotkey - hide tray icon.
|
This program centers the current active window by a `LCTRL + LWIN + C` hotkey,
|
||||||
|
or pressing `LCTRL + LWIN + MMB` (Middle Mouse Button).
|
||||||
|
|
||||||
You can also use commandline option '/hide' for hide trayicon at startup.
|
`LCTRL + LWIN + V` - manual editing of size and position of the window.
|
||||||
|
|
||||||
|
You can use `LCTRL + LWIN + I` hotkey for hide/show trayicon.
|
||||||
|
You can also use commandline option `/hide` for hide trayicon at startup.
|
||||||
|
The `/noupdate` option is used to disable check for updates. By default, the check is repeated once a day.
|
||||||
|
|
||||||
|
`Use workarea` option means that the window is centered without a taskbar, otherwise, the full resolution of the monitor will be used.
|
||||||
|
|
||||||
|
If some windows does not centers you should run wCenterWindow with administrative rights.
|
||||||
|
|
||||||
|
## Automatic startup
|
||||||
|
|
||||||
|
Usually, to start the application when Windows starts, it is enough to put the application's shortcut in the "Startup" folder -\
|
||||||
|
"C:\Users\\<*Your user name*>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup". (The easiest way to get there - press 'WIN + R' and type 'shell:startup').\
|
||||||
|
However, in this case wCenterWindow will not be able to work with windows that are open with elevated privileges.
|
||||||
|
And if you enable the "Run as administrator" option in the shortcut, then wCenterWindow will not start. This is related to the security of Windows (maybe only in 10/11, I did not check).\
|
||||||
|
This behavior can be bypassed by creating a task in the Task Scheduler with the "Run with highest privileges" option.\
|
||||||
|
**Note:** If you run wCenterWindow via the Task Scheduler, I highly recommend enabling the "Delay task for" option for 15-30 seconds, otherwise you may get an error message "Can't create tray icon".
|
||||||
|
|||||||
173
Update_Version.ps1
Normal file
173
Update_Version.ps1
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
# Update Version v2.1
|
||||||
|
# Required module: PSIni
|
||||||
|
# Installation: Install-Module -Name PsIni
|
||||||
|
|
||||||
|
$date = Get-Date
|
||||||
|
|
||||||
|
function addLeadingZero([int]$nvar) {
|
||||||
|
[string]$svar = $null
|
||||||
|
if ($nvar -lt 10) { $svar = '0' + $nvar.ToString() }
|
||||||
|
else { $svar = $nvar.ToString() }
|
||||||
|
return $svar
|
||||||
|
}
|
||||||
|
|
||||||
|
function getValue([string]$var) {
|
||||||
|
switch -CaseSensitive ($var) {
|
||||||
|
"%y" { $var = $currentYear; break }
|
||||||
|
"%m" { $var = $currentMonth; break }
|
||||||
|
"%d" { $var = $currentDay; break }
|
||||||
|
"%t" { $var = -join ((addLeadingZero($currentHour)), (addLeadingZero($currentMinute)), (addLeadingZero($currentSecond))); break }
|
||||||
|
"%D" { $var = $spanDays; break }
|
||||||
|
"%S" { $var = $spanSecs; break }
|
||||||
|
"%C" { $var = $gitCommitCount; break }
|
||||||
|
"%c" { $var = $gitRevCount; break }
|
||||||
|
}
|
||||||
|
return $var
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeVersionString([string]$vmaj, [string]$vmin, [string]$vbld, [string]$vrev) {
|
||||||
|
[string]$vstr = $null
|
||||||
|
if ($vmin -eq "") { $vmin = $vbld = $vrev = 0; $vstr = ($vmaj) -join '.' }
|
||||||
|
else {
|
||||||
|
if ($vbld -eq "") { $vbld = $vrev = 0; $vstr = ($vmaj, $vmin) -join '.' }
|
||||||
|
else {
|
||||||
|
if ($vrev -eq "") { $vrev = 0; $vstr = ($vmaj, $vmin, $vbld) -join '.' }
|
||||||
|
else { $vstr = ($vmaj, $vmin, $vbld, $vrev) -join '.' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[string]$nstr = ($vmaj, $vmin, $vbld, $vrev) -join ','
|
||||||
|
return @($vstr, $nstr)
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Initializing variables
|
||||||
|
[string]$verMajor = [string]$verMinor = [string]$verBuild = [string]$verPatch = $null
|
||||||
|
[string]$pn = [string]$pa = [string]$aboutBuild = [string]$pnf = [string]$pcf = $null
|
||||||
|
[string]$buildDateTime = [string]$vs = [string]$vn = [string]$intName = [string]$origName = $null
|
||||||
|
[int]$pys = [int]$spanDays = [int]$spanSecs = $null
|
||||||
|
[int]$currentYear = [int]$currentMonth = [int]$currentDay = [int]$currentHour = [int]$currentMinute = [int]$currentSecond = $null
|
||||||
|
[string]$iniFile = ".\Version.ini"
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (-not (Test-Path $iniFile)) {
|
||||||
|
Write-Error "Can't find file '$iniFile'"
|
||||||
|
# Start-Sleep -Seconds 3
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[bool]$isGit = $false
|
||||||
|
if (Test-Path ".\.git") {
|
||||||
|
$isGit = $true
|
||||||
|
[int]$gitCommitCount = [int]$gitRevCount = $null
|
||||||
|
[string]$gitRevDate = [string]$gitVerStr = [string]$gitAHash = $null
|
||||||
|
$gitCommitCount = $(git rev-list --count HEAD)
|
||||||
|
$gitRevDate = $(git log -1 HEAD --date=rfc --pretty=format:%ad%n)
|
||||||
|
$gitVerStr = $(git describe HEAD --long)
|
||||||
|
if ($LastExitCode -eq 0) {
|
||||||
|
$gitVerStr = $gitVerStr.Replace('-g', '-')
|
||||||
|
$gitRevCount = $gitVerStr.Split('-')[-2]
|
||||||
|
$gitAHash = $gitVerStr.Split('-')[-1]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$gitVerStr = ""
|
||||||
|
$gitRevCount = 0
|
||||||
|
$gitAHash = $(git describe HEAD --always)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Reading values from INI file
|
||||||
|
$config = $null
|
||||||
|
$config = (Get-IniContent -FilePath $iniFile)["Config"]
|
||||||
|
$verMajor = $config.Major
|
||||||
|
$verMinor = $config.Minor
|
||||||
|
$verBuild = $config.Build
|
||||||
|
$verPatch = $config.Patch
|
||||||
|
$pys = $config.ProductYearStart
|
||||||
|
$pn = $config.ProductName
|
||||||
|
$pa = $config.ProductAutors
|
||||||
|
$pd = $config.ProductDescription
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if ($verMajor -eq "") {
|
||||||
|
Write-Error "Major version cannot be empty!"
|
||||||
|
# Start-Sleep -Seconds 3
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Variables preparation
|
||||||
|
$currentYear = $date.Year
|
||||||
|
$currentMonth = $date.Month
|
||||||
|
$currentDay = $date.Day
|
||||||
|
$currentHour = $date.Hour
|
||||||
|
$currentMinute = $date.Minute
|
||||||
|
$currentSecond = $date.Second
|
||||||
|
$buildDateTime = "Build date: $($date.GetDateTimeFormats('u').Replace('Z', ''))"
|
||||||
|
$spanDays = [math]::Round((New-TimeSpan -Start $(Get-Date -Month 1 -Day 1 -Year 2000) -End $date).TotalDays)
|
||||||
|
$spanSecs = [math]::Round((New-TimeSpan -Start $($date.Date) -End $($date.DateTime)).TotalSeconds)
|
||||||
|
if ($pys -eq $currentYear) { $pcf = "Copyright (C) $pys by $pa" } else { $pcf = "Copyright (C) $pys-$currentYear by $pa" }
|
||||||
|
$intName = "$pn-C++"
|
||||||
|
$origName = "$pn.exe"
|
||||||
|
$verMajor = getValue $verMajor
|
||||||
|
$verMinor = getValue $verMinor
|
||||||
|
$verBuild = getValue $verBuild
|
||||||
|
$verPatch = getValue $verPatch
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
$vs = (makeVersionString $verMajor $verMinor $verBuild $verPatch)[0]
|
||||||
|
$vn = (makeVersionString $verMajor $verMinor $verBuild $verPatch)[1]
|
||||||
|
|
||||||
|
# if ([string]::IsNullOrEmpty($gitVerStr)) { $pnf = "$pn v$vs" } else { $pnf = "$pn $gitVerStr" }
|
||||||
|
if ($isGit) {
|
||||||
|
$aboutBuild = "Git date: $gitRevDate"
|
||||||
|
$pnf = "$pn v$vs ($gitAHash)"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$aboutBuild = $buildDateTime
|
||||||
|
$pnf = "$pn v$vs"
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Save all variables to file
|
||||||
|
"// $pn" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode
|
||||||
|
"// VersionInfo.h" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#pragma once" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define PRODUCT_NAME `"$pn`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define PRODUCT_NAME_FULL `"$pnf`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define PRODUCT_AUTHORS `"$pa`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define PRODUCT_DESCRIPTION `"$pd`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define ABOUT_BUILD `"$aboutBuild`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define INTERNAL_NAME `"$intName`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define ORIG_FILE_NAME `"$origName`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define PRODUCT_COPYRIGHT `"$pcf`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define VERSION_STR `"$vs`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
"#define VERSION_NUM $vn" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# "#define SPAN_DAYS $spanDays" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# "#define SPAN_SECS $spanSecs" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
|
||||||
|
# if ($isGit) {
|
||||||
|
# # "#define GIT_VERSION_STR `"$gitVerStr`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# # "#define GIT_REV_DATE `"Git date: $gitRevDate`"" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# # "#define GIT_REV_COUNT $gitRevCount" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# # "#define GIT_COMMIT_COUNT $gitCommitCount" | Out-File -FilePath ".\VersionInfo.h" -Encoding unicode -Append
|
||||||
|
# }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Print out all variables
|
||||||
|
# echo " verMajor: [$verMajor]"
|
||||||
|
# echo " verMinor: [$verMinor]"
|
||||||
|
# echo " verBuild: [$verBuild]"
|
||||||
|
# echo " verPatch: [$verPatch]"
|
||||||
|
# echo ""
|
||||||
|
# echo " aboutBuild: [$aboutBuild]"
|
||||||
|
# echo " productNameFull: [$pnf]"
|
||||||
|
# echo "productCopyrightFull: [$pcf]"
|
||||||
|
# echo " internalName: [$intName]"
|
||||||
|
# echo " originalName: [$origName]"
|
||||||
|
# echo " versionStr: [$vs]"
|
||||||
|
# echo " versionNum: [$vn]"
|
||||||
|
# echo " spanDays: [$spanDays]"
|
||||||
|
# echo " spanSecs: [$spanSecs]"
|
||||||
|
# echo ""
|
||||||
|
# echo " gitCommitCount: [$gitCommitCount]"
|
||||||
|
# echo " gitRevCount: [$gitRevCount]"
|
||||||
|
# echo " gitRevDate: [$gitRevDate]"
|
||||||
|
# echo " gitVerStr: [$gitVerStr]"
|
||||||
|
#endregion
|
||||||
BIN
Version.ini
Normal file
BIN
Version.ini
Normal file
Binary file not shown.
19
pre-build.cmd
Normal file
19
pre-build.cmd
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM In VisualStudio add to Pre-Build events:
|
||||||
|
REM "$(SolutionDir)pre-build.cmd" "$(SolutionDir)" "$(ProjectDir)"
|
||||||
|
REM Then in "Resource Includes..." add '#include "VersionInfo.rc"' into 'Compile-time Directives'
|
||||||
|
|
||||||
|
IF "%~1" == "" GOTO :no_args
|
||||||
|
IF "%~2" == "" GOTO :no_args
|
||||||
|
SET solutionDir=%1
|
||||||
|
SET projectDir=%2
|
||||||
|
|
||||||
|
CD /D %solutionDir%
|
||||||
|
powershell -ExecutionPolicy RemoteSigned -File Update_Version.ps1
|
||||||
|
MOVE /Y %solutionDir%VersionInfo.h %projectDir%VersionInfo.h
|
||||||
|
EXIT
|
||||||
|
|
||||||
|
:no_args
|
||||||
|
ECHO Not enough arguments!
|
||||||
|
EXIT 1
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 15.0.28307.1082
|
VisualStudioVersion = 17.5.33516.290
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wCenterWindow", "wCenterWindow\wCenterWindow.vcxproj", "{2494B3F2-585E-4A2E-A013-20A15AE25B9E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wCenterWindow", "wCenterWindow\wCenterWindow.vcxproj", "{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C7B4FD1E-DC1B-46A4-842C-5130F09EFCB5}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Version.ini = Version.ini
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -13,19 +18,19 @@ Global
|
|||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Debug|x64.ActiveCfg = Debug|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Debug|x64.Build.0 = Debug|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x64.Build.0 = Debug|x64
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Debug|x86.ActiveCfg = Debug|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Debug|x86.Build.0 = Debug|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Release|x64.ActiveCfg = Release|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Release|x64.Build.0 = Release|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x64.Build.0 = Release|x64
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Release|x86.ActiveCfg = Release|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{2494B3F2-585E-4A2E-A013-20A15AE25B9E}.Release|x86.Build.0 = Release|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {34E34C1F-8A53-40DA-BA24-78C20152D64C}
|
SolutionGuid = {83F3F9B6-B00E-4705-9C92-19308AAC038B}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
78
wCenterWindow/CLogger.cpp
Normal file
78
wCenterWindow/CLogger.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// CLogger.cpp
|
||||||
|
#include "CLogger.h"
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
inline wchar_t* CLogger::GetTimeStamp() {
|
||||||
|
GetLocalTime(<);
|
||||||
|
swprintf_s(logTimeBuffer, L"%d-%02d-%02d %02d:%02d:%02d.%03d | ", lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
|
||||||
|
return logTimeBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogger::Out(const wchar_t* fmt, ...) {
|
||||||
|
if (fsLogFile.is_open()) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
EnterCriticalSection(&cs);
|
||||||
|
_vsnwprintf_s(logBuffer, _countof(logBuffer), _TRUNCATE, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
fsLogFile << GetTimeStamp() << logBuffer << std::endl;
|
||||||
|
LeaveCriticalSection(&cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogger::Init() {
|
||||||
|
InitializeCriticalSection(&cs);
|
||||||
|
wchar_t szPath[MAX_PATH] = { 0 };
|
||||||
|
DWORD dwPathLength = GetModuleFileNameW(NULL, szPath, MAX_PATH);
|
||||||
|
DWORD dwError = GetLastError();
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER == dwError) {
|
||||||
|
MessageBoxW(NULL, L"Warning!\nPath to log file is too long! Working without logging.", szAppTitle.c_str(), MB_OK | MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (NULL == dwPathLength) {
|
||||||
|
MessageBoxW(NULL, L"Warning!\nCan't get application's filename! Working without logging.", szAppTitle.c_str(), MB_OK | MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::path log_path = szPath;
|
||||||
|
log_path.replace_extension(L".log");
|
||||||
|
std::filesystem::path bak_path = log_path;
|
||||||
|
bak_path.replace_extension(L".bak");
|
||||||
|
|
||||||
|
if (std::filesystem::exists(log_path)) std::filesystem::rename(log_path, bak_path);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
log_path = L"D:\\test.log";
|
||||||
|
#endif
|
||||||
|
fsLogFile.open(log_path, std::ios::trunc);
|
||||||
|
if (fsLogFile.is_open()) {
|
||||||
|
fsLogFile << "\xEF\xBB\xBF"; // (0xEF, 0xBB, 0xBF) - UTF-8 BOM
|
||||||
|
fsLogFile.imbue(std::locale("en-US.utf8"));
|
||||||
|
fsLogFile << GetTimeStamp() << "[ " << szAppTitleVer.c_str() << " ] Start log." << std::endl;
|
||||||
|
fsLogFile << GetTimeStamp() << "Logfile: \"" << log_path.native() << "\"" << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageBoxW(NULL, L"Warning!\nCan't create log file! Working without logging.", szAppTitle.c_str(), MB_OK | MB_ICONWARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLogger::CLogger(const wchar_t* _appTitle) {
|
||||||
|
szAppTitle = _appTitle;
|
||||||
|
szAppTitleVer = _appTitle;
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
CLogger::CLogger(const wchar_t* _appTitle, const wchar_t* _appVersion) {
|
||||||
|
szAppTitle = _appTitle; szAppVersion = _appVersion;
|
||||||
|
szAppTitleVer = _appTitle;
|
||||||
|
szAppTitleVer.append(L", v").append(_appVersion);
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
CLogger::~CLogger() {
|
||||||
|
if (fsLogFile) {
|
||||||
|
fsLogFile << GetTimeStamp() << "Stop log." << std::endl;
|
||||||
|
fsLogFile.close();
|
||||||
|
DeleteCriticalSection(&cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
31
wCenterWindow/CLogger.h
Normal file
31
wCenterWindow/CLogger.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// CLogger.h
|
||||||
|
#pragma once
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
#define MAX_LOGBUFFER_LENGTH 512
|
||||||
|
|
||||||
|
class CLogger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Out(const wchar_t*, ...);
|
||||||
|
CLogger(const wchar_t*);
|
||||||
|
CLogger(const wchar_t*, const wchar_t*);
|
||||||
|
~CLogger();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SYSTEMTIME lt;
|
||||||
|
CRITICAL_SECTION cs;
|
||||||
|
HANDLE hLoggerThread = NULL;
|
||||||
|
HANDLE hLoggerEvent = NULL;
|
||||||
|
wchar_t logTimeBuffer[28]{ 0 };
|
||||||
|
wchar_t logBuffer[MAX_LOGBUFFER_LENGTH]{ 0 };
|
||||||
|
std::wofstream fsLogFile;
|
||||||
|
std::wstring szAppTitle{ 0 };
|
||||||
|
std::wstring szAppVersion{ 0 };
|
||||||
|
std::wstring szAppTitleVer{ 0 };
|
||||||
|
|
||||||
|
inline wchar_t* GetTimeStamp();
|
||||||
|
void Init();
|
||||||
|
};
|
||||||
BIN
wCenterWindow/VersionInfo.rc
Normal file
BIN
wCenterWindow/VersionInfo.rc
Normal file
Binary file not shown.
6
wCenterWindow/framework.h
Normal file
6
wCenterWindow/framework.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// framework.h
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#include "targetver.h"
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
1010
wCenterWindow/picojson.h
Normal file
1010
wCenterWindow/picojson.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,55 @@
|
|||||||
#pragma once
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by wCenterWindow.rc
|
||||||
|
//
|
||||||
|
#define IDS_CLASSNAME 102
|
||||||
|
#define IDS_APP_TITLE 103
|
||||||
|
#define IDD_ABOUTBOX 104
|
||||||
|
#define IDI_TRAYICON 105
|
||||||
|
#define IDR_MENU 106
|
||||||
|
#define ID_POPUPMENU_ICON 107
|
||||||
|
#define ID_POPUPMENU_AREA 108
|
||||||
|
#define ID_POPUPMENU_ABOUT 110
|
||||||
|
#define ID_POPUPMENU_EXIT 111
|
||||||
|
#define IDS_ABOUT 112
|
||||||
|
#define IDS_ERR_MAIN 113
|
||||||
|
#define IDS_ERR_CLASS 114
|
||||||
|
#define IDS_ERR_WND 115
|
||||||
|
#define IDS_ERR_ICON 116
|
||||||
|
#define IDS_ERR_MENU 117
|
||||||
|
#define IDS_ERR_POPUP 118
|
||||||
|
#define IDS_ERR_HOOK 119
|
||||||
|
#define IDS_ERR_TIMER 120
|
||||||
|
#define IDS_ERR_MAXMIN 121
|
||||||
|
#define IDS_RUNNING 122
|
||||||
|
#define IDT_TIMER 123
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDD_MANUAL_EDITING 129
|
||||||
|
#define IDC_EDIT_X 1000
|
||||||
|
#define IDC_EDIT_Y 1001
|
||||||
|
#define IDC_EDIT_WIDTH 1002
|
||||||
|
#define IDC_EDIT_HEIGHT 1003
|
||||||
|
#define IDC_EDIT_TITLE 1004
|
||||||
|
#define IDC_EDIT_CLASS 1005
|
||||||
|
#define IDC_BUTTON_SET 1006
|
||||||
|
#define IDC_BUTTON_CLOSE 1007
|
||||||
|
#define IDC_ABOUTHELP 1008
|
||||||
|
#define IDC_DONATIONLINK 1009
|
||||||
|
#define IDC_DONATIONTEXT 1010
|
||||||
|
#define IDC_ABOUT_PROGNAME 1011
|
||||||
|
#define IDC_ABOUT_COPYRIGHT 1012
|
||||||
|
#define IDC_ABOUT_BUILDTIME 1013
|
||||||
|
#define IDC_ABOUTEDIT 1014
|
||||||
|
#define IDC_STATIC -1
|
||||||
|
|
||||||
#define IDS_APP_TITLE 100
|
// Next default values for new objects
|
||||||
#define IDS_CLASSNAME 101
|
//
|
||||||
#define IDS_ABOUT 102
|
#ifdef APSTUDIO_INVOKED
|
||||||
#define IDI_TRAYICON 103
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define IDR_MENU 104
|
#define _APS_NO_MFC 1
|
||||||
#define ID_POPUPMENU_ICON 105
|
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||||
#define ID_POPUPMENU_AREA 106
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
#define ID_POPUPMENU_ABOUT 107
|
#define _APS_NEXT_CONTROL_VALUE 1015
|
||||||
#define ID_POPUPMENU_EXIT 108
|
#define _APS_NEXT_SYMED_VALUE 124
|
||||||
#define IDS_ERR_MAIN 109
|
#endif
|
||||||
#define IDS_ERR_WND 110
|
#endif
|
||||||
#define IDS_ERR_ICON 111
|
|
||||||
#define IDS_ERR_MENU 112
|
|
||||||
#define IDS_ERR_POPUP 113
|
|
||||||
#define IDS_ERR_HOOK 114
|
|
||||||
#define IDS_RUNNING 115
|
|
||||||
#define IDC_STATIC -1
|
|
||||||
|
|||||||
6
wCenterWindow/targetver.h
Normal file
6
wCenterWindow/targetver.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// // Including SDKDDKVer.h defines the highest available Windows platform.
|
||||||
|
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||||
|
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||||
|
#include <SDKDDKVer.h>
|
||||||
222
wCenterWindow/updater.cpp
Normal file
222
wCenterWindow/updater.cpp
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// updater.h
|
||||||
|
//
|
||||||
|
#include "wCenterWindow.h"
|
||||||
|
#include "updater.h"
|
||||||
|
#include "picojson.h"
|
||||||
|
#include <cwctype>
|
||||||
|
|
||||||
|
#define GITHUB_URL TEXT("api.github.com")
|
||||||
|
#define GITHUB_URI TEXT("/repos/dreamforceinc/wCenterWindow/releases/latest")
|
||||||
|
|
||||||
|
picojson::value json;
|
||||||
|
|
||||||
|
struct Version
|
||||||
|
{
|
||||||
|
UINT Major = 0;
|
||||||
|
UINT Minor = 0;
|
||||||
|
UINT Build = 0;
|
||||||
|
UINT Patch = 0;
|
||||||
|
} verApp, verGh;
|
||||||
|
|
||||||
|
bool GetLatestRelease(const std::wstring& urn);
|
||||||
|
void FillVersionStructure(Version& ver, const std::wstring& str);
|
||||||
|
std::vector<std::wstring> Split(const std::wstring& s, wchar_t delim);
|
||||||
|
std::wstring ConvertUtf8ToWide(const std::string& str);
|
||||||
|
|
||||||
|
UINT WINAPI Updater(LPVOID)
|
||||||
|
{
|
||||||
|
logger.Out(L"Entering the %s() function", TEXT(__FUNCTION__));
|
||||||
|
|
||||||
|
if (!GetLatestRelease(GITHUB_URI))
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): Failed getting releases!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
MessageBoxW(NULL, L"Failed getting releases!", szTitle, MB_OK | MB_ICONERROR);
|
||||||
|
_endthreadex(101);
|
||||||
|
return 101;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring j_tag_name, j_file_name, j_file_ext, j_file_url, j_page_url;
|
||||||
|
int64_t j_file_size = 0;
|
||||||
|
picojson::object obj, obj2;
|
||||||
|
picojson::object::iterator it, it2;
|
||||||
|
|
||||||
|
if (json.is<picojson::object>())
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): Parsing JSON object", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
obj = json.get<picojson::object>();
|
||||||
|
it = obj.find("message"), it2;
|
||||||
|
if (it != obj.end())
|
||||||
|
{
|
||||||
|
std::string u = (*it).second.get<std::string>();
|
||||||
|
logger.Out(L"[UPDT] %s(%d): Error! The url is %s", TEXT(__FUNCTION__), __LINE__, u);
|
||||||
|
_endthreadex(102);
|
||||||
|
return 102;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (it = obj.begin(); it != obj.end(); it++)
|
||||||
|
{
|
||||||
|
if ((*it).first == "tag_name") j_tag_name = ConvertUtf8ToWide((*it).second.to_str());
|
||||||
|
if ((*it).first == "html_url") j_page_url = ConvertUtf8ToWide((*it).second.to_str());
|
||||||
|
if ((*it).first == "assets" && (*it).second.is<picojson::array>())
|
||||||
|
{
|
||||||
|
picojson::array a = (*it).second.get<picojson::array>();
|
||||||
|
obj2 = a[0].get<picojson::object>();
|
||||||
|
for (it2 = obj2.begin(); it2 != obj2.end(); it2++)
|
||||||
|
{
|
||||||
|
if ((*it2).first == "name") j_file_name = ConvertUtf8ToWide((*it2).second.to_str());
|
||||||
|
if ((*it2).first == "browser_download_url") j_file_url = ConvertUtf8ToWide((*it2).second.to_str());
|
||||||
|
if ((*it2).first == "size") j_file_size = static_cast<int64_t>((*it2).second.get<double>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): Error! Cannot recognize JSON object!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
_endthreadex(103);
|
||||||
|
return 103;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t pos = 0;
|
||||||
|
while (std::iswdigit(j_tag_name.at(pos)) == 0) pos++;
|
||||||
|
std::wstring gh_version = j_tag_name.substr(pos);
|
||||||
|
|
||||||
|
logger.Out(L"[UPDT] %s(%d): AppVersion : %s", TEXT(__FUNCTION__), __LINE__, TEXT(VERSION_STR));
|
||||||
|
logger.Out(L"[UPDT] %s(%d): GitVersion : %s", TEXT(__FUNCTION__), __LINE__, gh_version.c_str());
|
||||||
|
//logger.Out(L"[UPDT] %s(%d): FileName : %s", TEXT(__FUNCTION__), __LINE__, j_file_name.c_str());
|
||||||
|
//logger.Out(L"[UPDT] %s(%d): FileSize : %d", TEXT(__FUNCTION__), __LINE__, j_file_size);
|
||||||
|
//logger.Out(L"[UPDT] %s(%d): File Url : %s", TEXT(__FUNCTION__), __LINE__, j_file_url.c_str());
|
||||||
|
//logger.Out(L"[UPDT] %s(%d): Page Url : %s", TEXT(__FUNCTION__), __LINE__, j_page_url.c_str());
|
||||||
|
|
||||||
|
FillVersionStructure(verApp, TEXT(VERSION_STR));
|
||||||
|
FillVersionStructure(verGh, gh_version);
|
||||||
|
|
||||||
|
if ((verGh.Major > verApp.Major) || (verGh.Minor > verApp.Minor) || (verGh.Build > verApp.Build) || (verGh.Patch > verApp.Patch))
|
||||||
|
{
|
||||||
|
|
||||||
|
logger.Out(L"[UPDT] %s(%d): An update is available!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
if (IDYES == MessageBoxW(NULL, L"An update is available!\nDo you want to open the download page?", szTitle, MB_YESNO | MB_ICONINFORMATION))
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): Opening download page by default browser", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
ShellExecuteW(NULL, L"open", j_page_url.c_str(), NULL, NULL, SW_SHOW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): The user refused the update", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Out(L"[UPDT] %s(%d): No updates is available", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Out(L"[UPDT] Exit from the %s() function", TEXT(__FUNCTION__));
|
||||||
|
|
||||||
|
_endthreadex(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetLatestRelease(const std::wstring& urn)
|
||||||
|
{
|
||||||
|
std::wstring user_agent = L"User-Agent: ";
|
||||||
|
user_agent.append(szTitle);
|
||||||
|
const std::wstring url = GITHUB_URL;
|
||||||
|
bool ret = true;
|
||||||
|
DWORD err = 0;
|
||||||
|
|
||||||
|
logger.Out(L"[UPDT] %s(%d): %s", TEXT(__FUNCTION__), __LINE__, user_agent.c_str());
|
||||||
|
|
||||||
|
HINTERNET hInternet = InternetOpenW(user_agent.c_str(), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
||||||
|
if (hInternet != NULL)
|
||||||
|
{
|
||||||
|
HINTERNET hConnect = InternetConnectW(hInternet, url.c_str(), INTERNET_DEFAULT_HTTPS_PORT, L"", L"", INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0);
|
||||||
|
if (hConnect != NULL)
|
||||||
|
{
|
||||||
|
HINTERNET hRequest = HttpOpenRequestW(hConnect, L"GET", urn.c_str(), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_UI, 0);
|
||||||
|
if (hRequest != NULL)
|
||||||
|
{
|
||||||
|
BOOL isSend = HttpSendRequestW(hRequest, NULL, 0, 0, 0);
|
||||||
|
if (isSend)
|
||||||
|
{
|
||||||
|
char szData[1024]{ 0 };
|
||||||
|
DWORD dwBytesRead = 0;
|
||||||
|
std::string buffer;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
InternetReadFile(hRequest, szData, sizeof(szData), &dwBytesRead);
|
||||||
|
buffer.append(szData, dwBytesRead);
|
||||||
|
} while (dwBytesRead != 0);
|
||||||
|
|
||||||
|
picojson::parse(json, buffer);
|
||||||
|
std::string jerr = picojson::get_last_error();
|
||||||
|
if (!jerr.empty())
|
||||||
|
{
|
||||||
|
std::cout << jerr << std::endl;
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = GetLastError();
|
||||||
|
logger.Out(L"[UPDT] %s(%d): HttpSendRequestW() error: %d", TEXT(__FUNCTION__), __LINE__, err);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = GetLastError();
|
||||||
|
logger.Out(L"[UPDT] %s(%d): HttpOpenRequestW() error: %d", TEXT(__FUNCTION__), __LINE__, err);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
InternetCloseHandle(hRequest);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = GetLastError();
|
||||||
|
logger.Out(L"[UPDT] %s(%d): InternetConnectW() error: %d", TEXT(__FUNCTION__), __LINE__, err);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
InternetCloseHandle(hConnect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = GetLastError();
|
||||||
|
logger.Out(L"[UPDT] %s(%d): InternetOpenW() error: %d", TEXT(__FUNCTION__), __LINE__, err);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
InternetCloseHandle(hInternet);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::wstring> Split(const std::wstring& s, wchar_t delim)
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> result;
|
||||||
|
std::wstringstream ss(s);
|
||||||
|
std::wstring item;
|
||||||
|
while (getline(ss, item, delim)) result.push_back(item);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FillVersionStructure(Version& ver, const std::wstring& str)
|
||||||
|
{
|
||||||
|
std::vector<std::wstring> v;
|
||||||
|
v = Split(str, '.');
|
||||||
|
if (v.size() < 4) v.push_back(L"0");
|
||||||
|
ver.Major = std::stoul(v[0]);
|
||||||
|
ver.Minor = std::stoul(v[1]);
|
||||||
|
ver.Build = std::stoul(v[2]);
|
||||||
|
ver.Patch = std::stoul(v[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring ConvertUtf8ToWide(const std::string& str)
|
||||||
|
{
|
||||||
|
int count = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0);
|
||||||
|
std::wstring wstr(count, 0);
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), &wstr[0], count);
|
||||||
|
return wstr;
|
||||||
|
}
|
||||||
5
wCenterWindow/updater.h
Normal file
5
wCenterWindow/updater.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// updater.h
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
UINT WINAPI Updater(void*);
|
||||||
@@ -1,75 +1,168 @@
|
|||||||
// wCenterWindow, v2.1
|
// wCenterWindow
|
||||||
|
// wCenterWindow.cpp
|
||||||
|
//
|
||||||
|
// TODO: Licensing.
|
||||||
|
// TODO: Change keyboard low-level hook to RegisterHotKey function.
|
||||||
|
// TODO: Make x64 version.
|
||||||
|
//
|
||||||
|
#include "framework.h"
|
||||||
|
#include "wCenterWindow.h"
|
||||||
|
#include "updater.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#define NO_DONATION
|
||||||
#include <strsafe.h>
|
#define KEY_I 0x49
|
||||||
#include "resource.h"
|
#define KEY_C 0x43
|
||||||
#include "S:\MyFunctions\MoveWindowToMonitorCenter.h"
|
#define KEY_V 0x56
|
||||||
|
|
||||||
#define MAX_LOADSTRING 32
|
#define MAX_WINTITLE_BUFFER_LENGTH 1024
|
||||||
#define WM_WCW 0x8F00
|
#define WM_WCW (WM_APP + 0x0F00)
|
||||||
|
|
||||||
// Global variables:
|
// Global variables:
|
||||||
HINSTANCE hInst; // Instance
|
HINSTANCE hInst; // Instance
|
||||||
CHAR szTitle[MAX_LOADSTRING]; // Window's title
|
WCHAR szTitle[MAX_LOADSTRING]{ 0 }; // wCenterWindow's title
|
||||||
CHAR szClass[MAX_LOADSTRING]; // Window's class
|
WCHAR szClass[MAX_LOADSTRING]{ 0 }; // Window's class
|
||||||
CHAR szAbout[MAX_LOADSTRING * 14]; // Description text
|
WCHAR szWinTitle[256]{ 0 };
|
||||||
HHOOK KeyboardHook;
|
WCHAR szWinClass[256]{ 0 };
|
||||||
HICON hIcon;
|
HANDLE hHeap = NULL, hUpdater = NULL;
|
||||||
HMENU hMenu, hPopup;
|
UINT dwUpdaterID = 0;
|
||||||
HWND hWnd, hTaskBar, hDesktop, hProgman;
|
HHOOK hMouseHook = NULL, hKbdHook = NULL; // Hook's handles
|
||||||
BOOL bPressed = FALSE, bShowIcon = TRUE, bWorkArea = TRUE;
|
HICON hIcon = NULL;
|
||||||
BOOL bLCTRL = FALSE, bLWIN = FALSE, bKEYI = FALSE, bKEYC = FALSE;
|
HMENU hMenu = NULL, hPopup = NULL;
|
||||||
|
HWND hWnd = NULL, hFgWnd = NULL;
|
||||||
|
BOOL bKPressed = FALSE, bMPressed = FALSE, fShowIcon = TRUE, fCheckUpdates = TRUE, bWorkArea = TRUE;
|
||||||
|
BOOL bLCTRL = FALSE, bLWIN = FALSE, bKEYV = FALSE;
|
||||||
|
CLogger logger(TEXT(PRODUCT_NAME), TEXT(VERSION_STR));
|
||||||
|
|
||||||
NOTIFYICONDATA nid = { 0 };
|
NOTIFYICONDATAW nid = { 0 };
|
||||||
LPKBDLLHOOKSTRUCT pkhs;
|
MENUITEMINFO mii = { 0 };
|
||||||
MENUITEMINFO mii;
|
|
||||||
POINT ptMousePos;
|
|
||||||
|
|
||||||
// Function's prototypes
|
LPVOID szBuffer;
|
||||||
ATOM MyRegisterClass(HINSTANCE);
|
|
||||||
|
// {2D7B7F30-4B5F-4380-9807-57D7A2E37F6C}
|
||||||
|
// static const GUID guid = { 0x2d7b7f30, 0x4b5f, 0x4380, { 0x98, 0x7, 0x57, 0xd7, 0xa2, 0xe3, 0x7f, 0x6c } };
|
||||||
|
|
||||||
|
// Forward declarations of functions included in this code module:
|
||||||
VOID HandlingTrayIcon();
|
VOID HandlingTrayIcon();
|
||||||
VOID ShowError(UINT);
|
VOID ShowError(UINT);
|
||||||
|
BOOL IsWindowApprooved(HWND);
|
||||||
|
BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
LRESULT CALLBACK KeyboardHookProc(int, WPARAM, LPARAM);
|
LRESULT CALLBACK KeyboardHookProc(int, WPARAM, LPARAM);
|
||||||
|
LRESULT CALLBACK MouseHookProc(int, WPARAM, LPARAM);
|
||||||
|
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
logger.Out(L"Entering the %s() function", TEXT(__FUNCTION__));
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
|
||||||
|
|
||||||
|
RECT fgwrc = { 0 };
|
||||||
|
GetWindowRect(hwnd, &fgwrc);
|
||||||
|
LONG nWidth = fgwrc.right - fgwrc.left;
|
||||||
|
LONG nHeight = fgwrc.bottom - fgwrc.top;
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Moving the window from %d, %d", TEXT(__FUNCTION__), __LINE__, fgwrc.left, fgwrc.top);
|
||||||
|
|
||||||
|
MONITORINFO mi = { 0 };
|
||||||
|
mi.cbSize = sizeof(MONITORINFO);
|
||||||
|
GetMonitorInfoW(MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST), &mi);
|
||||||
|
RECT area = { 0 };
|
||||||
|
if (bWorkArea)
|
||||||
|
{
|
||||||
|
area.bottom = mi.rcWork.bottom;
|
||||||
|
area.left = mi.rcWork.left;
|
||||||
|
area.right = mi.rcWork.right;
|
||||||
|
area.top = mi.rcWork.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
area.bottom = mi.rcMonitor.bottom;
|
||||||
|
area.left = mi.rcMonitor.left;
|
||||||
|
area.right = mi.rcMonitor.right;
|
||||||
|
area.top = mi.rcMonitor.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
int aw = area.right - area.left;
|
||||||
|
int ah = area.bottom - area.top;
|
||||||
|
if (nWidth > aw && bResize) nWidth = aw;
|
||||||
|
if (nHeight > ah && bResize) nHeight = ah;
|
||||||
|
if (area.left < 0) aw = -aw;
|
||||||
|
if (area.top < 0) ah = -ah;
|
||||||
|
int x = (aw - nWidth) / 2;
|
||||||
|
int y = (ah - nHeight) / 2;
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Moving the window to %d, %d", TEXT(__FUNCTION__), __LINE__, x, y);
|
||||||
|
|
||||||
|
SendMessageW(hwnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
||||||
|
MoveWindow(hwnd, x, y, nWidth, nHeight, TRUE);
|
||||||
|
SendMessageW(hwnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
|
||||||
|
logger.Out(L"Exit from the %s() function", TEXT(__FUNCTION__));
|
||||||
|
}
|
||||||
|
|
||||||
|
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
||||||
|
{
|
||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
||||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, _countof(szTitle));
|
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, _countof(szTitle));
|
||||||
LoadString(hInstance, IDS_CLASSNAME, szClass, _countof(szClass));
|
LoadStringW(hInstance, IDS_CLASSNAME, szClass, _countof(szClass));
|
||||||
|
|
||||||
if (FindWindow(szClass, NULL))
|
if (FindWindowW(szClass, NULL))
|
||||||
{
|
{
|
||||||
ShowError(IDS_RUNNING);
|
ShowError(IDS_RUNNING);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyRegisterClass(hInstance);
|
logger.Out(L"Entering the %s() function", TEXT(__FUNCTION__));
|
||||||
hWnd = CreateWindowEx(0, szClass, szTitle, 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
|
|
||||||
|
int nArgs = 0;
|
||||||
|
LPWSTR* szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
||||||
|
|
||||||
|
logger.Out(L"Arguments count: %d", nArgs - 1);
|
||||||
|
|
||||||
|
if (nArgs > 1)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < nArgs; i++)
|
||||||
|
{
|
||||||
|
logger.Out(L"Argument %d: %s", i, szArglist[i]);
|
||||||
|
if (0 == lstrcmpiW(szArglist[i], L"/hide")) fShowIcon = FALSE;
|
||||||
|
if (0 == lstrcmpiW(szArglist[i], L"/noupdate")) fCheckUpdates = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
LocalFree(szArglist);
|
||||||
|
|
||||||
|
WNDCLASSEX wcex = { 0 };
|
||||||
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wcex.lpfnWndProc = WndProc;
|
||||||
|
wcex.hInstance = hInstance;
|
||||||
|
wcex.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));
|
||||||
|
LoadIconMetric(hInst, MAKEINTRESOURCE(IDI_TRAYICON), LIM_LARGE, &(wcex.hIcon));
|
||||||
|
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
|
||||||
|
wcex.lpszClassName = szClass;
|
||||||
|
wcex.hIconSm = wcex.hIcon;
|
||||||
|
hIcon = wcex.hIcon;
|
||||||
|
if (!RegisterClassExW(&wcex))
|
||||||
|
{
|
||||||
|
ShowError(IDS_ERR_CLASS);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hWnd = CreateWindowExW(0, szClass, szTitle, 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
|
||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
{
|
{
|
||||||
ShowError(IDS_ERR_WND);
|
ShowError(IDS_ERR_WND);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nArgs = 0;
|
|
||||||
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
|
||||||
(nArgs >= 2 && 0 == lstrcmpiW(szArglist[1], L"/hide")) ? bShowIcon = FALSE : bShowIcon = TRUE;
|
|
||||||
LocalFree(szArglist);
|
|
||||||
HandlingTrayIcon();
|
HandlingTrayIcon();
|
||||||
|
|
||||||
hTaskBar = FindWindow("Shell_TrayWnd", NULL);
|
hHeap = GetProcessHeap();
|
||||||
hProgman = FindWindow("Progman", NULL);
|
szBuffer = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, MAX_WINTITLE_BUFFER_LENGTH);
|
||||||
hDesktop = GetDesktopWindow();
|
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
BOOL bRet;
|
BOOL bRet;
|
||||||
|
|
||||||
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
|
while ((bRet = GetMessageW(&msg, NULL, 0, 0)) != 0)
|
||||||
{
|
{
|
||||||
if (bRet == -1)
|
if (bRet == -1)
|
||||||
{
|
{
|
||||||
@@ -79,24 +172,22 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessageW(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (int)msg.wParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
ATOM MyRegisterClass(HINSTANCE hInstance)
|
if (hMouseHook) UnhookWindowsHookEx(hMouseHook);
|
||||||
{
|
if (hKbdHook) UnhookWindowsHookEx(hKbdHook);
|
||||||
WNDCLASSEX wcex = { 0 };
|
if (hMenu) DestroyMenu(hMenu);
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
wcex.lpfnWndProc = WndProc;
|
DestroyIcon(hIcon);
|
||||||
wcex.hInstance = hInstance;
|
|
||||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));
|
logger.Out(L"Exit from the %s() function, msg.wParam = %d", TEXT(__FUNCTION__), (int)msg.wParam);
|
||||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
|
||||||
wcex.lpszClassName = szClass;
|
HeapFree(hHeap, NULL, szBuffer);
|
||||||
wcex.hIconSm = wcex.hIcon;
|
CloseHandle(hUpdater);
|
||||||
hIcon = wcex.hIcon;
|
|
||||||
return RegisterClassEx(&wcex);
|
return (int)msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
@@ -105,159 +196,465 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU));
|
logger.Out(L"%s(%d): Recived WM_CREATE message", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
hMenu = LoadMenuW(hInst, MAKEINTRESOURCE(IDR_MENU));
|
||||||
if (!hMenu)
|
if (!hMenu)
|
||||||
{
|
{
|
||||||
|
logger.Out(L"%s(%d): Loading context menu failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
ShowError(IDS_ERR_MENU);
|
ShowError(IDS_ERR_MENU);
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
PostQuitMessage(0);
|
||||||
}
|
}
|
||||||
|
logger.Out(L"%s(%d): Context menu successfully loaded", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
hPopup = GetSubMenu(hMenu, 0);
|
hPopup = GetSubMenu(hMenu, 0);
|
||||||
if (!hPopup)
|
if (!hPopup)
|
||||||
{
|
{
|
||||||
|
logger.Out(L"%s(%d): Creating popup menu failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
ShowError(IDS_ERR_POPUP);
|
ShowError(IDS_ERR_POPUP);
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
PostQuitMessage(0);
|
||||||
}
|
}
|
||||||
|
logger.Out(L"%s(%d): Popup menu successfully created", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
mii.cbSize = sizeof(MENUITEMINFO);
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
mii.fMask = MIIM_STATE;
|
mii.fMask = MIIM_STATE;
|
||||||
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
||||||
SetMenuItemInfo(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
||||||
|
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATA);
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
||||||
nid.hWnd = hWnd;
|
nid.hWnd = hWnd;
|
||||||
nid.uVersion = NOTIFYICON_VERSION;
|
nid.uVersion = NOTIFYICON_VERSION;
|
||||||
nid.uCallbackMessage = WM_WCW;
|
nid.uCallbackMessage = WM_WCW;
|
||||||
nid.hIcon = hIcon;
|
nid.hIcon = hIcon;
|
||||||
nid.uID = IDI_TRAYICON;
|
nid.uID = IDI_TRAYICON;
|
||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
nid.dwInfoFlags = NIIF_INFO;
|
StringCchCopyW(nid.szTip, _countof(nid.szTip), szTitle);
|
||||||
StringCchCopy(nid.szTip, _countof(nid.szTip), szTitle);
|
|
||||||
|
|
||||||
KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, hInst, NULL);
|
if (fCheckUpdates)
|
||||||
if (!KeyboardHook)
|
|
||||||
{
|
{
|
||||||
ShowError(IDS_ERR_HOOK);
|
if (!SetTimer(hWnd, IDT_TIMER, 30000, NULL)) // 30 seconds
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
{
|
||||||
|
logger.Out(L"%s(%d): Creating timer failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
ShowError(IDS_ERR_TIMER);
|
||||||
|
fCheckUpdates = FALSE;
|
||||||
|
}
|
||||||
|
logger.Out(L"%s(%d): Timer successfully created", TEXT(__FUNCTION__), __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadString(hInst, IDS_ABOUT, szAbout, _countof(szAbout));
|
#ifndef _DEBUG
|
||||||
}
|
hMouseHook = SetWindowsHookExW(WH_MOUSE_LL, MouseHookProc, hInst, NULL);
|
||||||
break;
|
if (!hMouseHook)
|
||||||
|
|
||||||
case WM_WCW:
|
|
||||||
{
|
|
||||||
if (lParam == WM_RBUTTONDOWN && wParam == IDI_TRAYICON)
|
|
||||||
{
|
{
|
||||||
|
logger.Out(L"%s(%d): Mouse hook creation failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
ShowError(IDS_ERR_HOOK);
|
||||||
|
PostQuitMessage(0);
|
||||||
|
}
|
||||||
|
logger.Out(L"%s(%d): The mouse hook was successfully installed", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
#endif // !_DEBUG
|
||||||
|
|
||||||
|
hKbdHook = SetWindowsHookExW(WH_KEYBOARD_LL, KeyboardHookProc, hInst, NULL);
|
||||||
|
if (!hKbdHook)
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Keyboard hook creation failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
ShowError(IDS_ERR_HOOK);
|
||||||
|
PostQuitMessage(0);
|
||||||
|
}
|
||||||
|
logger.Out(L"%s(%d): The keyboard hook was successfully installed", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_TIMER:
|
||||||
|
{
|
||||||
|
if (fCheckUpdates)
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Checking for updates is enabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False");
|
||||||
|
|
||||||
|
hUpdater = (HANDLE)_beginthreadex(NULL, 0, &Updater, NULL, 0, &dwUpdaterID);
|
||||||
|
if (NULL == hUpdater)
|
||||||
|
{
|
||||||
|
DWORD dwLastError = GetLastError();
|
||||||
|
logger.Out(L"%s(%d): Creating Updater thread failed! Error: %d", TEXT(__FUNCTION__), __LINE__, dwLastError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!SetTimer(hWnd, IDT_TIMER, 86400000, NULL)) // 1 day
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Creating timer failed!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
ShowError(IDS_ERR_TIMER);
|
||||||
|
fCheckUpdates = FALSE;
|
||||||
|
}
|
||||||
|
logger.Out(L"%s(%d): Timer successfully created", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Checking for updates is disabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_WCW: // Popup menu handler
|
||||||
|
{
|
||||||
|
if (IDI_TRAYICON == wParam && (WM_RBUTTONDOWN == lParam || WM_LBUTTONDOWN == lParam))
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Entering the WM_WCW message handler", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
SetForegroundWindow(hWnd);
|
SetForegroundWindow(hWnd);
|
||||||
POINT pt;
|
POINT pt;
|
||||||
GetCursorPos(&pt);
|
GetCursorPos(&pt);
|
||||||
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
||||||
if (idMenu == ID_POPUPMENU_ICON)
|
if (ID_POPUPMENU_ICON == idMenu)
|
||||||
{
|
{
|
||||||
bShowIcon = FALSE;
|
logger.Out(L"%s(%d): Pressed the 'Hide icon' menuitem", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
fShowIcon = FALSE;
|
||||||
HandlingTrayIcon();
|
HandlingTrayIcon();
|
||||||
}
|
}
|
||||||
if (idMenu == ID_POPUPMENU_AREA)
|
if (ID_POPUPMENU_AREA == idMenu)
|
||||||
{
|
{
|
||||||
|
logger.Out(L"%s(%d): Pressed the 'Use workarea' menuitem", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
bWorkArea = !bWorkArea;
|
bWorkArea = !bWorkArea;
|
||||||
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
||||||
SetMenuItemInfo(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
||||||
|
logger.Out(L"%s(%d): Changed 'Use workarea' option to %s", TEXT(__FUNCTION__), __LINE__, bWorkArea ? L"True" : L"False");
|
||||||
}
|
}
|
||||||
if (idMenu == ID_POPUPMENU_ABOUT && !bPressed)
|
if (ID_POPUPMENU_ABOUT == idMenu && !bKPressed)
|
||||||
{
|
{
|
||||||
bPressed = TRUE;
|
logger.Out(L"%s(%d): Pressed the 'About' menuitem", TEXT(__FUNCTION__), __LINE__);
|
||||||
if (MessageBox(hWnd, szAbout, szTitle, MB_OK | MB_TOPMOST | MB_ICONINFORMATION) == IDOK) bPressed = FALSE;
|
|
||||||
|
bKPressed = TRUE;
|
||||||
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)About);
|
||||||
|
bKPressed = FALSE;
|
||||||
}
|
}
|
||||||
if (idMenu == ID_POPUPMENU_EXIT) SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
if (ID_POPUPMENU_EXIT == idMenu)
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Pressed the 'Exit' menuitem", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
PostQuitMessage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Exit from the WM_WCW message handler", TEXT(__FUNCTION__), __LINE__);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_QUERYENDSESSION:
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Recieved the WM_QUERYENDSESSION message, lParam = 0x%08X", TEXT(__FUNCTION__), __LINE__, (long)lParam);
|
||||||
|
|
||||||
|
PostQuitMessage(0);
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
if (KeyboardHook) UnhookWindowsHookEx(KeyboardHook);
|
logger.Out(L"%s(%d): Recieved the WM_DESTROY message", TEXT(__FUNCTION__), __LINE__);
|
||||||
if (hMenu) DestroyMenu(hMenu);
|
|
||||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
|
||||||
PostQuitMessage(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
PostQuitMessage(0);
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if (WM_MBUTTONUP == wParam) bMPressed = FALSE;
|
||||||
|
if (WM_MBUTTONDOWN == wParam && bLCTRL && bLWIN && !bMPressed)
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Pressed LCTRL + LWIN + MMB", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
bMPressed = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
if (IsWindowApprooved(hFgWnd)) MoveWindowToMonitorCenter(hFgWnd, bWorkArea, FALSE);
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
}
|
||||||
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
pkhs = (KBDLLHOOKSTRUCT*)lParam;
|
LPKBDLLHOOKSTRUCT pkhs = { 0 };
|
||||||
|
pkhs = (LPKBDLLHOOKSTRUCT)lParam;
|
||||||
if (wParam == WM_KEYUP)
|
if (WM_KEYUP == wParam)
|
||||||
{
|
{
|
||||||
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = FALSE;
|
if (VK_LCONTROL == pkhs->vkCode) bLCTRL = FALSE;
|
||||||
if (pkhs->vkCode == VK_LWIN) bLWIN = FALSE;
|
if (VK_LWIN == pkhs->vkCode) bLWIN = FALSE;
|
||||||
bPressed = FALSE;
|
bKPressed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wParam == WM_KEYDOWN)
|
if (WM_KEYDOWN == wParam)
|
||||||
{
|
{
|
||||||
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = TRUE;
|
if (VK_LCONTROL == pkhs->vkCode) bLCTRL = TRUE;
|
||||||
if (pkhs->vkCode == VK_LWIN) bLWIN = TRUE;
|
if (VK_LWIN == pkhs->vkCode) bLWIN = TRUE;
|
||||||
|
|
||||||
if (bLCTRL && bLWIN && pkhs->vkCode == 0x49 && !bPressed) // 'I' key
|
if (KEY_I == pkhs->vkCode && bLCTRL && bLWIN && !bKPressed) // 'I' key
|
||||||
{
|
{
|
||||||
bPressed = TRUE;
|
logger.Out(L"%s(%d): Pressed LCTRL + LWIN + I", TEXT(__FUNCTION__), __LINE__);
|
||||||
bShowIcon = !bShowIcon;
|
|
||||||
|
bKPressed = TRUE;
|
||||||
|
fShowIcon = !fShowIcon;
|
||||||
HandlingTrayIcon();
|
HandlingTrayIcon();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bLCTRL && bLWIN && pkhs->vkCode == 0x43 && !bPressed) // 'C' key
|
if (KEY_C == pkhs->vkCode && bLCTRL && bLWIN && !bKPressed && !bKEYV) // 'C' key
|
||||||
{
|
{
|
||||||
bPressed = TRUE;
|
logger.Out(L"%s(%d): Pressed LCTRL + LWIN + C", TEXT(__FUNCTION__), __LINE__);
|
||||||
HWND hFgWnd = GetForegroundWindow();
|
|
||||||
|
|
||||||
if (hFgWnd)
|
bKPressed = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
if (IsWindowApprooved(hFgWnd)) MoveWindowToMonitorCenter(hFgWnd, bWorkArea, FALSE);
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KEY_V == pkhs->vkCode && bLCTRL && bLWIN && !bKPressed && !bKEYV) // 'V' key
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Pressed LCTRL + LWIN + V", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
bKPressed = TRUE; bKEYV = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
if (IsWindowApprooved(hFgWnd))
|
||||||
{
|
{
|
||||||
if (hFgWnd != hDesktop && hFgWnd != hTaskBar && hFgWnd != hProgman)
|
logger.Out(L"%s(%d): Opening the 'Manual editing' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
{
|
|
||||||
if (!IsIconic(hFgWnd) && !IsZoomed(hFgWnd))
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_MANUAL_EDITING), hFgWnd, (DLGPROC)DlgProc);
|
||||||
{
|
SetForegroundWindow(hFgWnd);
|
||||||
RECT fgwrc;
|
|
||||||
GetWindowRect(hFgWnd, &fgwrc);
|
|
||||||
LONG fgWidth = fgwrc.right - fgwrc.left;
|
|
||||||
LONG fgHeight = fgwrc.bottom - fgwrc.top;
|
|
||||||
MoveWindowToMonitorCenter(hFgWnd, fgWidth, fgHeight, bWorkArea, FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
bKEYV = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
RECT rcFW = { 0 };
|
||||||
|
int x, y, w, h;
|
||||||
|
switch (dlgmsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Initializing the 'Manual editing' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
SetWindowTextW(hDlg, szTitle);
|
||||||
|
GetWindowTextW(hFgWnd, szWinTitle, _countof(szWinTitle));
|
||||||
|
GetClassNameW(hFgWnd, szWinClass, _countof(szWinClass));
|
||||||
|
GetWindowRect(hFgWnd, &rcFW);
|
||||||
|
x = rcFW.left;
|
||||||
|
y = rcFW.top;
|
||||||
|
w = rcFW.right - rcFW.left;
|
||||||
|
h = rcFW.bottom - rcFW.top;
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_X, x, TRUE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_Y, y, TRUE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_WIDTH, w, FALSE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_HEIGHT, h, FALSE);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_EDIT_TITLE, szWinTitle);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_EDIT_CLASS, szWinClass);
|
||||||
|
UpdateWindow(hDlg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_BUTTON_SET:
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Pressed the 'Set' button", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
x = GetDlgItemInt(hDlg, IDC_EDIT_X, NULL, TRUE);
|
||||||
|
y = GetDlgItemInt(hDlg, IDC_EDIT_Y, NULL, TRUE);
|
||||||
|
w = GetDlgItemInt(hDlg, IDC_EDIT_WIDTH, NULL, FALSE);
|
||||||
|
h = GetDlgItemInt(hDlg, IDC_EDIT_HEIGHT, NULL, FALSE);
|
||||||
|
SendMessageW(hFgWnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
||||||
|
MoveWindow(hFgWnd, x, y, w, h, TRUE);
|
||||||
|
SendMessageW(hFgWnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Window with handle 0x%08X was moved to %d, %d", TEXT(__FUNCTION__), __LINE__, hFgWnd, x, y);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IDCANCEL:
|
||||||
|
case IDC_BUTTON_CLOSE:
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Closing the 'Manual editing' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL IsWindowApprooved(HWND hFW)
|
||||||
|
{
|
||||||
|
logger.Out(L"Entering the %s() function, handle = 0x%08X", TEXT(__FUNCTION__), hFW);
|
||||||
|
|
||||||
|
bool bApprooved = FALSE;
|
||||||
|
if (hFW)
|
||||||
|
{
|
||||||
|
if (GetWindowTextW(hFW, (LPWSTR)szBuffer, MAX_WINTITLE_BUFFER_LENGTH))
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Window title: '%s'", TEXT(__FUNCTION__), __LINE__, (LPWSTR)szBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsIconic(hFW))
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): The window is iconified", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsZoomed(hFW))
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): The window is maximized", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG_PTR wlp = GetWindowLongPtrW(hFW, GWL_STYLE);
|
||||||
|
if (wlp & WS_CAPTION)
|
||||||
|
{
|
||||||
|
if (!IsIconic(hFW) && !IsZoomed(hFW))
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): The window is approved!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
bApprooved = TRUE;
|
||||||
|
}
|
||||||
|
else ShowError(IDS_ERR_MAXMIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): The window has no caption!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bApprooved)
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): The window is not approved!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Out(L"Exit from the %s() function", TEXT(__FUNCTION__));
|
||||||
|
|
||||||
|
return bApprooved;
|
||||||
|
}
|
||||||
|
|
||||||
VOID HandlingTrayIcon()
|
VOID HandlingTrayIcon()
|
||||||
{
|
{
|
||||||
if (bShowIcon)
|
logger.Out(L"Entering the %s() function, fShowIcon = %s", TEXT(__FUNCTION__), fShowIcon ? L"True" : L"False");
|
||||||
|
|
||||||
|
if (fShowIcon)
|
||||||
{
|
{
|
||||||
if (!Shell_NotifyIcon(NIM_ADD, &nid))
|
bool bResult1 = Shell_NotifyIconW(NIM_ADD, &nid);
|
||||||
|
logger.Out(L"%s(%d): Shell_NotifyIconW(NIM_ADD): %s", TEXT(__FUNCTION__), __LINE__, bResult1 ? L"True" : L"False");
|
||||||
|
|
||||||
|
bool bResult2 = Shell_NotifyIconW(NIM_SETVERSION, &nid);
|
||||||
|
logger.Out(L"%s(%d): Shell_NotifyIconW(NIM_SETVERSION): %s", TEXT(__FUNCTION__), __LINE__, bResult2 ? L"True" : L"False");
|
||||||
|
|
||||||
|
if (!bResult1 || !bResult2)
|
||||||
{
|
{
|
||||||
|
logger.Out(L"%s(%d): Error creating trayicon!", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
ShowError(IDS_ERR_ICON);
|
ShowError(IDS_ERR_ICON);
|
||||||
bShowIcon = FALSE;
|
Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
|
fShowIcon = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shell_NotifyIconW(NIM_MODIFY, &nid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Out(L"Exit from the %s() function", TEXT(__FUNCTION__));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ShowError(UINT uID)
|
VOID ShowError(UINT uID)
|
||||||
{
|
{
|
||||||
CHAR szErrorText[MAX_LOADSTRING]; // Error's text
|
WCHAR szErrorText[MAX_LOADSTRING]; // Error's text
|
||||||
LoadString(hInst, uID, szErrorText, _countof(szErrorText));
|
LoadStringW(hInst, uID, szErrorText, _countof(szErrorText));
|
||||||
MessageBox(hWnd, szErrorText, szTitle, MB_OK | MB_ICONERROR);
|
MessageBoxW(NULL, szErrorText, szTitle, MB_OK | MB_ICONERROR | MB_TOPMOST);
|
||||||
|
}
|
||||||
|
|
||||||
|
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
INITCOMMONCONTROLSEX icex = { 0 };
|
||||||
|
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||||
|
icex.dwICC = ICC_LINK_CLASS;
|
||||||
|
InitCommonControlsEx(&icex);
|
||||||
|
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
logger.Out(L"%s(%d): Initializing the 'About' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
WCHAR szAboutProgName[MAX_LOADSTRING];
|
||||||
|
WCHAR szAboutCopyright[MAX_LOADSTRING];
|
||||||
|
WCHAR szAboutBuildTime[MAX_LOADSTRING];
|
||||||
|
WCHAR szAboutHelp[MAX_LOADSTRING * 12];
|
||||||
|
MultiByteToWideChar(1251, 0, PRODUCT_NAME_FULL, _countof(PRODUCT_NAME_FULL), szAboutProgName, MAX_LOADSTRING);
|
||||||
|
MultiByteToWideChar(1251, 0, PRODUCT_COPYRIGHT, _countof(PRODUCT_COPYRIGHT), szAboutCopyright, MAX_LOADSTRING);
|
||||||
|
MultiByteToWideChar(1251, 0, ABOUT_BUILD, _countof(ABOUT_BUILD), szAboutBuildTime, MAX_LOADSTRING);
|
||||||
|
LoadStringW(hInst, IDS_ABOUT, szAboutHelp, _countof(szAboutHelp));
|
||||||
|
SetDlgItemTextW(hDlg, IDC_ABOUT_PROGNAME, szAboutProgName);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_ABOUT_COPYRIGHT, szAboutCopyright);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_ABOUT_BUILDTIME, szAboutBuildTime);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_ABOUTEDIT, szAboutHelp);
|
||||||
|
#ifdef NO_DONATION
|
||||||
|
HWND hLink = GetDlgItem(hDlg, IDC_DONATIONLINK);
|
||||||
|
if (hLink) DestroyWindow(hLink);
|
||||||
|
HWND hText = GetDlgItem(hDlg, IDC_DONATIONTEXT);
|
||||||
|
if (hText) DestroyWindow(hText);
|
||||||
|
#endif // !NO_DONATION
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): End of initializing the 'About' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR pNMHdr = (LPNMHDR)lParam;
|
||||||
|
if ((NM_CLICK == pNMHdr->code || NM_RETURN == pNMHdr->code) && IDC_DONATIONLINK == pNMHdr->idFrom)
|
||||||
|
{
|
||||||
|
PNMLINK pNMLink = (PNMLINK)pNMHdr;
|
||||||
|
LITEM item = pNMLink->item;
|
||||||
|
ShellExecuteW(NULL, L"open", item.szUrl, NULL, NULL, SW_SHOW);
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Pressed the donation link! :-)", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
if (IDOK == LOWORD(wParam) || IDCANCEL == LOWORD(wParam))
|
||||||
|
{
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
|
||||||
|
logger.Out(L"%s(%d): Closing the 'About' dialog", TEXT(__FUNCTION__), __LINE__);
|
||||||
|
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (INT_PTR)FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
48
wCenterWindow/wCenterWindow.exe.manifest
Normal file
48
wCenterWindow/wCenterWindow.exe.manifest
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
|
||||||
|
<description>Centers windows by hotkey (C++)</description>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="Win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
processorArchitecture="*"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!--ID Windows Vista -->
|
||||||
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
|
<!--ID Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
|
<!--ID Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
|
<!--ID Windows 8.1 -->
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
<!--ID Windows 10/11 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> </windowsSettings>
|
||||||
|
<windowsSettings> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness> </windowsSettings>
|
||||||
|
<windowsSettings> <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> </windowsSettings>
|
||||||
|
<windowsSettings> <heapType xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</heapType> </windowsSettings>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
</assembly>
|
||||||
32
wCenterWindow/wCenterWindow.h
Normal file
32
wCenterWindow/wCenterWindow.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// wCenterWindow
|
||||||
|
// wCenterWindow.h
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define MAX_LOADSTRING 50
|
||||||
|
|
||||||
|
// Windows Header Files
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <strsafe.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <wininet.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
#include <CommCtrl.h>
|
||||||
|
#include <process.h>
|
||||||
|
|
||||||
|
// Logger header file
|
||||||
|
#include "CLogger.h"
|
||||||
|
|
||||||
|
// VerionInfo header file
|
||||||
|
#include "VersionInfo.h"
|
||||||
|
|
||||||
|
// wCenterWindow's title
|
||||||
|
extern WCHAR szTitle[MAX_LOADSTRING];
|
||||||
|
|
||||||
|
// An instance of the "CLogger" class
|
||||||
|
extern CLogger logger;
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 113 KiB |
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
@@ -19,37 +19,39 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
<ProjectGuid>{2494B3F2-585E-4A2E-A013-20A15AE25B9E}</ProjectGuid>
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{f1a1603a-f5d0-47b8-8e4b-cf17747bcfba}</ProjectGuid>
|
||||||
<RootNamespace>wCenterWindow</RootNamespace>
|
<RootNamespace>wCenterWindow</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<XPDeprecationWarning>false</XPDeprecationWarning>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@@ -69,73 +71,145 @@
|
|||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CopyCppRuntimeToOutputDir>false</CopyCppRuntimeToOutputDir>
|
||||||
|
<CopyLocalDeploymentContent>false</CopyLocalDeploymentContent>
|
||||||
|
<CopyLocalProjectReference>false</CopyLocalProjectReference>
|
||||||
|
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
|
||||||
|
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CopyLocalDeploymentContent>false</CopyLocalDeploymentContent>
|
||||||
|
<CopyLocalProjectReference>false</CopyLocalProjectReference>
|
||||||
|
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
|
||||||
|
<CopyCppRuntimeToOutputDir>false</CopyCppRuntimeToOutputDir>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>false</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
<AdditionalDependencies>comctl32.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
<Manifest>
|
||||||
|
<AdditionalManifestFiles>%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
|
<ManifestFromManagedAssembly>
|
||||||
|
</ManifestFromManagedAssembly>
|
||||||
|
</Manifest>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>"$(SolutionDir)pre-build.cmd" "$(SolutionDir)" "$(ProjectDir)"</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<ConformanceMode>false</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<UACExecutionLevel>HighestAvailable</UACExecutionLevel>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>comctl32.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Manifest>
|
||||||
|
<AdditionalManifestFiles>%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
|
</Manifest>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>"$(SolutionDir)pre-build.cmd" "$(SolutionDir)" "$(ProjectDir)"</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<Manifest>
|
||||||
|
<AdditionalManifestFiles>%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
|
</Manifest>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>powershell -File "$(SolutionDir)Update_Version.ps1" move /y "$(SolutionDir)VersionInfo.h" "$(ProjectDir)"</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Manifest>
|
||||||
|
<AdditionalManifestFiles>%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
|
</Manifest>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>powershell -File "$(SolutionDir)Update_Version.ps1" move /y "$(SolutionDir)VersionInfo.h" "$(ProjectDir)"</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\MyFunctions\MoveWindowToMonitorCenter.cpp" />
|
<ClInclude Include="CLogger.h" />
|
||||||
|
<ClInclude Include="framework.h" />
|
||||||
|
<ClInclude Include="picojson.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
<ClInclude Include="updater.h" />
|
||||||
|
<ClInclude Include="wCenterWindow.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="CLogger.cpp" />
|
||||||
|
<ClCompile Include="updater.cpp" />
|
||||||
<ClCompile Include="wCenterWindow.cpp" />
|
<ClCompile Include="wCenterWindow.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\MyFunctions\MoveWindowToMonitorCenter.h" />
|
<ResourceCompile Include="wCenterWindow.rc" />
|
||||||
<ClInclude Include="resource.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="wCenterWindow.rc" />
|
<Image Include="wCenterWindow.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Manifest Include="wCenterWindow.exe.manifest" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\README.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -3,36 +3,70 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="framework.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="wCenterWindow.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="logger.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="globals.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="picojson.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="updater.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="wCenterWindow.cpp">
|
<ClCompile Include="wCenterWindow.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\MyFunctions\MoveWindowToMonitorCenter.cpp">
|
<ClCompile Include="logger.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="updater.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="resource.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\..\MyFunctions\MoveWindowToMonitorCenter.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="wCenterWindow.rc">
|
<ResourceCompile Include="wCenterWindow.rc">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="wCenterWindow.ico">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Manifest Include="wCenterWindow.exe.manifest">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Manifest>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\README.md" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup />
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LocalDebuggerCommandArguments>
|
||||||
|
</LocalDebuggerCommandArguments>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user