ShellLink plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Reverted edits by 66.39.3.123 to last version by 81.242.45.88)
 
(15 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|Spaceblue}}
|<small>Author: [[{{ns:2}}:Spaceblue|Spaceblue]] ([[{{ns:3}}:Spaceblue|talk]], [[{{ns:-1}}:Contributions/Spaceblue|contrib]])</small>
 
|}
<br style="clear:both;">
== Links ==
== Links ==
Plugin with C++ Source:
Download v1.2:<br>
<attach>Shelllink.zip</attach><br>


<attach>Shelllink.zip</attach><br>
Download v1.1:<br>
[[Image:Zip.gif]] [http://www.spaceblue.com/downloads/shelllink.zip Shelllink.zip] (22 KB)
<attach>Shelllnk.zip</attach><br>
<!-- Download v1.0 (original):<br>
[[Image:Zip.gif]] [http://www.spaceblue.com/downloads/shelllink.zip Shelllink.zip] (22 KB) -->


== Introduction ==
== Introduction ==
ShellLink is a NSIS plugin that allows you to read shell link (.lnk) files.
ShellLink is a NSIS plugin that allows you to read and change shell link (.lnk) files.


== How to use ==
== How to use ==
Line 16: Line 17:


== DLL Functions ==
== DLL Functions ==
=== Get Shortcut Working Directory ===
<highlight-nsis>
ShellLink::GetShortCutWorkingDirectory link.lnk
Pop $0
$0=C:\Program Files\MyProgram
</highlight-nsis>
=== Get Shortcut Target ===
=== Get Shortcut Target ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutTarget link.lnk Pop $0
ShellLink::GetShortCutTarget link.lnk
</highlight-nsis></div>
Pop $0
 
$0=C:\Program Files\MyProgram\run.exe
</highlight-nsis>


=== Get Shortcut Arguments ===
=== Get Shortcut Arguments ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutArgs link.lnk Pop $0
ShellLink::GetShortCutArgs link.lnk
Pop $0
 
$0=/s /d=1
</highlight-nsis>
 
=== Get Shortcut Icon Location ===
<highlight-nsis>
ShellLink::GetShortCutIconLocation link.lnk
Pop $0
 
$0=C:\Program Files\MyProgram\run.dll
</highlight-nsis>
 
=== Get Shortcut Icon Index ===
<highlight-nsis>
ShellLink::GetShortCutIconIndex link.lnk
Pop $0
 
$0=3
</highlight-nsis>
 
=== Get Shortcut Show Mode ===
<highlight-nsis>
ShellLink::GetShortCutShowMode link.lnk
Pop $0
 
$0=0    (SW_HIDE)
$0=1    (SW_SHOWNORMAL or SW_NORMAL)
$0=2    (SW_SHOWMINIMIZED)
$0=3    (SW_SHOWMAXIMIZED or SW_MAXIMIZE)
$0=4    (SW_SHOWNOACTIVATE)
$0=5    (SW_SHOW)
$0=6    (SW_MINIMIZE)
$0=7    (SW_SHOWMINNOACTIVE)
$0=8    (SW_SHOWNA)
$0=9    (SW_RESTORE)
$0=10  (SW_SHOWDEFAULT)
$0=11  (SW_FORCEMINIMIZE or SW_MAX)
</highlight-nsis>
</highlight-nsis>


=== Get Shortcut Hot Keys ===
=== Get Shortcut Hot Keys ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutHotkey link.lnk Pop $0
ShellLink::GetShortCutHotkey link.lnk
Pop $0
 
$0=634
</highlight-nsis>
 
=== Get Shortcut Description ===
<highlight-nsis>
ShellLink::GetShortCutDescription link.lnk
Pop $0
 
$0=My Shortcut Description
</highlight-nsis>
</highlight-nsis>


=== Get Shortcut Icon Index ===
 
=== Set Shortcut Working Directory ===
<highlight-nsis>
ShellLink::SetShortCutWorkingDirectory link.lnk directory
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Target ===
<highlight-nsis>
ShellLink::SetShortCutTarget link.lnk target.file
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Arguments ===
<highlight-nsis>
ShellLink::SetShortCutArgs link.lnk parameters
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Icon Location ===
<highlight-nsis>
ShellLink::SetShortCutIconLocation link.lnk icon.file
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Icon Index ===
<highlight-nsis>
ShellLink::SetShortCutIconIndex link.lnk icon_index_number
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Show Mode ===
<highlight-nsis>
ShellLink::SetShortCutShowMode link.lnk start_options
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
 
=== Set Shortcut Hot Keys ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutIconIndex link.lnk Pop $0
ShellLink::SetShortCutHotkey link.lnk keyboard_shortcut
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
</highlight-nsis>


=== Get Shortcut Icon Location ===
=== Set Shortcut Description ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutIconLocation link.lnk Pop $0
ShellLink::SetShortCutDescription link.lnk description
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
</highlight-nsis>


=== Get Shortcut Show Mode ===
=== Set Shortcut to Run As Administrator ===
<highlight-nsis>
<highlight-nsis>
ShellLink::GetShortCutShowMode link.lnk Pop $0
ShellLink::SetRunAsAdministrator link.lnk
Pop $0
 
$0=0  -no errors
$0=-1  -error
</highlight-nsis>
</highlight-nsis>


== Version History ==
== Version History ==
*1.1 by Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
**code has been rewritten
**added functions to change shell link information
**reduced dll size 44Kb -> 4Kb
**documentation updated
*1.0
*1.0
**First release of ShellLink.
**First release of ShellLink.
Line 64: Line 198:
it freely, subject to the following restrictions:
it freely, subject to the following restrictions:


1. The origin of this software must not be misrepresented;  
#The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  you must not claim that you wrote the original software.
#Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
  If you use this software in a product, an acknowledgment in the
#This notice may not be removed or altered from any distribution.
  product documentation would be appreciated but is not required.
 
2. Altered versions must be plainly marked as such,
[[Category:Plugins]]
  and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

Latest revision as of 20:25, 15 May 2013

Author: Spaceblue (talk, contrib)


Links

Download v1.2:
Shelllink.zip (24 KB)

Download v1.1:
Shelllnk.zip (11 KB)

Introduction

ShellLink is a NSIS plugin that allows you to read and change shell link (.lnk) files.

How to use

Make sure you have a valid path (link.lnk) to the shell link file.

DLL Functions

Get Shortcut Working Directory

ShellLink::GetShortCutWorkingDirectory link.lnk
Pop $0
 
$0=C:\Program Files\MyProgram

Get Shortcut Target

ShellLink::GetShortCutTarget link.lnk
Pop $0
 
$0=C:\Program Files\MyProgram\run.exe

Get Shortcut Arguments

ShellLink::GetShortCutArgs link.lnk
Pop $0
 
$0=/s /d=1

Get Shortcut Icon Location

ShellLink::GetShortCutIconLocation link.lnk
Pop $0
 
$0=C:\Program Files\MyProgram\run.dll

Get Shortcut Icon Index

ShellLink::GetShortCutIconIndex link.lnk
Pop $0
 
$0=3

Get Shortcut Show Mode

ShellLink::GetShortCutShowMode link.lnk
Pop $0
 
$0=0    (SW_HIDE)
$0=1    (SW_SHOWNORMAL or SW_NORMAL)
$0=2    (SW_SHOWMINIMIZED)
$0=3    (SW_SHOWMAXIMIZED or SW_MAXIMIZE)
$0=4    (SW_SHOWNOACTIVATE)
$0=5    (SW_SHOW)
$0=6    (SW_MINIMIZE)
$0=7    (SW_SHOWMINNOACTIVE)
$0=8    (SW_SHOWNA)
$0=9    (SW_RESTORE)
$0=10   (SW_SHOWDEFAULT)
$0=11   (SW_FORCEMINIMIZE or SW_MAX)

Get Shortcut Hot Keys

ShellLink::GetShortCutHotkey link.lnk
Pop $0
 
$0=634

Get Shortcut Description

ShellLink::GetShortCutDescription link.lnk
Pop $0
 
$0=My Shortcut Description


Set Shortcut Working Directory

ShellLink::SetShortCutWorkingDirectory link.lnk directory
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Target

ShellLink::SetShortCutTarget link.lnk target.file
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Arguments

ShellLink::SetShortCutArgs link.lnk parameters
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Icon Location

ShellLink::SetShortCutIconLocation link.lnk icon.file
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Icon Index

ShellLink::SetShortCutIconIndex link.lnk icon_index_number
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Show Mode

ShellLink::SetShortCutShowMode link.lnk start_options
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Hot Keys

ShellLink::SetShortCutHotkey link.lnk keyboard_shortcut
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut Description

ShellLink::SetShortCutDescription link.lnk description
Pop $0
 
$0=0   -no errors
$0=-1  -error

Set Shortcut to Run As Administrator

ShellLink::SetRunAsAdministrator link.lnk
Pop $0
 
$0=0   -no errors
$0=-1  -error

Version History

  • 1.1 by Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
    • code has been rewritten
    • added functions to change shell link information
    • reduced dll size 44Kb -> 4Kb
    • documentation updated
  • 1.0
    • First release of ShellLink.

Credits

Written and documented by Angelo Mandato

License

© 2004 Angelo Mandato

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any distribution.