Skip to content

Commit 5df6336

Browse files
committed
Add DwmApi project with DwmFlush
1 parent 58de8e8 commit 5df6336

15 files changed

+346
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Library | Package name | NuGet | Description
6262
advapi32.dll |`PInvoke.AdvApi32`| [![NuGet](https://img.shields.io/nuget/dt/PInvoke.AdvApi32.svg)](https://www.nuget.org/packages/PInvoke.AdvApi32)|Windows Advanced Services
6363
bcrypt.dll |`PInvoke.BCrypt` | [![NuGet](https://img.shields.io/nuget/dt/PInvoke.BCrypt.svg)](https://www.nuget.org/packages/PInvoke.BCrypt)|[Windows Cryptography API: Next Generation][CNG]
6464
crypt32.dll |`PInvoke.Crypt32` | [![NuGet](https://img.shields.io/nuget/dt/PInvoke.Crypt32.svg)](https://www.nuget.org/packages/PInvoke.Crypt32)|[Windows Cryptography API][Crypt32]
65+
DwmApi.dll |`PInvoke.DwmApi` | [![NuGet](https://img.shields.io/nuget/dt/PInvoke.DwmApi.svg)](https://www.nuget.org/packages/PInvoke.DwmApi)|[Desktop Window Manager][DwmApi]
6566
gdi32.dll |`PInvoke.Gdi32` | [![NuGet](https://img.shields.io/nuget/dt/PInvoke.Gdi32.svg)](https://www.nuget.org/packages/PInvoke.Gdi32)|[Windows Graphics Device Interface][Gdi]
6667
hid.dll |`PInvoke.Hid` | [![NuGet](https://img.shields.io/nuget/dt/PInvoke.Hid.svg)](https://www.nuget.org/packages/PInvoke.Hid)|[Windows Human Interface Devices][Hid]
6768
kernel32.dll |`PInvoke.Kernel32`| [![NuGet](https://img.shields.io/nuget/dt/PInvoke.Kernel32.svg)](https://www.nuget.org/packages/PInvoke.Kernel32)|Windows Kernel API
@@ -84,6 +85,7 @@ public release of the library.
8485

8586
[CNG]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376210
8687
[Crypt32]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa380256
88+
[DwmApi]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx
8789
[Hid]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff538865
8890
[SetupApi]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff550855
8991
[Gdi]: https://msdn.microsoft.com/en-us/library/dd145203
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
3+
<PropertyGroup>
4+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
5+
</PropertyGroup>
6+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " />
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
8+
<PropertyGroup>
9+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
10+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
11+
<ProjectGuid>{AA9EADF7-B399-4DC3-B616-5E0B8A796DFE}</ProjectGuid>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<RootNamespace>PInvoke</RootNamespace>
15+
<AssemblyName>PInvoke.DwmApi</AssemblyName>
16+
<FileAlignment>512</FileAlignment>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
21+
</PropertyGroup>
22+
<ItemGroup>
23+
<Reference Include="System" />
24+
<Reference Include="System.Core" />
25+
<Reference Include="Microsoft.CSharp" />
26+
</ItemGroup>
27+
<ItemGroup>
28+
<ProjectReference Include="..\CodeGenerationAttributes.Net40\CodeGenerationAttributes.Net40.csproj">
29+
<Project>{6a77281b-c503-44ea-90c1-0e9868d06cd0}</Project>
30+
<Name>CodeGenerationAttributes.Net40</Name>
31+
<ExcludeFromNuPkg>true</ExcludeFromNuPkg>
32+
</ProjectReference>
33+
<ProjectReference Include="..\CodeGeneration\CodeGeneration.csproj">
34+
<Project>{C1815471-02AF-4BB9-8D83-652ADBAFF5B6}</Project>
35+
<Name>CodeGeneration</Name>
36+
<ExcludeFromNuPkg>true</ExcludeFromNuPkg>
37+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
38+
</ProjectReference>
39+
<ProjectReference Include="..\Windows.Core\Windows.Core.csproj">
40+
<Project>{b08c3c79-4cdd-4d37-933c-07d3452fd5f1}</Project>
41+
<Name>Windows.Core</Name>
42+
</ProjectReference>
43+
</ItemGroup>
44+
<ItemGroup>
45+
<None Include="project.json" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="DwmApi.cs">
49+
<Generator>MSBuild:GenerateCodeFromAttributes</Generator>
50+
</Compile>
51+
<Compile Include="Properties\AssemblyInfo.cs" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<Content Include="DwmApi.exports.txt">
55+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56+
</Content>
57+
</ItemGroup>
58+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
60+
</Project>

src/DwmApi.Desktop/DwmApi.Helpers.cs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
3+
4+
namespace PInvoke
5+
{
6+
using System;
7+
using System.Runtime.InteropServices;
8+
9+
/// <content>
10+
/// Methods and nested types that are not strictly P/Invokes but provide
11+
/// a slightly higher level of functionality to ease calling into native code.
12+
/// </content>
13+
public static partial class DwmApi
14+
{
15+
// This is where you define methods that assist in calling P/Invoke methods.
16+
// For example, if a P/Invoke method requires allocating unmanaged memory
17+
// and freeing it up after the call, a helper method in this file would
18+
// make "P/Invoking" for most callers much easier and is a welcome addition.
19+
}
20+
}

src/DwmApi.Desktop/DwmApi.cs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
3+
4+
namespace PInvoke
5+
{
6+
using System;
7+
using System.Runtime.InteropServices;
8+
9+
/// <content>
10+
/// Exported functions from the DwmApi.dll Windows library
11+
/// that are available to Desktop apps only.
12+
/// </content>
13+
[OfferFriendlyOverloads]
14+
public static partial class DwmApi
15+
{
16+
/// <summary>
17+
/// Issues a flush call that blocks the caller until the next present, when all of the Microsoft DirectX surface updates that are currently outstanding have been made. This compensates for very complex scenes or calling processes with very low priority.
18+
/// </summary>
19+
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
20+
/// <remarks>
21+
/// DwmFlush waits for any queued DirectX changes that were queued by the calling application to be drawn to the screen before returning. It does not flush the entire session rendering batch.
22+
/// </remarks>
23+
[DllImport(nameof(DwmApi))]
24+
public static extern HResult DwmFlush();
25+
}
26+
}

src/DwmApi.Desktop/DwmApi.exports.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
DllCanUnloadNow
2+
DllGetClassObject
3+
DwmAttachMilContent
4+
DwmDefWindowProc
5+
DwmDetachMilContent
6+
DwmEnableBlurBehindWindow
7+
DwmEnableComposition
8+
DwmEnableMMCSS
9+
DwmExtendFrameIntoClientArea
10+
DwmFlush
11+
DwmGetColorizationColor
12+
DwmGetCompositionTimingInfo
13+
DwmGetGraphicsStreamClient
14+
DwmGetGraphicsStreamTransformHint
15+
DwmGetTransportAttributes
16+
DwmGetWindowAttribute
17+
DwmInvalidateIconicBitmaps
18+
DwmIsCompositionEnabled
19+
DwmModifyPreviousDxFrameDuration
20+
DwmpAllocateSecurityDescriptor
21+
DwmpDxBindSwapChain
22+
DwmpDxGetWindowSharedSurface
23+
DwmpDxgiIsThreadDesktopComposited
24+
DwmpDxUnbindSwapChain
25+
DwmpDxUpdateWindowRedirectionBltSurface
26+
DwmpDxUpdateWindowSharedSurface
27+
DwmpEnableDDASupport
28+
DwmpFreeSecurityDescriptor
29+
DwmpRenderFlick
30+
DwmQueryThumbnailSourceSize
31+
DwmRegisterThumbnail
32+
DwmRenderGesture
33+
DwmSetDxFrameDuration
34+
DwmSetIconicLivePreviewBitmap
35+
DwmSetIconicThumbnail
36+
DwmSetPresentParameters
37+
DwmSetWindowAttribute
38+
DwmShowContact
39+
DwmTetherContact
40+
DwmTetherTextContact
41+
DwmTransitionOwnedWindow
42+
DwmUnregisterThumbnail
43+
DwmUpdateThumbnailProperties
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
3+
4+
using System.Reflection;
5+
using System.Runtime.CompilerServices;
6+
using System.Runtime.InteropServices;
7+
8+
[assembly: AssemblyTitle("PInvoke.DwmApi")]
9+
[assembly: AssemblyProduct("PInvoke.DwmApi")]
10+
[assembly: AssemblyCopyright("Copyright © 2015")]

src/DwmApi.Desktop/project.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"supports": { },
3+
"dependencies": {
4+
},
5+
"frameworks": {
6+
".NETFramework,Version=v4.0": { }
7+
},
8+
"runtimes": {
9+
"win-anycpu": { },
10+
"win": { }
11+
}
12+
}

src/DwmApi.NuGet/DwmApi.NuGet.nuproj

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " />
4+
<ItemGroup Label="ProjectConfigurations">
5+
<ProjectConfiguration Include="Debug|AnyCPU">
6+
<Configuration>Debug</Configuration>
7+
<Platform>AnyCPU</Platform>
8+
</ProjectConfiguration>
9+
<ProjectConfiguration Include="Release|AnyCPU">
10+
<Configuration>Release</Configuration>
11+
<Platform>AnyCPU</Platform>
12+
</ProjectConfiguration>
13+
</ItemGroup>
14+
<PropertyGroup Label="Globals">
15+
<ProjectGuid>{667CCC7D-4A34-427C-AA3F-23100E4CD195}</ProjectGuid>
16+
</PropertyGroup>
17+
<PropertyGroup>
18+
<NuSpecTemplate>PInvoke.DwmApi.nuspec</NuSpecTemplate>
19+
</PropertyGroup>
20+
<Import Project="$(NuProjPath)\NuProj.props" Condition="Exists('$(NuProjPath)\NuProj.props')" />
21+
<PropertyGroup Label="Configuration">
22+
<Id>PInvoke.DwmApi</Id>
23+
<Title>PInvoke.DwmApi</Title>
24+
<Authors>Andrew Arnott</Authors>
25+
<Owners>aarnott</Owners>
26+
<Summary>P/Invoke methods for the Windows DwmApi.dll.</Summary>
27+
<Description>P/Invoke methods for the Windows DwmApi.dll.</Description>
28+
<ReleaseNotes>
29+
</ReleaseNotes>
30+
<ProjectUrl>https://github.com/AArnott/pinvoke</ProjectUrl>
31+
<LicenseUrl>https://github.com/AArnott/pinvoke/blob/master/LICENSE.txt</LicenseUrl>
32+
<Copyright>Copyright © Andrew Arnott</Copyright>
33+
<Tags>pinvoke .net pcl</Tags>
34+
<EmbedSourceFiles>true</EmbedSourceFiles>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<ProjectReference Include="..\DwmApi.Desktop\DwmApi.Desktop.csproj" />
38+
<ProjectReference Include="..\Windows.Core.NuGet\Windows.Core.NuGet.nuproj" />
39+
</ItemGroup>
40+
<ItemGroup>
41+
<None Include="PInvoke.DwmApi.nuspec" />
42+
</ItemGroup>
43+
<Import Project="$(NuProjPath)\NuProj.targets" />
44+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
45+
</Project>
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
3+
<metadata>
4+
<id>PInvoke.DwmApi</id>
5+
<version>$version$</version>
6+
<authors>aarnott</authors>
7+
<owners></owners>
8+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
9+
<description>to be overwritten by project file</description>
10+
<releaseNotes></releaseNotes>
11+
<copyright></copyright>
12+
<tags></tags>
13+
<dependencies>
14+
</dependencies>
15+
</metadata>
16+
</package>

src/DwmApi.Tests/DwmApi.Tests.csproj

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
5+
</PropertyGroup>
6+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " />
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
8+
<PropertyGroup>
9+
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
10+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
11+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
12+
<ProjectGuid>{4B835D69-B10B-4F53-80DE-AC392CEFB896}</ProjectGuid>
13+
<OutputType>Library</OutputType>
14+
<AppDesignerFolder>Properties</AppDesignerFolder>
15+
<RootNamespace>
16+
</RootNamespace>
17+
<AssemblyName>PInvoke.DwmApi.Tests</AssemblyName>
18+
<DefaultLanguage>en-US</DefaultLanguage>
19+
<FileAlignment>512</FileAlignment>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24+
</PropertyGroup>
25+
<ItemGroup>
26+
<Reference Include="System" />
27+
<Reference Include="System.Core" />
28+
<Reference Include="Microsoft.CSharp" />
29+
</ItemGroup>
30+
<ItemGroup>
31+
<None Include="project.json" />
32+
</ItemGroup>
33+
<ItemGroup>
34+
<Compile Include="DwmApiFacts.cs" />
35+
<Compile Include="Properties\AssemblyInfo.cs" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<ProjectReference Include="..\DwmApi.Desktop\DwmApi.Desktop.csproj">
39+
<Project>{AA9EADF7-B399-4DC3-B616-5E0B8A796DFE}</Project>
40+
<Name>DwmApi.Desktop</Name>
41+
</ProjectReference>
42+
<ProjectReference Include="..\Windows.Core\Windows.Core.csproj">
43+
<Project>{B08C3C79-4CDD-4D37-933C-07D3452FD5F1}</Project>
44+
<Name>Windows.Core</Name>
45+
</ProjectReference>
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
49+
</ItemGroup>
50+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
51+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
52+
</Project>

src/DwmApi.Tests/DwmApiFacts.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
3+
4+
using System;
5+
using PInvoke;
6+
using Xunit;
7+
using static PInvoke.DwmApi;
8+
9+
public class DwmApiFacts
10+
{
11+
[Fact]
12+
public void Flush()
13+
{
14+
DwmFlush().ThrowOnFailure();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
3+
4+
using System.Reflection;
5+
using System.Resources;
6+
7+
[assembly: AssemblyTitle("PInvoke.DwmApi.Tests")]
8+
[assembly: AssemblyProduct("PInvoke.DwmApi.Tests")]
9+
[assembly: AssemblyCopyright("Copyright © 2015")]
10+
[assembly: NeutralResourcesLanguage("en")]

src/DwmApi.Tests/project.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"supports": { },
3+
"dependencies": {
4+
"xunit": "2.1.0",
5+
"xunit.runner.visualstudio": "2.1.0"
6+
},
7+
"frameworks": {
8+
".NETFramework,Version=v4.6": { }
9+
},
10+
"runtimes": {
11+
"win-anycpu": { },
12+
"win": { }
13+
}
14+
}

src/PInvoke.Win32/PInvoke.Win32.nuproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ProjectReference Include="..\BCrypt.NuGet\BCrypt.NuGet.nuproj" />
1717
<ProjectReference Include="..\Crypt32.NuGet\Crypt32.NuGet.nuproj" />
1818
<ProjectReference Include="..\DbgHelp.NuGet\DbgHelp.NuGet.nuproj" />
19+
<ProjectReference Include="..\DwmApi.NuGet\DwmApi.NuGet.nuproj" />
1920
<ProjectReference Include="..\Gdi32.NuGet\Gdi32.NuGet.nuproj" />
2021
<ProjectReference Include="..\Hid.NuGet\Hid.NuGet.nuproj" />
2122
<ProjectReference Include="..\ImageHlp.NuGet\ImageHlp.NuGet.nuproj" />

0 commit comments

Comments
 (0)