Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: IActiveDesktop::SetWallpaper from Perl?by blm (Hermit) |
on Oct 19, 2002 at 14:16 UTC ( [id://206513]=note: print w/replies, xml ) | Need Help?? |
I can't find the ProgID that matches that CLSID but according to a post by Jan Dubois it is alright to specify a CLSID instead. Win32::OLE determines which it has been passed by the presence of digits. However to my disappointment I found that this does not work: It gives an error
Nothing I tried could make it work. However I may be missing something simple Anyway, I ended up writing a COM object that I knew would be scriptable using perl that just proxy's between perl and the actual IActiveDesktop. If you have Visual Studio it is relatively easy to create. Create an ATL COM project remembering the name (eg damnit). Select Insert ... ATL Object and give it a name MyDesktop(eg MyDesktop). Then add methods to the interface by right clicking on the Interface in Class view and selecting add method. Here is the code for my SetWallpaper method:
I could call this code with the following perl code:
Upon running this perl script my desktop wallpaper changed as expected. Readers please note: I am not a ATL COM guru so use this code at your risk. Thanks Oh Larry please forgive me for posting C++ --blm--
In Section
Seekers of Perl Wisdom
|
|