npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

win32-def

v20.4.1

Published

win32 definitions for node-ffi

Downloads

575

Readme

win32-api

Definitions of Windows Date Types for node-ffi, node-ffi-napi

GitHub tag License Available platform ci Build status codecov Conventional Commits lerna

Initialization

npm run repo:init

Packages

| Package | Version | | ------------- | ---------------------- | | win32-api | main-svg | | win32-def | def-svg |

What can I do with this?

Write node-ffi or node-ffi-napi calling win32 native functions code by Typescript with Types support.

Installing

npm install win32-def

Usage

FFI

import * as ffi from 'ffi-napi'
import { DModel as M, DTypes as W, FModel as FM } from 'win32-def'

export interface Win32Fns extends FM.DllFuncsModel {
  ClientToScreen(hWnd: M.HWND, lpPoint: M.LPPOINT): M.BOOL
  GetAncestor(hwnd: M.HWND, gaFlags: M.UINT): M.HWND
}

export const user32: Win32Fns = ffi.Library('user32.dll', {
  ClientToScreen: [W.BOOL, [W.HWND, W.LPPOINT] ],
  GetAncestor: [W.HWND, [W.HWND, W.UINT] ],
})
import * as ffi from 'ffi-napi'
import { DModel as M, DTypes as W, FModel as FM } from 'win32-def'

export interface Win32Fns extends FM.DllFuncsModel {
  ClientToScreen(hWnd: M.HWND, lpPoint: M.LPPOINT): M.BOOL
  GetAncestor(hwnd: M.HWND, gaFlags: M.UINT): M.HWND
}

export const user32: FM.ExpandFnModel<Win32Fns> = ffi.Library('user32.dll', {
  ClientToScreen: [W.BOOL, [W.HWND, W.LPPOINT] ],
  GetAncestor: [W.HWND, [W.HWND, W.UINT] ],
})

// You can calling with BOTH sync and async method
const hWnd = user32.GetAncestor(hWnd, uint)
user32.GetAncestor.async(handle, uint, (err, hWnd) => {
  // typeof hWnd will be the same of ReturnType of sync method
  if (err) {
    throw err
  }
  if (hWnd && !ref.isNull(hWnd) && ref.address(hWnd)) {
    // ...
  }
  else {
    throw new Error('hWnd invalid')
  }
})

Relevant

License

MIT

Languages