Re: [rt.cpan.org #53484] win32-ole breaks win32-gui-hyperlink on win64

[email protected] ("Bill Luebkert via RT")
Newsgroups perl.libwin32
Message-ID <[email protected]>
Fri Jan 08 19:27:09 2010: Request 53484 was acted upon.
Transaction: Correspondence added by [email protected]
       Queue: Win32-OLE
     Subject: Re: [rt.cpan.org #53484] win32-ole breaks win32-gui-hyperlink on win64
   Broken in: 0.1709
    Severity: Unimportant
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53484 >


Paul Boldra via RT wrote:
> Thu Jan 07 11:27:19 2010: Request 53484 was acted upon.
> Transaction: Ticket created by BOLDRA
>        Queue: Win32-OLE
>      Subject: win32-ole breaks win32-gui-hyperlink on win64
>    Broken in: 0.1709
>     Severity: Unimportant
>        Owner: Nobody
>   Requestors: [email protected]
>       Status: new
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53484 >
> 
> 
> Using 32 bit strawberry 5.10.0 on 64 bit windows the following code doesn't
> work:
> 
> use Win32::GUI;
> use Win32::GUI::HyperLink;
> use Win32::OLE;
> my $win=Win32::GUI::Window->new( -size=>[200,200] );
> my $hl = $win->AddHyperLink(
> -text=>q{http://google.com}
> ,-pos=>[10,10]);
> 
> Win32::OLE->GetObject(q{./root/CIMV2/Win32_PhysicalMemory});
> $hl->Launch;
 >
> This dies with the message "Failed opening http://google.com ShellExecute(5)
> The requested lookup key was not found in any active activation context".
> Without the Win32::OLE->GetObject call, the Hyperlink->Launch call works.

Interesting that if you swap the last two lines (do the launch first),
it works on 5.8.8 B820.  Sorry I don't have 5.10 to try.

> I'm not having this problem with 32 bit strawberry or cygwin perl (both 5.10.0)
> on 32 bit windows.

use strict;
use warnings;
use Win32::GUI;
use Win32::GUI::HyperLink;
use Win32::OLE;

my $win = Win32::GUI::Window->new(-size => [200,200]);
# $win->Show();	# added to see GUI
my $hl = $win->AddHyperLink(-text => q{http://google.com/}, -pos => [10,10]);
$hl->Launch;	# moved up a line

# modified and added some code just for some output

my $objs = Win32::OLE->GetObject(q{WinMgmts://./root/cimv2}) or
   die "GetObject: " . Win32::OLE->LastError();

use Win32::OLE qw(in);
my $class = 'Win32_PhysicalMemory';
foreach my $item (in $objs->InstancesOf($class)) {
	foreach (sort (map { $_->{Name} } in $item->{Properties_})) {
		print "$_: ",
		  defined $item->{$_} ? $item->{$_} : '<undef>', "\n";
	}
	print "\n";
}

__END__
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.