jsctypes

X11 - XChangeProperty _NET_WM_ICON

我的梦境 提交于 2020-01-17 02:30:08
问题 I load an image, and then turn it to ARGB data. I use XChangeProperty , instead of making data be unsigned_char i made it long , when i copy paste and run this code from firefox scratchpad, environment > browser, i get a value of 1 for XChangeProperty meaning success, but the icon didn't change. I tested it on Mint 17.1 Cinnamon, and Ubuntu 14.04 with default window manager and also icewm. Is there anything wrong with this code? Does XChangeProperty not work on cinammon and ubuntu? Thanks

Firefox bootstrapped extension: Get native HWND handle of the browser window

被刻印的时光 ゝ 提交于 2020-01-03 03:20:29
问题 I have an external application and I want it to display some information on top of the browser window. My bootstrapped extension needs to pass the browser window handle (native HWND) to my application, along with some other useful information about the window. I'm able to do the communication between them, the only thing that is missing is a way to get the native HWND of the Firefox window. I read a lot about it and although I belive it's possible, I couldn't find a working solution. Here's

How to get MAC address of your machine using a C program?

让人想犯罪 __ 提交于 2020-01-01 00:45:32
问题 This question is exactly like this question: How to get MAC address of your machine using a C program? "I am working on Ubuntu. How can I get MAC address of my machine or an interface say eth0 using C program." Now, I don't usually touch C...but in this case I have to. Since I don't really know what is going on in the following code, which was taken from the answer linked to above, I need some help. #include <sys/socket.h> #include <sys/ioctl.h> #include <linux/if.h> #include <netdb.h>

Mozilla use a C DLL with js-ctypes

冷暖自知 提交于 2019-12-31 04:14:47
问题 I'm tying to build a dll, and then use it with a Firefox extension. I managed to build a DLL using gcc under Windows : #include<stdio.h> int add(int a,int b) { return(a+b); } I try now to use it through my dll. After reading some posts, especially this one, I couldn't manage to make this work: Reference a binary-component to js-ctypes Each time I try ctypes.open, I have the error message: couldn't load the library . However, the DLL path is correct. Here is the JS code: Components.utils

Improper width and height for second monitor from GetMonitorInfo and GetDeviceCaps

寵の児 提交于 2019-12-30 07:28:07
问题 I am trying to get the top left x,y and bottom right x,y. And calculat the width and height of displays. My secondary monitor is 1920x1080 as seen in my display settings screenshot: I am getting the monitor dimensions in two ways. The code below is js-ctypes but I simplified out all the error checking and other ctypes stuff and tried to make it look like c. But this is a winapi issue not ctypes hence I didn't tag the topic with it. First approach: cPoint = POINT(); GetCursorPos(&cPoint); cMon

Reference a binary-component to js-ctypes

…衆ロ難τιáo~ 提交于 2019-12-28 18:37:07
问题 I have registered a binary component in my chrome.manifest : binary-component components/linux/myLib.so abi=Linux_x86-gcc3 Now I want to pass its path to ctypes.open() . My question is: how do I reference the binary component so I can pass it to ctypes.open() ? 回答1: The binary components listed in chrome.manifest should be XPCOM components. Yours on the other hand is a regular library, no need to list it in the manifest - it is a very "manual" approach instead. Your code needs to check

“Couldn't find function symbol in library” - JS-Ctypes

北慕城南 提交于 2019-12-24 17:48:02
问题 My C++ Library function is int RFD_startBackgroundThread() My code in the overlay.js is uri = addon.getResourceURI("components/mac/libReverbFirefoxExtensionLib.dylib"); this.extensionLib = ctypes.open(uri.path); this.startBackgroundThread = this.extensionLib.declare("RFD_startBackgroundThread", ctypes.default_abi, ctypes.unsigned_int); The code throws an exception on the last line. It says " Couldn't find function symbol in library ". The library is a "fat dylib binary" combining both i386

Using js-ctypes, how do I retrieve output from Windows ReadFile?

99封情书 提交于 2019-12-24 17:43:37
问题 I'm using (while not being quite sure about lpBuffer -> char.ptr) let readFile = kernel32.declare( "ReadFile", ctypes.winapi_abi, ctypes.int32_t, //bool // return type: 1 indicates success, 0 failure ctypes.voidptr_t, // in: hObject ctypes.char.ptr, // out: lpBuffer ctypes.uint32_t, // in: lpNumberOfBytesRead ctypes.uint32_t.ptr, // out: lpNumberOfBytesWritten ctypes.voidptr_t.ptr // inout: lpOverlapped ); for BOOL WINAPI ReadFile( _In_ HANDLE hFile, _Out_ LPVOID lpBuffer, _In_ DWORD

Javascript String to C++ char pointer -LPSTR buffer in JSCTypes

人走茶凉 提交于 2019-12-23 05:36:07
问题 I am accessing the DLL from JavaScript using JSCTypes. I have to receive data by passing a character buffer to the following API, __declspec(dllexport) WORD WINAPI receive( LPWORD lpwBufferSize, LPSTR lpsBuffer); My jsctypes looks like this, let receive = libs.dll.declare("receive", ctypes.stdcall_abi, ctypes.int32_t, // Return type - return code ctypes.int32_t.ptr, // buffer size ctypes.char.ptr, // Buffer ); var bufferSize = new ctypes.int32_t(3000000).address(); //3000000 var buffer = new

How can I allow Firefox (or Chrome) to read a PC's hostname or other assignable ID?

强颜欢笑 提交于 2019-12-22 18:14:47
问题 I want to be able to assign a unique name to each PC in a WAN (either in the hostname or in a local file) and somehow allow the browser to pick this information up . The rationale is that I can later trace that "transaction X was carried out on terminal A", which I then know that it is on building B, floor C, room D and so on. Why we need this, it's another topic. Just say we do need this kind of identification for good reason. So far we've used a custom plugin (.dll + .xpi) that would read a