win32-def-fork
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.0 • Public • Published

    win32-def

    Definitions of Windows Date Types for node-ffi

    Version License Build Status Build status Coverage Status

    What can I do with this?

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

    Installing

    npm install --save win32-def

    Usage

    // struct usage by ref-struct
    import * as Struct from 'ref-struct'
    import {DStruct as DS} from 'win32-def';
     
     
    // https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805(v=vs.85).aspx
    const point = new Struct(DS.POINT)();
    point.x = 100;
    point.y = 200;
    console.log(point);
    import * as ref from 'ref';
    import {K} from 'win32-api';
    import {FModel as FM, DTypes as W} from 'win32-def';
     
     
    const knl32 = K.load();
    const buf  = <FM.FFIBuffer> Buffer.alloc(4);   // ← here the types
     
    buf.writeInt32LE(12345, 0);
     
    // const hInstance =<W.FFIBuffer> Buffer.alloc(process.arch === 'x64' ? 8 : 4);
    const hInstance = <FM.FFIBuffer> ref.alloc(W.HINSTANCE);    // W.HINSTANCE is 'int64*' under x64, 'int32*' under ia32
    knl32.GetModuleHandleExW(0, null, hInstance);

    Relevant

    License

    MIT

    Languages

    Install

    npm i win32-def-fork

    DownloadsWeekly Downloads

    2

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    252 kB

    Total Files

    32

    Last publish

    Collaborators

    • dunklestoast
    • thenoim