Application Association Registration plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
== SetVistaDefaultApp Plugin for NSIS (2007-09-30) ==
== AppAssocReg Plugin for NSIS (2008-12-10) ==


This plugin can read / set application association registration for Windows Vista and greater.
This plugin can read / set application association registration for Windows Vista and greater.


Version: 0.3
Version: 0.4 (2008-12-10)
* Added Unicode support (initial patch by Ehsan Akhgari).
* Download includes both the ANSI and Unicode versions of the plug-in.
 
Version: 0.3 addendum (2008-12-09)
* Added Unicode download.
 
Version: 0.3 (2007-10-30)
* Renamed plugin from SetVistaDefaultApp to AppAssocReg.
* Renamed plugin from SetVistaDefaultApp to AppAssocReg.
* Added all IApplicationAssociationRegistration methods available.
* Added all IApplicationAssociationRegistration methods available.
Line 12: Line 19:
Version: 0.1 (2007-09-28)
Version: 0.1 (2007-09-28)
* initial release
* initial release


=== Details On Function Parameters ===
=== Details On Function Parameters ===


==== app_name ====
==== app_name ====
The value for app_name is the name for the application under:
The value for app_name is the name associated with the application under:
   HKLM\Software\RegisteredApplications\
   HKLM\Software\RegisteredApplications\


Line 25: Line 31:
* For type equals file it should be the file extension (e.g. .html, .txt, etc.)
* For type equals file it should be the file extension (e.g. .html, .txt, etc.)
* For type equals startmenu it should be the registry subkey name StartMenuInternet, mail, etc.) under:
* For type equals startmenu it should be the registry subkey name StartMenuInternet, mail, etc.) under:
   HKLM\Software\clients
   HKLM\Software\clients\
* For type equals mime it should be the MIME type name (e.g. audio/mp3, text/html, etc.)
* For type equals mime it should be the MIME type name (e.g. audio/mp3, text/html, etc.)


==== type ====
==== type ====
Possible values for type map to ASSOCIATIONTYPE as follows
Possible values for type map to ASSOCIATIONTYPE as follows
file      = AT_FILEEXTENSION
* file      = AT_FILEEXTENSION
protocol  = AT_URLPROTOCOL
* protocol  = AT_URLPROTOCOL
startMenu = AT_STARTMENUCLIENT
* startMenu = AT_STARTMENUCLIENT
mime      = AT_MIMETYPE
* mime      = AT_MIMETYPE


==== level ====
==== level ====
Possible values for level map to ASSOCIATIONLEVEL as follows
Possible values for level map to ASSOCIATIONLEVEL as follows
machine  = AL_MACHINE
* machine  = AL_MACHINE
effective = AL_EFFECTIVE
* effective = AL_EFFECTIVE
user      = AL_USER
* user      = AL_USER


=== Functions ===
=== Functions ===
Line 46: Line 52:
  Pop $Var
  Pop $Var


Determines the default application for a given association type. This is the default application launched by ShellExecute for that type.
Returns the default application for the specified association type and level (e.g. the application that is launched by default when using ShellExecute for the association).


Returns:
Returns:
Line 56: Line 62:
  Pop $Var
  Pop $Var


Determines whether an application owns the registered default assocation for a given application level and type.
Returns whether an application is the default assocation for the specified association name, type, and level.


Returns:
Returns:
Line 67: Line 73:
  Pop $Var
  Pop $Var


Determines whether an application owns all of the registered default associations for a given application level.
Returns whether an application is the default for all of its associations for the specified level.


Returns:
Returns:
Line 78: Line 84:
  Pop $Var
  Pop $Var


Sets an application as the default for a given type.
Sets an application as the default for the specified association name and type.


Returns:
Returns:
Line 88: Line 94:
  Pop $Var
  Pop $Var


Sets an application as the default for all of the registered associations of any type for that application.
Sets an application as the default for all of the associations it is registered for.


Returns:
Returns:
Line 98: Line 104:
  Pop $Var
  Pop $Var


Removes all per-user associations for the current user. This results in a reversion to machine defaults, if they exist.
Removes all user associations for the current user (e.g. reverts to machine level associations).


Returns:
Returns:
Line 108: Line 114:


See Examples\AppAssocReg\Example.nsi
See Examples\AppAssocReg\Example.nsi


=== Links ===
=== Links ===
* [http://forums.winamp.com/showthread.php?threadid=278027 Forum thread for the plug-in]
* [http://forums.winamp.com/showthread.php?threadid=278027 Forum thread for the plug-in]
* [http://msdn2.microsoft.com/en-us/library/ms647176.aspx IApplicationAssociationRegistration Interface MSDN reference]


=== Download ===


=== Download ===
* Current Release: 2008-12-10
<attach>AppAssocReg-0.4.zip</attach> (dll is approximately 5 KB)
 
=== License ===
&copy; 2007 Robert Strong
 
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:


* Current Release: 2007-09-30
#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.
<attach>AppAssocReg.zip</attach>
#Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
#This notice may not be removed or altered from any distribution.


[[Category:Plugins]]
[[Category:Plugins]]

Latest revision as of 19:38, 10 December 2008

AppAssocReg Plugin for NSIS (2008-12-10)

This plugin can read / set application association registration for Windows Vista and greater.

Version: 0.4 (2008-12-10)

  • Added Unicode support (initial patch by Ehsan Akhgari).
  • Download includes both the ANSI and Unicode versions of the plug-in.

Version: 0.3 addendum (2008-12-09)

  • Added Unicode download.

Version: 0.3 (2007-10-30)

  • Renamed plugin from SetVistaDefaultApp to AppAssocReg.
  • Added all IApplicationAssociationRegistration methods available.

Version: 0.2 (2007-09-28)

  • minor cleanup

Version: 0.1 (2007-09-28)

  • initial release

Details On Function Parameters

app_name

The value for app_name is the name associated with the application under:

 HKLM\Software\RegisteredApplications\

assoc_name

The value for assoc_name can be one of the following:

  • For type equals protocol it should be the protocol name (e.g. http, mms, etc.).
  • For type equals file it should be the file extension (e.g. .html, .txt, etc.)
  • For type equals startmenu it should be the registry subkey name StartMenuInternet, mail, etc.) under:
 HKLM\Software\clients\
  • For type equals mime it should be the MIME type name (e.g. audio/mp3, text/html, etc.)

type

Possible values for type map to ASSOCIATIONTYPE as follows

  • file = AT_FILEEXTENSION
  • protocol = AT_URLPROTOCOL
  • startMenu = AT_STARTMENUCLIENT
  • mime = AT_MIMETYPE

level

Possible values for level map to ASSOCIATIONLEVEL as follows

  • machine = AL_MACHINE
  • effective = AL_EFFECTIVE
  • user = AL_USER

Functions

AppAssocReg::QueryCurrentDefault assoc_name type level
Pop $Var

Returns the default application for the specified association type and level (e.g. the application that is launched by default when using ShellExecute for the association).

Returns:

  • 'ProgID' that identifies the current default association.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.
AppAssocReg::QueryAppIsDefault app_name assoc_name type level
Pop $Var

Returns whether an application is the default assocation for the specified association name, type, and level.

Returns:

  • '1' if the application is the default.
  • '0' if the application is NOT the default.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.
AppAssocReg::QueryAppIsDefaultAll app_name level
Pop $Var

Returns whether an application is the default for all of its associations for the specified level.

Returns:

  • '1' if the application is the default.
  • '0' if the application is NOT the default.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.
AppAssocReg::SetAppAsDefault app_name assoc_name type
Pop $Var

Sets an application as the default for the specified association name and type.

Returns:

  • 'success' if the call was successful.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.
AppAssocReg::SetAppAsDefaultAll app_name
Pop $Var

Sets an application as the default for all of the associations it is registered for.

Returns:

  • 'success' if the call was successful.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.
AppAssocReg::ClearUserAssociations
Pop $Var

Removes all user associations for the current user (e.g. reverts to machine level associations).

Returns:

  • 'success' if the call was successful.
  • 'method failed' if the call failed.
  • 'method not available' if IApplicationAssociationRegistration is not available on the system.

Example

See Examples\AppAssocReg\Example.nsi

Links

Download

  • Current Release: 2008-12-10

AppAssocReg-0.4.zip (12 KB) (dll is approximately 5 KB)

License

© 2007 Robert Strong

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.