Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: IActiveDesktop::SetWallpaper from Perl?

by Mr. Muskrat (Canon)
on Oct 19, 2002 at 15:16 UTC ( [id://206521]=note: print w/replies, xml ) Need Help??


in reply to IActiveDesktop::SetWallpaper from Perl?

#!/usr/bin/perl use strict; use warnings; use Win32::API; use constant CLSID_ACTIVEDESKTOP => '{75048700-EF1F-11D0-9888-006097 +DEACF9}'; my $coci = Win32::API->new('ole32','CoCreateInstance', [qw(I P I I P)] +, 'I') or die "Could not create CoCreateInstance object"; my $setwall; my $res = $coci->Call(CLSID_ACTIVEDESKTOP, undef, 0, 0, \$setwall); print "Got: $res\n";

Errors returned:

Argument "{75048700-EF1F-11D0-9888-006097DEACF9}" isn't numeric in sub +routine entry at noname.pl line 11. Use of uninitialized value in subroutine entry at noname.pl line 11.
And it outputs:
Got: -2147024809

 

Update: Fixed the die message in my code

Edit by tye to change PRE to CODE tags around long lines

Replies are listed 'Best First'.
Re: Re: IActiveDesktop::SetWallpaper from Perl?
by blm (Hermit) on Oct 20, 2002 at 01:37 UTC

    IMHO you are getting that error message because the first parameter of

    STDAPI CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID * ppv );
    is a struct not a string
    typedef struct _GUID { // size is 16 DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID;

    defined on my machine in WINNT.H

    --blm--

      Thanks. I don't play with the system calls too often. I was using the code that bbfu provided. I didn't know if it was correct or not. Perhaps I'll have time to play with this more later in the week. It's becoming quite fun.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://206521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2025-07-13 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.