Javascript js ctypes:指向intptr\t的指针

Javascript js ctypes:指向intptr\t的指针,javascript,firefox-addon,jsctypes,Javascript,Firefox Addon,Jsctypes,用我的字体 TBButton.ptr(ctypes.UInt64("0x1e677e60") 这相当于此代码行中的aButton.address(): var rez = SendMessage(hToolbar, 0x417 /** TB_GETBUTTON **/, 1, aButton.address()); 运行此代码时,出现错误: 异常:预期的类型为intptr_t,得到了TBButton.ptr(ctypes.UInt64(“0xaa4eb20”)) 这是因为在我的SendMes

用我的字体

TBButton.ptr(ctypes.UInt64("0x1e677e60")
这相当于此代码行中的
aButton.address()

var rez = SendMessage(hToolbar, 0x417 /** TB_GETBUTTON **/, 1, aButton.address());
运行此代码时,出现错误:

异常:预期的类型为intptr_t,得到了TBButton.ptr(ctypes.UInt64(“0xaa4eb20”))

这是因为在我的
SendMessage
定义中我有:

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
);
因此,我的问题是:
TBButton.ptr(ctypes.UInt64(“0x1e677e60”)
的类型是什么,这样我就可以将
SendMessage
中的
LPARAM
定义更改为这种类型

或者:是否可以将此设置为
intptr\t

类似于
ctypes.intptr\t(aButton.address())
,我试过了,但它不起作用。

它是指向
TBButton
的指针,不管
TBButton
是什么,而
intptr\t
实际上是一个足以容纳指针地址的整数

您需要将指针强制转换为
intptr\t

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

我尝试了这个,但我得到了错误:
var aButton=ctypes.cast(新结构,ctypes.intptr\t);var rez=SendMessage(hToolbar,0x417/**TB\u GETBUTTON**,1,aButton.address());
返回的错误是=
异常:预期的类型是intptr\t,得到了ctypes.intptr\t.ptr(ctypes.UInt64(“0x11d87c00”)
它挂在drwatsn32.exe上:
var aButton=ctypes.cast(new struct_TBButton(),ctypes.intptr__t);var rez=SendMessage(hToolbar,0x417/**TB_GETBUTTON**,1,aButton);
我的代码在这里:(它在winxp上)请帮助我挣扎了很长一段时间:(试过了,它崩溃了/挂在drwatsn32.exe上:(
var aButton=new struct_TBButton();var rez=SendMessage(hToolbar,0x417/**TB_GETBUTTON**/,1,ctypes.cast(aButton.address(),ctypes.intptr_t));
rez在我杀死drwatsn32.exe进程后的值是0,这与问题无关,它是关于如何强制转换某些内容的。您问了“崩溃”在其他情况下已经提问过几次了……你可能应该等待别人回答,而不是在不同的评论部分滥发同样的东西。。。