How did everything start?
I thought myself it would be nice to create a XMas Slideshow in Java as I'm still learning from O'Rielley 2nd Java SE 2nd edition and didn't understand very well how to use interfaces(not GUI thing...for polymorphism).
Well, I found out the only way I can interact with window's desktop is via an Windows API and that I need to gain access to windows shared libraries...and the only way is Jna...if I want to use 100% Java code...
I found out there is a function called SystemParametersInfo that I should use in order to change desktop wallpaper from my java program.
Well...at first I created my class and an interface. This interface extends StdCallLibrary(which I don't know what's for..maybe for calling back C++ library function SystemParametersInfo but not sure).
This is my code and works well
But there are many thing I don't understand:
1) Why is the system returning Object ...I mean...why I can't just say
and I must cast?
2) Why is the mapping mandatory? What does mapping do...what's for?
If I get rid of mapping part and use the 2 args loadLibrary signature method I get this error :
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'SystemParametersInfo': The specified procedure could not be found.
at com.sun.proxy.$Proxy0.SystemParametersInfo(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...Why on hell?? Why is this mapping so important?