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: GetMonitorDevicePathAt, SetWallpaper.
Now, when I run the following code:
interface shobjidl_core extends Library {
test.shobjidl_core INSTANCE = Native.load( "shobjidl_core", shobjidl_core.class);
void GetMonitorDevicePathAt(int monitorIndex, WString m);
void SetWallpaper(WString monitorId, WString wallpaperPath);
}
I get an error saying "Unable to load library 'shobjidl'"
I've tried any variation of "shobjidl" but still I can't find one that works. From what I understood about JNA it need a dll containing the library, but I can't find any dll related to shobjidl
What should I do to load shobjidl?
CodePudding user response:
shobjidl is a C/C header file, it is not a library shipped with Windows. The functions declared in those headers often end up in shell32.dll or shcore.dll but in this case you are actually talking about IDesktopWallpaper
and this is a COM object.
Use JNA or JNI or whatever method of COM interaction you prefer.
A minimal C example can be found here.
CodePudding user response:
I was helped on the JNA google group. The answer that solved my issue can be seen here. If you want to see a use case example on how to do this you can check it on github