in reply to Here's the code
in thread How do I create a Win32 'shortcut' (.LNK) file?

Here's my version:
my $Shift = 0x0100; my $Ctrl = 0x0200; my $Alt = 0x0400; my $LINK=new Win32::Shortcut(); $LINK->Set('c:\targetfile', '', # arguements 'c:\', # directory tto execute in 'Perl Shortcut', # description 1, # window state (1 is normal) $Shift+$Ctrl+ord('S'), # shorcut key '', # icon file eg win32.dll 0); # icon number in file my $shortfile = 'C:\WINNT\Profiles\PhilHibbs\Start Menu\Programs\Acces +sories\shortcut.lnk'; $LINK->Save($shortfile); # run Explorer targetting the file just created # system("Explorer /e,/select,$shortfile"); $LINK->Close();
Is there a better way to do constants? I'm more familiar with C and C++ where idioms differ.

Replies are listed 'Best First'.
Re: Re: Here's the code
by Foggy Bottoms (Monk) on Aug 13, 2003 at 12:23 UTC
    Well, the way to declare constants in perl is as follows :
         use constant NAME => value;
    You can store those constants in a separate package file of course !