Using node to call win32api and focus a window

I want to focus and application to further automate input from my node application.

My approach is to use koffi (basically newer version off ffi-napi) to call the win32api and focus that window.

I can open and focus the notepad, but I didnt manage to do it for any other app.

This is my working example for the notepad app:

const koffi = require('koffi');

const user32 = koffi.load('user32.dll');
const FindWindowA = user32.func('__stdcall', 'FindWindowA', 'long', ['string', 'string']);

const ShowWindow = user32.func('__stdcall', 'ShowWindow', 'bool', ['long', 'int']);
const SetForegroundWindow = user32.func('__stdcall', 'SetForegroundWindow', 'bool', ['long']);
const BringWindowToTop = user32.func('__stdcall', 'BringWindowToTop', 'bool', ['long']);
const SetFocus = user32.func('__stdcall', 'SetFocus', 'long', ['long']);

const window = FindWindowA('Notepad', null);
console.log(window);

ShowWindow(window, 9);
SetForegroundWindow(window);
BringWindowToTop(window);
SetFocus(window);

Which will return a handle for the notepad app and focuses it after.
I could not manage to make it work with any other program. I understand that browsers etc. have changing titles.
I want to do it for the Riot Client but cannot seem to find the program class or title, or at least to get a valid handle of it.

I read this question: Setting focus to a Windows application from Node-JS
The example provided does not work (transpiled to koffi syntax) in the same way. Only by switching the input parameters, and only for Notepad.

What can be the error here? I assume that the Riot Client title or class will be constant.