Friday, 15 January 2010

javascript - js-ctypes: Pointer to intptr_t -



javascript - js-ctypes: Pointer to intptr_t -

in ctypes have

tbbutton.ptr(ctypes.uint64("0x1e677e60")

this equivalent abutton.address() in line of code here:

var rez = sendmessage(htoolbar, 0x417 /** tb_getbutton **/, 1, abutton.address());

when run code error:

exception: expected type intptr_t, got tbbutton.ptr(ctypes.uint64("0xaa4eb20"))

so because in sendmessage defintion have this:

var sendmessage = user32.declare('sendmessagew', ctypes.winapi_abi, ctypes.intptr_t, ctypes.voidptr_t, // hwnd ctypes.uint32_t, // msg ctypes.uintptr_t, // wparam ctypes.intptr_t // lparam );

so question is: type of tbbutton.ptr(ctypes.uint64("0x1e677e60") can alter lparam in sendmessage defintion type.

or alternatively: possible create intptr_t? ctypes.intptr_t(abutton.address()), tried doesn't work.

it pointer tbbutton, whatever tbbutton is, while intptr_t integer big plenty hold pointer address.

you need cast pointer intptr_t.

var lparam = ctypes.cast(tbbuttonptr, ctypes.intptr_t);

javascript firefox-addon jsctypes

No comments:

Post a Comment