Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:pluginloadtime [2015/09/14] (current)
Line 1: Line 1:
 +====== Loading Plug-ins at Startup ======
 +> **Developer:​** //​[[developer:​cplusplusplugins|C++]]//​
 +> **Summary:​** //Discusses how to configure plug-ins to load at startup.//
 +
 +=====Question=====
 +How to I set my plug-in to load at startup?
 +
 +=====Answer=====
 +Rhino will load plug-ins in two ways.
 +
 +  - When Needed (Default). Plug-in will not be loaded when Rhino starts. ​ Plug-in will be loaded when a plug-in defined command is run, when a user selects a plug-in defined file import/​export type, or if a 3DM file has user data that was created by your plug-in.
 +  - At Startup. Plug-in is loaded when Rhino is loaded and initialized.
 +
 +To set your plug-in to load on startup, you need to override your plug-in object'​s **PlugInLoadTime** virtual function and return the **load_plugin_at_startup** enumerated value.
 +
 +=====Examples=====
 +
 +===== C++ =====
 +<code c++>
 +
 +CRhinoPlugIn::​plugin_load_time PlugInLoadTime()
 +{
 +  return CRhinoPlugIn::​load_plugin_at_startup;​
 +}
 +
 +</​code>​
 +===== C# =====
 +<code c#>
 +
 +public override IRhinoPlugIn.plugin_load_time PlugInLoadTime()
 +{
 +  return IRhinoPlugIn.plugin_load_time.load_plugin_at_startup;​
 +}
 +
 +</​code>​
 +===== VB.NET =====
 +<code vb>
 +Public Overrides Function PlugInLoadTime() As RMA.Rhino.IRhinoPlugIn.plugin_load_time
 +  return IRhinoPlugIn.plugin_load_time.load_plugin_at_startup;​
 +End Function
 +
 +</​code>​
 +=====More Information=====
 +
 +If you have already loaded your plug-in using Rhino'​s plug-in manager, when debugging for example, then you will need to either remove your plug-in'​s registry key, which can be found here:
 +
 +<code c++>
 +HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<​rhino_build_date>​\Plug-Ins\<​your_plugin_guid>​
 +</​code>​
 +
 +>Note, if you are running on a system with limited rights, with user-account control enabled for example, then there will be a corresponding key in HKEY_CURRENT_USER.
 +
 +Or, you can just modify your plug-in'​s "​LoadMode"​ registry key value. The available values for this key are as follows:
 +
 +|**Load mode**|**Registry Value**|**Description**|
 +|load_plugin_when_needed|2 - REG_DWORD, Decimal|Default. Load the first time a plug-in command used|
 +|load_plugin_at_startup|1 -  REG_DWORD, Decimal|Load when Rhino is loaded|\\
 +
 +The reason this step is required is that the "​LoadMode"​ Registry key value is only written the first time the plug-in is loaded (when it is initially installed or registered). This will not be an issue for customers of your plug-in for the correct registry key value will be written the first time they load your plug-in.
 +
 +\\
 +
 +{{tag>​Developer cplusplus}}
  
developer/sdksamples/pluginloadtime.txt ยท Last modified: 2015/09/14 (external edit)