Jean-Damien Durand > Win32-Unicode-Shortcut-0.04 > Win32::Unicode::Shortcut

Download:
Win32-Unicode-Shortcut-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

Win32::Unicode::Shortcut - Perl extension for Windows Unicode Shortcut interface

SYNOPSIS ^

  use Win32::Unicode::Shortcut;

  BEGIN { Win32::Unicode::Shortcut->CoInitialize(); }

  my $LINK = new Win32::Unicode::Shortcut;
  $LINK->{'Path'} = "notepad.exe";
  my $target = "C:\\Windows\\Temp\\Target.lnk";
  $LINK->{'Arguments'} = "Euro-sign:" . chr(8364) . ", Chinese character: " . chr(25105);
  $LINK->{'WorkingDirectory'} = "C:\\";
  $LINK->{'Description'} = "Target Description with alef character: \x{05D0}";
  $LINK->{'ShowCmd'} = 1;
  $LINK->{'Hotkey'} = 115;
  $LINK->{'IconLocation'} = "%SystemRoot%\\system32\\SHELL32.dll";
  $LINK->{'IconNumber'} = 10;

  $LINK->Save($target);
  $LINK->Close();

  END { Win32::Unicode::Shortcut->CoUninitialize(); }

DESCRIPTION ^

This is the Unicode version of Win32::Shortcut. This module exposes all methods of Win32::Shortcut, plus the initialisation layer which is application specific. So the whole documentation of Win32::Unicode::Shortcut consists of: the documentation of Win32::Shortcut that the reader should read first, and the Methods section below.

Any bug in Win32::Unicode::Shortcut should be nevertheless send to me via RT of course -;

Methods

Win32::Unicode::Shortcut->CoInitialize([CROAK_ON_FAILURE])

Unless your application has already initialized the COM layer, via Win32::OLE or Win32::API for example, you will have to do so.

Win32::Unicode::Shortcut->CoInitializeEx(COINIT_CONSTANT[, CROAK_ON_FAILURE])

You can have fine-grained granularity on the threading model, using CoInitializeEx. The COINIT_CONSTANT must be of one COINIT_APARTMENTTHREADED, COINIT_MULTITHREADED, COINIT_DISABLE_OLE1DDE or COINIT_SPEED_OVER_MEMORY.

EXPORT

None by default.

NOTES

If the variable $Win32::Unicode::Shortcut::CROAK_ON_ERROR is setted to a true value, then the module will croak at any Windows API call error, with a meaningful message. For example doing a Load without an COM application initialisation will look like the following:

C:\>perl -e "use Win32::Unicode::Shortcut; $Win32::Unicode::Shortcut::CROAK_ON_ERROR = 1; $L = new Win32::Unicode::Shortcut;" CoCreateInstance, CoInitialize has not been called

It is advisable to set this variable before the initialisation, and to reset it after, or to use the optional parameter of the initialisation functions to get it temporarly on during their execution.

None by default.

SEE ALSO ^

Win32::Shortcut Understanding and Using COM Threading Models at http://msdn.microsoft.com/en-us/library/ms809971.aspx Win32::OLE

AUTHOR ^

Jean-Damien Durand, <jeandamiendurand@free.fr>

COPYRIGHT AND LICENSE ^

Copyright (C) 2012 by Jean-Damien Durand

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: