Game Development Reference
In-Depth Information
Sample Usage—Standalone
Using the framework is very easy, and most of the implementation details for the
extension have already been covered. The most notable parts to mention are the
RegisterServer() and UnregisterServer() methods. You will notice the
ComUnregisterFunctionAttribute and ComRegisterFunctionAttribute decorations on
both methods. These attributes specify the methods to call when registering or
unregistering an assembly from COM; this allows for the execution of custom
code during component registration. More on component registration later in this
chapter, but just be aware that these methods are entry points from COM, and
they simply call the RegisterExtension() and UnregisterExtension() methods in
ShellExtensionBase .
[Guid(“45A92DA6-3559-4d20-88F7-552E10779D5A”), ComVisible(true)]
public class StandAloneExtension : ShellExtensionBase
{
protected static string[] _extensions = new string[2] { “.nxe”, “.nxw” };
protected static string _handlerName = “SimpleToolStandAlone”;
protected override string MenuTitle
{
get { return “SimpleTool - Stand Alone”; }
}
protected override string[] Extensions
{
get { return _extensions; }
}
protected override void CommandRegistration(string[] fileNames)
{
RegisterCommand(“Do Something”);
RegisterCommand(“Do Something Else”);
RegisterCommand(“-”);
RegisterCommand(“View Stuff”);
RegisterCommand(“-”);
RegisterCommand(“Simple Command 1”);
RegisterCommand(“Simple Command 2”);
}
protected override void HandleCommand(string command, string[] files)
{
Search Nedrilad ::




Custom Search