ShObjIdl location for JNA usage

82 views
Skip to first unread message

Matteo Migliarini

unread,
Jan 2, 2022, 6:19:55 AM1/2/22
to Java Native Access

I'm trying to use shobjidl_core.h library to run code that changes the wallpaper of one specific monitor, specifically I need to run these two functions: GetMonitorDevicePathAtSetWallpaper.

Now, when I run the following code:

interface shobjidl_core extends Library {
test.shobjidl_core INSTANCE = Native.load( "ShObjIdl.idl", shobjidl_core.class);

void GetMonitorDevicePathAt(int monitorIndex, WString m);
void SetWallpaper(WString monitorId, WString wallpaperPath);
}

I've tried any variation of "shobjidl" but still I can't find one that works. From what I understood about JNA it needs a dll containing the library, but I can't find any dll related to shobjidl

What should I do to load shobjidl?

Matthias Bläsing

unread,
Jan 2, 2022, 12:00:08 PM1/2/22
to jna-...@googlegroups.com
Hi Matteo,
You are looking for the COM bindings of IDesktopWallpaper. This is not
a classic library you are loading.

Please have a look here:

https://github.com/matthiasblaesing/JNA-Demos

In the project IDesktopWallpaper I added a minimal sample, that
demonstrates how the library can be loaded and used.

HTH

Matthias

Matteo Migliarini

unread,
Jan 2, 2022, 2:23:18 PM1/2/22
to Java Native Access
Thanks a lot!! Now it works! Can I use your code in my project as long as it is under MIT license right? 

Matthias Bläsing

unread,
Jan 2, 2022, 2:53:16 PM1/2/22
to jna-...@googlegroups.com
Hi,

Am Sonntag, dem 02.01.2022 um 11:23 -0800 schrieb Matteo Migliarini:
> Thanks a lot!! Now it works! Can I use your code in my project as
> long as it is under MIT license right? 

yes, that is ok.

Greetings

Matthias

Reply all
Reply to author
Forward
0 new messages