如何使用JNA sendMessage从记事本中获取文本

时间:2013-03-28 13:48:06

标签: jna

如何使用JNA从记事本中获取文本?

我尝试了以下代码:

    public final int WM_GETTEXT = 0x00D;
    public final int WM_GETTEXTLENGTH = 0x00A;
    ...

    byte[] windowText = new byte[512];
    WinDef.LRESULT res = User32.INSTANCE.SendMessage(hwnd, User32.WM_GETTEXTLENGTH, 0, 0);
    User32.INSTANCE.SendMessage(hwnd, User32.WM_GETTEXT, res.intValue() + 1, windowText);

    Native.toString(windowText);

但Native.toString(windowText)返回“0”

0 个答案:

没有答案