Skip to content

Commit

Permalink
closing of windows update window
Browse files Browse the repository at this point in the history
  • Loading branch information
bujocek committed Jan 8, 2016
1 parent 4013aa0 commit 67882e9
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
28 changes: 28 additions & 0 deletions DontEncrypt/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void MainLoop()
{
checkForMcAfee();
checkForNCRSecurityMessage();
checkForRestartAfterUpdateDialog();
System.Threading.Thread.Sleep(1000);
}
}
Expand Down Expand Up @@ -87,6 +88,33 @@ private void checkForNCRSecurityMessage()
}
}

private void checkForRestartAfterUpdateDialog()
{
int hwnd = 0;
IntPtr hwndChild = IntPtr.Zero;
IntPtr hwndButton = IntPtr.Zero;
IntPtr hwndSomethingOverButton = IntPtr.Zero;
hwnd = FindWindow("#32770", "Windows Update");
if (hwnd != 0)
{
hwndChild = FindWindowEx((IntPtr)hwnd, IntPtr.Zero, "DirectUIHWND", null);
if (hwndChild != IntPtr.Zero)
{
hwndSomethingOverButton = FindWindowEx((IntPtr)hwndChild, IntPtr.Zero, "CtrlNotifySink", null);
while (hwndSomethingOverButton != IntPtr.Zero)
{
hwndButton = FindWindowEx((IntPtr)hwndSomethingOverButton, IntPtr.Zero, "Button", "&Postpone");
if (hwndButton != IntPtr.Zero)
{
SendMessage((int)hwndButton, BN_CLICKED, 0, IntPtr.Zero);
break;
}
hwndSomethingOverButton = FindWindowEx((IntPtr)hwndChild, hwndSomethingOverButton, "CtrlNotifySink", null);
}
}
}
}

private void Form1_Load(object sender, EventArgs e)
{

Expand Down
40 changes: 40 additions & 0 deletions DontEncrypt/NCR-WindowHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,46 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
16 changes: 14 additions & 2 deletions NCR-WindowHelper.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCR-WindowHelper", "DontEncrypt\NCR-WindowHelper.csproj", "{1DFC32C8-1C0A-450F-AD12-125326EB7910}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|x64.ActiveCfg = Debug|x64
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|x64.Build.0 = Debug|x64
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|x86.ActiveCfg = Debug|x86
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Debug|x86.Build.0 = Debug|x86
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|Any CPU.Build.0 = Release|Any CPU
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|x64.ActiveCfg = Release|x64
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|x64.Build.0 = Release|x64
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|x86.ActiveCfg = Release|x86
{1DFC32C8-1C0A-450F-AD12-125326EB7910}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 67882e9

Please sign in to comment.