Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
################################################################################
# Данный GITIGNORE-файл был автоматически создан Microsoft(R) Visual Studio.
################################################################################

/.vs
/Release
/CapsWitch
/x64/Release
2 changes: 1 addition & 1 deletion CapsWitch.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, thanks for PR!

We don't want to bump the toolset version so the program code will remain compile-able for Windows XP...

<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions CapsWitch.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
17 changes: 17 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ Settings = { 1, TRUE, FALSE, 0 };

int main(int argc, char** argv)
{
// Register the application for automatic restart.
// An empty string ("") indicates that the application will restart
// with the same command-line arguments as originally provided.
// Windows will only restart the application if it terminates unexpectedly.
// If the user closes the application normally, no restart will occur.
HRESULT hr = RegisterApplicationRestart(L"", 0);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...And, from what I've read, RegisterApplicationRestart function has only been implemented since Vista.

So, there should also be some sort of check whether it is available to link or not (otherwise it will probably crash on XP right after starting).

#if _DEBUG
if (SUCCEEDED(hr))
{
printf("Application restart registered successfully.\n");
}
else
{
printf("Failed to register application restart. Error: 0x%08X\n", hr);
}
#endif

if (importSettingsFromFile(argv[1], &Settings) == -1) { return 1; }

HANDLE hMutex = CreateMutex(0, 0, "CapsWitch");
Expand Down