win32cr
win32cr
Win32 library bindings generated by mjblack/winmd directly from
Microsoft's Windows.Win32.winmd metadata (the win32metadata
NuGet package). The metadata version is pinned by the winmd shard (lib/winmd/winmd.version).
Installation
Add this to your application's shard.yml:
dependencies:
win32cr:
github: mjblack/win32cr
The generated bindings are committed, so nothing needs to be built to use the shard.
To regenerate them (for example after updating the winmd dependency), run
build.ps1 from the shard directory. It builds winmd.exe from lib/winmd,
fetches the pinned Windows.Win32.winmd into winmd/, and regenerates
src/win32cr with the override files in this directory:
C:\Projects\SomeCrystalApp\lib\win32cr> & .\build.ps1
Set WINMD_CACHE=1 to reuse an already fetched metadata file.
Usage
For more examples, please see the examples directory.
require "win32cr"
require "win32cr/ui/windows_and_messaging"
alias WM = Win32cr::UI::WindowsAndMessaging # Simplifies code
WM.messageBoxW(Pointer(Void).null, pwstr("Message Box Body"), pwstr("Title"), WM::MESSAGEBOX_STYLE::MB_OK)
Updating the Windows metadata
The metadata version is pinned in winmd.version. To move to a new
Microsoft.Windows.SDK.Win32Metadata
release, run the Update Windows metadata workflow from the Actions tab with
the NuGet version (for example 70.0.11-preview) and the kind of version bump.
It regenerates the bindings, runs the specs and example builds, bumps
shard.yml, commits to master, tags and publishes a release whose notes
summarize the added and removed symbols. Use the dry-run option to validate a
version without releasing. The workflow pushes with the RELEASE_TOKEN secret
(a repository admin's fine-grained token with contents write access) so the
commit passes the branch ruleset.
CI fails if the committed bindings differ from a fresh regeneration for the
pinned version, so src/win32cr should only change through that workflow (or
by running build.ps1 locally and committing the result).
Contributing
- Fork it (https://github.com/mjblack/win32cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Matthew J. Black - creator and maintainer