<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Win32::Shortcut;
#######################################################################
#
# Win32::Shortcut - Perl Module for Shell Link Interface
# ^^^^^^^^^^^^^^^
# This module creates an object oriented interface to the Win32
# Shell Links (IShellLink interface).
#
# Version: 0.03 (07 Apr 1997)
#
#######################################################################

require Exporter;       # to export the constants to the main:: space
require DynaLoader;     # to dynuhlode the module.

@ISA= qw( Exporter DynaLoader );
@EXPORT = qw(
    SW_SHOWMAXIMIZED
    SW_SHOWMINNOACTIVE
    SW_SHOWNORMAL
);


#######################################################################
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function.  If a constant is not found then control is passed
# to the AUTOLOAD in AutoLoader.
#

sub AUTOLOAD {
    my($constname);
    ($constname = $AUTOLOAD) =~ s/.*:://;
    #reset $! to zero to reset any current errors.
    local $! = 0;
    my $val = constant($constname, @_ ? $_[0] : 0);
    if ($! != 0) {

    # [dada] This results in an ugly Autoloader error

    #if ($! =~ /Invalid/) {
    #    $AutoLoader::AUTOLOAD = $AUTOLOAD;
    #    goto &amp;AutoLoader::AUTOLOAD;
    #} else {
    
    # [dada] ... I prefer this one :)

        ($pack, $file, $line) = caller;
        undef $pack; # [dada] and get rid of "used only once" warning...
        die "Win32::Shortcut::$constname is not defined, used at $file line $line.";

    #}
    }
    eval "sub $AUTOLOAD { $val }";
    goto &amp;$AUTOLOAD;
}


#######################################################################
# STATIC OBJECT PROPERTIES
#
$VERSION = "0.03";

#######################################################################
# PUBLIC METHODS
#

#======== ### CLASS CONSTRUCTOR
sub new {
#========
    my($class, $file) = @_;
    my $self = {}; 
    my $ilink = 0; 
    my $ifile = 0;

    ($ilink, $ifile) = _Instance();

    if($ilink and $ifile) {
        $self-&gt;{'ilink'} = $ilink;
        $self-&gt;{'ifile'} = $ifile;
        bless $self;
        # Initialize properties
        $self-&gt;{'File'}             = "";
        $self-&gt;{'Path'}             = "";
        $self-&gt;{'Arguments'}        = "";
        $self-&gt;{'WorkingDirectory'} = "";
        $self-&gt;{'Description'}      = "";
        $self-&gt;{'ShowCmd'}          = 0;
        $self-&gt;{'Hotkey'}           = 0;
        $self-&gt;{'IconLocation'}     = "";
        $self-&gt;{'IconNumber'}       = 0;

        $self-&gt;Load($file) if $file;
        
    } else {
        return undef;
    }
    $self;
}  

#=========
sub Load {
#=========
    my($self, $file) = @_;
    return undef unless ref($self);
  
    my $result = _Load($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $file);

    if(defined($result)) {
  
        # fill the properties of $self
        $self-&gt;{'File'} = $file;
        $self-&gt;{'Path'} = _GetPath($self-&gt;{'ilink'}, $self-&gt;{'ifile'},0);
        $self-&gt;{'ShortPath'} = _GetPath($self-&gt;{'ilink'}, $self-&gt;{'ifile'},1);
        $self-&gt;{'Arguments'} = _GetArguments($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
        $self-&gt;{'WorkingDirectory'} = _GetWorkingDirectory($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
        $self-&gt;{'Description'} = _GetDescription($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
        $self-&gt;{'ShowCmd'} = _GetShowCmd($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
        $self-&gt;{'Hotkey'} = _GetHotkey($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
        ($self-&gt;{'IconLocation'},
         $self-&gt;{'IconNumber'}) = _GetIconLocation($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
    }
    return $result;
}


#========
sub Set {
#========
    my($self, $path, $arguments, $dir, $description, $show, $hotkey, 
       $iconlocation, $iconnumber) = @_;
    return undef unless ref($self);

    $self-&gt;{'Path'}             = $path;
    $self-&gt;{'Arguments'}        = $arguments;
    $self-&gt;{'WorkingDirectory'} = $dir;
    $self-&gt;{'Description'}      = $description;
    $self-&gt;{'ShowCmd'}          = $show;
    $self-&gt;{'Hotkey'}           = $hotkey;
    $self-&gt;{'IconLocation'}     = $iconlocation;
    $self-&gt;{'IconNumber'}       = $iconnumber;
    return 1;
}


#=========
sub Save {
#=========
    my($self, $file) = @_;
    return undef unless ref($self);

    return undef if not $file and not $self-&gt;{'File'};
    $file = $self-&gt;{'File'} if not $file;

    _SetPath($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'Path'});
    _SetArguments($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'Arguments'});
    _SetWorkingDirectory($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'WorkingDirectory'});
    _SetDescription($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'Description'});
    _SetShowCmd($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'ShowCmd'});
    _SetHotkey($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $self-&gt;{'Hotkey'});
    _SetIconLocation($self-&gt;{'ilink'}, $self-&gt;{'ifile'},
                     $self-&gt;{'IconLocation'}, $self-&gt;{'IconNumber'});

    my $result = _Save($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $file);
    return $result;
}

#============
sub Resolve {
#============
    my($self, $flags) = @_;
    return undef unless ref($self);
    $flags = 1 unless defined($flags);
    my $result = _Resolve($self-&gt;{'ilink'}, $self-&gt;{'ifile'}, $flags);
    return $result;
}


#==========
sub Close {
#==========
    my($self) = @_;
    return undef unless ref($self);

    my $result = _Release($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
    $self-&gt;{'released'} = 1;
    return $result;
}

#=========
sub Path {
#=========
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'Path'};
    } else {
        $self-&gt;{'Path'} = $value;
    }
    return $self-&gt;{'Path'};
}

#==============
sub ShortPath {
#==============
    my($self) = @_;
    return undef unless ref($self);
    return $self-&gt;{'ShortPath'};
}

#==============
sub Arguments {
#==============
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'Arguments'};
    } else {
        $self-&gt;{'Arguments'} = $value;
    }
    return $self-&gt;{'Arguments'};
}

#=====================
sub WorkingDirectory {
#=====================
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'WorkingDirectory'};
    } else {
        $self-&gt;{'WorkingDirectory'} = $value;
    }
    return $self-&gt;{'WorkingDirectory'};
}


#================
sub Description {
#================
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'Description'};
    } else {
        $self-&gt;{'Description'} = $value;
    }
    return $self-&gt;{'Description'};
}

#============
sub ShowCmd {
#============
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'ShowCmd'};
    } else {
        $self-&gt;{'ShowCmd'} = $value;
    }
    return $self-&gt;{'ShowCmd'};
}

#===========
sub Hotkey {
#===========
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'Hotkey'};
    } else {
        $self-&gt;{'Hotkey'} = $value;
    }
    return $self-&gt;{'Hotkey'};
}

#=================
sub IconLocation {
#=================
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'IconLocation'};
    } else {
        $self-&gt;{'IconLocation'} = $value;
    }
    return $self-&gt;{'IconLocation'};
}

#===============
sub IconNumber {
#===============
    my($self, $value) = @_;
    return undef unless ref($self);

    if(not defined($value)) {
        return $self-&gt;{'IconNumber'};
    } else {
        $self-&gt;{'IconNumber'} = $value;
    }
    return $self-&gt;{'IconNumber'};
}

#============
sub Version {
#============
    # [dada] to get rid of the "used only once" warning...
    return $VERSION;
}


#######################################################################
# PRIVATE METHODS
#

#============ ### CLASS DESTRUCTOR
sub DESTROY {
#============
    my($self) = @_;

    if(not $self-&gt;{'released'}) {
        _Release($self-&gt;{'ilink'}, $self-&gt;{'ifile'});
    }
}

#======== ### PACKAGE DESTRUCTOR
sub END { 
#========
    # print "Exiting...\n";
    _Exit(); 
}

#######################################################################
# dynamically load in the Shortcut.pll module.
#

bootstrap Win32::Shortcut;

# Preloaded methods go here.

#Currently Autoloading is not implemented in Perl for win32
# Autoload methods go after __END__, and are processed by the autosplit program.

1;
__END__

</pre></body></html>