zoukankan      html  css  js  c++  java
  • MMC Snap In应用程序开发

     

    MMC Snap In Development Starting Guide

    目录

    MMC Technology Summary

    Keywords

    MMC Programming Elements

    In this topic

    How to test the MMC program

    MMC Basic Class

    MMC Sample Code

    抱歉:由于本人的英文能力有限和关于MMC开发的中文资料也有限,所有本文可能会出现

    很多英文文章,请阅者多多谅解。

    MMC Technology Summary

    MMC is a Multiple Document Interface(MDI) shell user interface(UI) for the integration of modularized administration tools that are implemented as snap-ins. This means that it is possible to have multiple windows, all attached to the same management console. It is a tool that hosts snap-in programs that provide the actual functionality. Snap-in programs are designed to perform a specific type of application or object. A snap-in can be loaded as needed into an MMC Console to create a customized management environment. The combined set of snap-in specified in the console can be saved as an .MSC file, which can be considered an MMC tool, is also referred to as an MMC console. With the capability to Add/Remove snap-ins, it is possible to create specific consoles that match the skill level and job description of the administrator who is intended to operate the console. The .MSC file makes the console portable. Each sap-in operate within the MMC console structure, which consists of three panes. The managed entities map to a hierarchy of nodes that is displayed as a tree in the tree pane. The scope of a snap-in may include network resources, as well as objects, views, and actions.

    Keywords

    MMC(Microsoft Management Console), action, property pages, snap-in, tree pane ,results pane, actions pane, scope node, view, view description.

    MMC Programming Elements

    It is useful to be familiar with programming elements offered by MMC before you undertake the task of designing a snap-in. The purpose of the MMC3.0 SDK is to design snap-in. The snap-in contains the actual workings of a management task. It is designed to run within the context of the MMC. The MMC3.0 SDK facilitates the design of a snap-in to encapsulate either a specific management task or a set of operations. It allows the snap-in development to focus on the objects to be managed and the methods used to manage the objects. A snap-in can either be a stand-alone snap-in, thereby providing independent programmatic functionality, or it can be extension snap-in that extends the operations of a specific snap-in, and is dependent on the parent snap-in to operate.

    The following are useful decision steps to consider before starting:

    1.       Identify the management space and determine what type of snap-in best suits your needs.

    2.       Layout the namespace, and decide what objects or containers belong in it.

    3.       Design the UI to present information about a managed objects.

    4.       Define the management tasks for each object in the namespace

    5.       Start writing the snap-in code using the MMC3.0 Managed code framework.

    In this topic

    Topic

    Description

    Snap-in

    The Snap-In class provides the abstraction for the core binding of a snap-in dynamic-link library (DLL) and provides the initial instantiation point of the snap-in code.

    Use of Attributes Programming Model

    MMC uses attributes to store essential metadata.

    Scope Node

    The Scope Node class provides the basic icon and name for a node in the tree pane.

    Result Node

    Unlike scope nodes, result nodes cannot have children. They are used solely to populate an instance of MmcListView.

    Actions

    Custom Actions will show in the context menu and in the actions pane.

    Standard Verbs

    Standard verbs can be set for both scope nodes and the selected items in a view to handle the most common actions such as a Refresh.

    Views and View Descriptions

    Using Selection Data

    Utility Programs

    Property Sheets and Pages

    Wizards

    Dialogs

    Localization

    Threading

    Checklist for Snap-in Design and Development

    至于其他的就不再进行详细的描述,要想深刻理解,请连接下面的网址:

    http://msdn.microsoft.com/hi-in/library/ms692747(en-us,VS.85).aspx

    http://msdn.microsoft.com/hi-in/library/ms692752(en-us,VS.85).aspx

    How to test the MMC program

    To test your snap-in, run MMC 3.0 (mmc.exe) and use the Add/Remove Snap-In menu option to add your snap-in from the installed snap-ins list. Note that when MMC has loaded your snap-in, the .dll is in use, and cannot be re-compiled until you either remove it from the console, or close MMC.

    If you wish to set breakpoints or walk through your code, you can instruct Visual Studio to run MMC for you, giving you access to your managed snap-in code. Under the ‘Debug’ settings in the project properties, select the ‘Start external program’ radio button and enter the full path to mmc.exe. When the snap-in runs, you will be able to debug it.

    1.       首先应该先将你写好的snap-in程序进行编译,即Build一下,此时你的应用程序Bin"Bug目录先就会生成关于你这个应用程序的.dll文件。

    2.       然后,如果你的机器上还没有安装.NET Framework的话,请安装;如果安装,请按照这个目录C:"Windows"Microsoft.NET"Framework"v2.0.50727"Installutil.exe文件拷贝到你应用程序的Bin"Debug目录下,例如:E:"MMC"InitializationWizardSnapIn.cs"InitializationWizardSnapIn.cs"bin"Debug

    3.       请以管理员身份运行【命令提示符】,进入你应用程序Bin"Debug目录下,然后执行命令:

    Installutil -i  xxx.dll.具体如下图所示:


    4.      
    安装成功之后,然后执行mmc.exe命令,打开控制台程序

      

    5.       点击【文件】——【添加/删除管理单元】

    6.       将你刚刚生成的snap-in程序添加进去,如:

    7.       保存此控制台,保存路径,最好是保存在你应用程序的Bin"Debug目录下,然后进行如下设置:

    8.       然后就可以加断点,运行你的MMC应用程序了。

    MMC Basic Class

    Class

    Description

    FormView

    Provides a standard MMC WinForm view. It allows the results pane to be populated with a WinForm control. All classes that are derived from this type must have a public default constructor defined.

    MmcListView

    Provides a standard MMC view that allows the results pane to be populated with a list of items. All classes that are derived from this type must have a public default constructor defined.

    Node

    Provides the abstract base class for all MMC-related node types. It encapsulates common functionality such as associated display text, node type qualification, and a mechanism to expose the actions that are associated with the node

    ScopeNode

    Represents an item that is added by a snap-in to a list view.

    SelectionData

    This is a sealed class that contains data about selected items in a view.

    SnapIn

    Provides the main entry point for the creation of a snap-in. In the managed framework in MMC, a minimal amount of code that uses this class is required to build a simple snap-in that has core functionality. The NamespaceSnapInBase class from which the SnapIn class is derived, provides an implementation of functionality that is common to both standalone and extension snap-ins.

    重点要掌握这些类的方法,属性和接口。

    更为详细的介绍,请链接以下网址:

    http://msdn.microsoft.com/hi-in/library/microsoft.managementconsole(en-us,VS.85).aspx

    MMC Sample Code

    具体的代码请参考以下链接:

    http://msdn.microsoft.com/hi-in/library/ms692755(en-us,VS.85).aspx

    http://www.gigyonline.com/code/source/mmc/mmchelloworld.html

    http://community.bartdesmet.net/blogs/bart/archive/2006/09/01/4384.aspx

    请大家认真模仿例子学习,希望在最短的时间内能掌握MMC的开发流程和技术。

  • 相关阅读:
    javascript线性渐变2
    javascript无缝滚动2
    javascript Object对象
    javascript无缝滚动
    javascript图片轮换2
    javascript图片轮换
    用C/C++写CGI程序
    linux shell 的 for 循环
    重磅分享:微软等数据结构+算法面试100题全部答案完整亮相
    查看linux服务器硬盘IO读写负载
  • 原文地址:https://www.cnblogs.com/limingyang/p/1531248.html
Copyright © 2011-2022 走看看