Can't use FindWindow from user32 library
See original GitHub issueHi
I’m trying to call FindWindow from user32.dll, i got working perfectly an example that shows a MessageBox but with this code nodejs crashed and I can’t figure out why
var user32 = new FFI.Library('user32', {
'FindWindow': [
'pointer', [ 'string', 'string']
]
});
var process = user32.FindWindow(NULL,"Calculadora")
console.log("Process ID", process)
Error:
Error: Dynamic Symbol Retrieval Error: "FindWindow": Controlador no v�lido.
at DynamicLibrary.get (C:\Program Files (x86)\nodejs\node_modules\node-ffi\lib\dynamic_library.js:81:11)
at C:\Program Files (x86)\nodejs\node_modules\node-ffi\lib\library.js:19:21
at Array.forEach (native)
at new Library (C:\Program Files (x86)\nodejs\node_modules\node-ffi\lib\library.js:18:24)
at C:\Program Files (x86)\nodejs\diablo.js:18:18
at callbacks (C:\Program Files (x86)\nodejs\node_modules\express\lib\router\index.js:272:11)
at param (C:\Program Files (x86)\nodejs\node_modules\express\lib\router\index.js:246:11)
at pass (C:\Program Files (x86)\nodejs\node_modules\express\lib\router\index.js:253:5)
at Router._dispatch (C:\Program Files (x86)\nodejs\node_modules\express\lib\router\index.js:280:4)
at Object.handle (C:\Program Files (x86)\nodejs\node_modules\express\lib\router\index.js:45:10)
Issue Analytics
- State:
- Created 11 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
windows - FindWindow() not working - Stack Overflow
I want to do this using FindFindow form the user32.dll but i cant get it run. Weird Thing is that even if i...
Read more >FindWindowA function (winuser.h) - Win32 - Microsoft Learn
Retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child ......
Read more >unable to call windows API "FindWindow" and errors in using ...
I want to use the windows api of "FindWindow" to get the handle of an opened window. The following is the code. ;...
Read more >FindWindow API function does not work if only the class name ...
If you try to use the FindWindow API function, passing only the class name and an ... Declare Function FindWindow Lib "user32" Alias...
Read more >Windows API Call - FindWindow Not Working - Xojo Forum
Thank you! Declare Function FindWindow Lib “user32” Alias “FindWindowA” (strClassName As CString, strWindowName As CString) As Integer Var ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone coming from google (like me): utf-16 requires 2 NULLs at the end, so correct implementation is (updated to work with newer ffi):
Well with node-ffi v1.0, you can define a
Ucs2String
type and define your ffi’d functions with that as an argument type. That way you could pass in regular JS strings to the function and node-ffi would create the proper Buffer with the string written to it.Something like this should work: