nodejs ffi(DLL)

npm install ffi

Error: The specified module could not be found.

npm rebuild

 

var ffi = require('ffi');
var iconv = require("iconv-lite");
var str="中文不乱码"+"\0";
var rawStr = iconv.encode(str, 'GBK');

var Test = ffi.Library('user32.dll',{
'MessageBoxA': ['int',['int','string','string','int']]
});
console.log(rawStr);
Test.MessageBoxA(0,rawStr,rawStr,0);

  

posted @ 2017-05-08 22:15  ahuo  阅读(824)  评论(0编辑  收藏  举报