20
edits
MarkFinkle (talk | contribs) |
Kirschkern (talk | contribs) No edit summary |
||
Line 16: | Line 16: | ||
<pre> | <pre> | ||
/* Load JS Ctypes Javascript module */ | |||
Components.utils.import("resource://gre/modules/ctypes.jsm"); | |||
var Types = ctypes.types; | |||
/* Load windows api dll */ | |||
var lib = ctypes.open("C:\\WINDOWS\\system32\\user32.dll"); | |||
/* Declare the signature of the function we are going to call */ | |||
var msgBox = lib.declare("MessageBoxW", | |||
ctypes.stdcall_abi, | |||
ctypes.int32_t, | |||
ctypes.int32_t, | |||
ctypes.ustring, | |||
ctypes.ustring, | |||
ctypes.int32_t); | |||
var MB_OK = 3; | |||
/* Do it! */ | |||
var ret = msgBox(0, "Hello world", "title", MB_OK); | |||
/* Display the returned value */ | |||
alert("MessageBox result : "+ret); | |||
lib.close(); | |||
</pre> | </pre> | ||
edits