{"id":23108567,"url":"https://github.com/venryx/windows-ffi","last_synced_at":"2025-08-16T17:32:43.743Z","repository":{"id":42563079,"uuid":"403271588","full_name":"Venryx/windows-ffi","owner":"Venryx","description":"NodeJS wrappers around Windows p-invoke/dll functions in user32, gdi32, etc. (based on node-ffi-napi)","archived":false,"fork":false,"pushed_at":"2024-01-05T12:16:17.000Z","size":65,"stargazers_count":20,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T09:43:36.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Venryx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-09-05T09:54:00.000Z","updated_at":"2024-04-18T16:31:14.000Z","dependencies_parsed_at":"2024-01-05T13:37:44.666Z","dependency_job_id":"4dba76ac-fa11-40d1-871f-9570516bd915","html_url":"https://github.com/Venryx/windows-ffi","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":"0.17647058823529416","last_synced_commit":"8e430c8ee2fc44fe98033fd4b623d70378e6ef2b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Venryx/windows-ffi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwindows-ffi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwindows-ffi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwindows-ffi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwindows-ffi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Venryx","download_url":"https://codeload.github.com/Venryx/windows-ffi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Venryx%2Fwindows-ffi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270746668,"owners_count":24638390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T01:28:01.678Z","updated_at":"2025-08-16T17:32:43.438Z","avatar_url":"https://github.com/Venryx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Windows FFI\n\nNodeJS wrappers around Windows p-invoke/dll functions in user32, gdi32, etc. (based on node-ffi-napi)\n\n## Installation\n\n* 1\\) Install `ffi-napi` in your project: `npm i ffi-napi`\n\t* 1.1\\) You may need to install the windows-build-tools first for `ffi-napi` to be able to build: `npm install --global --production windows-build-tools`\n* 2\\) Install: `npm i windows-ffi`\n\t* 2.1\\) If you're using `windows-ffi` in symlinked mode (**ie. you probably don't need this step!**), supply the parent project's copy of the `node-ffi` libraries using the init code below:\n\t\t```\n\t\t// Make sure the code below runs before windows-ffi is imported! (example approach: https://stackoverflow.com/a/42817956)\n\t\timport ffi from \"ffi-napi\";\n\t\timport ref from \"ref-napi\";\n\t\timport refStructDI from \"ref-struct-di\";\n\t\timport {SupplyConfig} from \"windows-ffi/Dist/@UserSupplied/PreImportConfig.js\";\n\n\t\tSupplyConfig({ffi, ref, refStructDI});\n\t\t```\n\n## Usage\n\nWhile this library is meant to gradually expand to cover more of the Windows API, it will never be 100%, because it's a \"develop as you need it\" sort of endeavor.\n\nSome of the most common and/or noteworthy functionalities are shown below.\n\n### Capture image-data from a region on-screen\n\n```typescript\nimport {VRect, CaptureScreenshot, GetForegroundWindowHandle} from \"windows-ffi\";\n\n// First capture a screenshot of a section of the screen.\nconst screenshot = CaptureScreenshot({\n\twindowHandle: GetForegroundWindowHandle(), // comment to screenshot all windows\n\trectToCapture: new VRect(0, 0, 800, 600),\n});\n\n// The image-data is now stored in the `screenshot.buffer` Buffer object.\n// Access it directly (and cheaply) using the helper functions on `screenshot`.\nfor (let x = 0; x \u003c 800; x++) {\n\tconsole.log(`Pixel color at [${x}, 0] is:`, screenshot.GetPixel(x, 0).ToHex_RGB());\n}\n```\n\nPerformance:\n* Full-screen (2560x1440), all windows (ie. \"desktop\" window): ~80ms\n* Full-screen (2560x1440), single window: ~20ms\n* Region (700x200), all windows (ie. \"desktop\" window): ~50ms\n* Region (700x200), single window: ~4ms\n\n## Tasks\n\nGeneral:\n* Create an accompanying library for Windows-specific functionalities that do not require the `ffi-napi` dependency. (I've had pains with ffi-related building during NodeJS updates, so things that can be done without that dependency is beneficial to bundle separately)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenryx%2Fwindows-ffi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvenryx%2Fwindows-ffi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenryx%2Fwindows-ffi/lists"}