This is an example application using win32
and Node.js
to clone bitmaps from native window windows.
// Import the library index file
const { BitmapTextScanner } = require('./dist/index');
// Call the PreviewBitmap function and provide the window title
const res = BitmapTextScanner.PreviewBitmap(your window title);
- The function
PreviewBitmap
is called and is provided the window title. - The call is delegated to the
nan
PreviewBitmap
function written in C++ acting as the glue between theNode.js
enviroment and theimg-get.cc
file. - The underlying
const char*
(a c styled string) is retreived from the js object in the C++ space and passed toPreviewBitmapInternal()
containing pure C++ andwin32
. - A bunch of intermediate steps to clone the bitmap from the window take place; checkout file here to see for yourself.
- The result from
PreviewBitmapInternal()
is received and converted into javascript v8 engine objects and returned.
- Recommended installation of
Node.js
18 or later - Follow
vcpkg
's simple installation here - Inside the
vcpkg
root dir, runvcpkg install plog
in the cmdline - Clone the repository
- Run
npm run init:all
to setup dependencies and configuration - Run
npm run build:node
to build the project
Note: Visual Studios C++ Desktop Toolkit is required.
I recommend getting this little tool if you need to plug information easily about various windows. Download here.
Note: Some windows like Google Chrome do not work and present a completely black bitmap.