SiddiqSoft.acw32h
2.7.2
dotnet add package SiddiqSoft.acw32h --version 2.7.2
NuGet\Install-Package SiddiqSoft.acw32h -Version 2.7.2
<PackageReference Include="SiddiqSoft.acw32h" Version="2.7.2" />
paket add SiddiqSoft.acw32h --version 2.7.2
#r "nuget: SiddiqSoft.acw32h, 2.7.2"
// Install SiddiqSoft.acw32h as a Cake Addin #addin nuget:?package=SiddiqSoft.acw32h&version=2.7.2 // Install SiddiqSoft.acw32h as a Cake Tool #tool nuget:?package=SiddiqSoft.acw32h&version=2.7.2
Auto Closing/Releasing Win32 Handle Objects
Objective
Make it easy to track the Win32 HANDLE
and HINTERNET
objects while keeping their use as drop-in replacement for their respective HANDLE
or HINTERNET
objects.
Use only when you're holding objects that your application is required to close/release.
Requirements
- C++17
- Useful for Windows projects
Usage
- Use the nuget SiddiqSoft.acw32h
- Be sure to use the proper class
ACW32HANDLE
orACW32HINTERNET
. The underlying types ofHANDLE
andHINTERNET
end up the same so it is not possible to template them into a single class. - Make sure to include the relevant file for your case:
acw32handle.hpp
oracw32hinternet.hpp
as windows headers occasionally have peculiar ordering (notably when WinHTTP, WinINET, WinSock are in the mix).
Example (when using nuget to add the header in the solution)
#include <windows.h>
#include "siddiqsoft/acw32handle.hpp"
#include <winhttp.h>
#include "siddiqsoft/acw32hinternet.hpp"
void foo()
{
// Use the object
siddiqsoft::ACW32HANDLE h( ::CreateFileA(...) );
// or
HANDLE mh = ::CreateFile(.....);
// A std::move is required since the implementation requires
// the transfer of ownership in order to close the handle.
ACW32HANDLE myHandle( std::move(mh) );
// C++ will cleanup the handle if it was properly allocated!
}
<small align="right">
© 2021 Siddiq Software LLC. All rights reserved. Refer to LICENSE.
</small>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
native | native is compatible. |
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SiddiqSoft.acw32h:
Package | Downloads |
---|---|
SiddiqSoft.restcl
Focussed REST Client for modern C++ |
GitHub repositories
This package is not used by any popular GitHub repositories.