Closed ntlvs closed 8 years ago
Can you show me the Windows code that you're trying to emulate?
var wchar_string = wchar.string;
var path = ref.alloc(wchar_string, 'C:\\path\\to\\file');
var kernel = new ffi.Library('kernel32', {
'GetFileAttributesW': ['int', [wchar_string]],
});
var file = kernel.GetFileAttributesW(path); // -1
or
var winm = new ffi.Library('winmm', {
'PlaySoundW': ['bool', [wchar_string, intPtr, 'int']]
});
winm.PlaySoundW(path, ref.NULL, 0x00020000 | 0x0001); // default sound
You don't need to do the ref.alloc()
part, just pass the JS String directly to the PlaySoundW()
function:
winm.PlaySoundW('C:\\path\\to\\file', ref.NULL, 0x00020000 | 0x0001); // default sound
It works. Thanks!
Is there any way to create
LPCTSTR
type? I triedand
I use this with WinAPI but this file cannot be found. Any ideas? Thanks.