20
edits
Kirschkern (talk | contribs) No edit summary |
Kirschkern (talk | contribs) m (Updated the link to the devmo page) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Note|This article is outdated. See the devmo pages for the current version.https://developer.mozilla.org/en/JavaScript_code_modules/ctypes.jsm}} | |||
== Overview == | == Overview == | ||
Line 18: | Line 20: | ||
/* Load JS Ctypes Javascript module */ | /* Load JS Ctypes Javascript module */ | ||
Components.utils.import("resource://gre/modules/ctypes.jsm"); | Components.utils.import("resource://gre/modules/ctypes.jsm"); | ||
/* Load windows api dll */ | /* Load windows api dll */ | ||
Line 41: | Line 42: | ||
lib.close(); | lib.close(); | ||
</pre> | </pre> | ||
Instead of defining the whole path, you may also just give the file name. | |||
<pre> | |||
var lib = ctypes.open("user32.dll"); | |||
</pre> | |||
Or even without the extension. | |||
<pre> | |||
var lib = ctypes.open("user32"); | |||
</pre> | |||
If the full path is not given, Windows uses the following search order to locate the DLL: | |||
#The current directory of the task that is using the DLL. | |||
#The \WINNT directory. | |||
#The \WINNT\SYSTEM directory. | |||
#The \WINNT\SYSTEM32 directory. | |||
#The directory of the executable for the task that is using the DLL. | |||
#A directory listed in the PATH environment variable. | |||
(taken from http://support.microsoft.com/kb/164501/) | |||
{{Note|This functionality cannot be accessed from JavaScript used in web content. Only JavaScript that runs with chrome privileges (extensions and Firefox UI for example) can use js-ctypes.}} | {{Note|This functionality cannot be accessed from JavaScript used in web content. Only JavaScript that runs with chrome privileges (extensions and Firefox UI for example) can use js-ctypes.}} |
edits