BridJ - ITaskbarList3 StructObjects

24 views
Skip to first unread message

Joao Rasteiro

unread,
Feb 2, 2016, 7:50:08 PM2/2/16
to NativeLibs4Java
Hi,

I'm trying to add Taskbar Buttons to my application.
I've just recently found BridJ because of this, since it seems to support ITaskBarList3 out of the box which is perfect.

I (think I) have successfully managed to register the required classes and it shows so in the logs:

INFO: Registering type org.bridj.cpp.com.shell.ITaskbarList3
INFO: Registering type org.bridj.cpp.com.shell.ITaskbarList3$THUMBBUTTON

Among other similar prints.

However, whenever I try to set any of THUMBBUTTON's fields I get an UnsatisfiedLinkError.
It seems that either I'm not properly creating the Struct and "attaching" it to its native counterpart or I'm simply doing something wrong.
I was unable to find a tutorial using StructObjects and the ITaskbarDemo only uses progress bar updates which don't use any of these Structs.

Here's part of the code in question:

public void init(JFrame window) {
    ITaskbarList3 buttonList = COMRuntime.newInstance(ITaskbarList3.class);
    Pointer<THUMBBUTTON> buttons = Pointer.allocateArray(THUMBBUTTON.class, 1); //Eventually I'll add more than 1 button
    long handler = JAWTUtils.getNativePeerHandle(window);
    Pointer<?> hwnd = Pointer.pointerToAddress(handler);

    THUMBBUTTON btn = buttons.get(0);
    btn.iId(0); //From here on, any call will throw UnsatisfiedLinkError
    btn.dwMask(THUMBBUTTONMASK.THB_BITMAP);    
    btn.iBitmap(0);
    btn.dwFlags(THUMBBUTTONFLAGS.THBF_ENABLED);
       
    buttonList.ThumbBarAddButtons((Pointer) hwnd, 1, buttons);
}


Any help on how to init/set these Structs properly would be great!

Thanks in advance!
Reply all
Reply to author
Forward
0 new messages