WINDOWS 1002000 PROFESSIONAL RESOURCE KIT [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

WINDOWS 1002000 PROFESSIONAL RESOURCE KIT [Electronic resources] - نسخه متنی

Chris Aschauer

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Integrating the System Monitor Control into Office and Other Applications


You can host the System Monitor ActiveX control in applications of the Microsoft Office 97 suite or later and in HTML pages. The following sections describe how to integrate and use these controls, including the following:


    Placing the Control in an Office Document or on a Web Page

    Formatting the Control in a Document


Placing the Control in an Office Document or on a Web Page


Integration of the Microsoft Office applications with Visual Basic for Applications makes the process of adding the System Monitor control almost identical across these applications. The following procedures describe how to insert the control in applications such as Microsoft Word, Microsoft Excel, and Microsoft® PowerPoint®. For purposes of this section, the word "document" is used to refer to PowerPoint slides, Word documents, or Excel spreadsheets.


    Default key settings in Microsoft Word might conflict with the CTRL+H combination used for System Monitor highlighting. You might need to change these to support highlighting when the System Monitor control (Sysmon.ocx in the systemrootSystem32 folder) is used in Microsoft Word.


In addition, you can add the control to a Web page using an HTML editor that supports insertion of ActiveX controls or using a text editor as described in the procedure "To insert the control in an HTML Page" later in the chapter.

To insert the System Monitor control in a Microsoft Office application


    Start the application and select Toolbars under the View menu.

    Under Toolbars, select Control Toolbox.

    With the Control Toolbox displayed, click the More Controls icon, and then select the System Monitor Control.

    Figure 27.17 shows the System Monitor control selected in the Control Toolbox.


    Figure 27.17 System Monitor Control in the Control Toolbox

    Place the control on the page according to the requirements of the application. See the following differences among applications:


      In a Microsoft Word document, select the insertion point (where the I-beam is flashing) before selecting the control. The control will appear at the position you selected. Design mode is active and you need to exit Design mode before setting control properties or adding counters. Click the Design Mode icon to exit.

      In a Microsoft Excel spreadsheet, select the control and then select the insertion point. When the crosshair appears, note that you can create a placeholder for the control by holding down the left mouse button and dragging the mouse pointer across the columns and rows that you want the control to occupy. Releasing the mouse button causes the control to appear in the space you selected.

      If you do not create a placeholder, you can click any location on the spreadsheet and the control will be inserted in the location with a default size. Design mode is active and you need to exit Design mode before setting control properties or adding counters. Click the Design Mode icon to exit.

      In a Microsoft PowerPoint slide, select the control and then select the insertion point. With the crosshair visible on the screen, note that you can hold down and drag the mouse button to the size you want and the control will be inserted in the placeholder. Otherwise, you can click anywhere on the slide to place the control in that location with a default size and you can modify the size coordinates later (as described in the procedure "To format the control in a document" later in this chapter).

      The Design mode icon is not displayed after you insert the control although Design mode is in effect. To exit Design mode, on the View menu, click Slide Show.



NOTE


The System Monitor control is not displayed correctly until you exit Design mode.

With the control sited in the document, you can add counters or modify control properties, as described in the System Monitor Help file (Sysmon.chm).

If you select Graph for the Display Type and the size you define for the control is insufficient to show the graph data, only a portion of the graph will be displayed (such as the vertical minimum and maximum scale values, and the counter-data graph lines).

If you select Report for the Display Type and the size is insufficient to show all the report data, the control includes vertical and horizontal scroll bars so that you can scroll to view the data that does not fit in the display.

If you want to format the control in the application, resume Design mode by clicking the Design mode icon in the Control Toolbox and see the procedure "To format the control in a document" later in this chapter.

To insert the control in a Microsoft Visual Basic program


    On the File menu, choose New to open a new project (such as a Standard EXE or an ActiveX Document EXE).

    On the Project menu, click Components to show the Components dialog box.

    You can also view the Components dialog box by right-clicking the Toolbox. If the Toolbox is not displayed, in the View menu, select the Toolbox command.

    Under Controls in the Components dialog box, select the System Monitor Control Library check box, and then click OK.

    An icon for the System Monitor control now appears in the Toolbox.

    With the form or the document displayed, double-click the System Monitor Control icon to add it to the form or document for your program.

    This places the control in the document, occupying the entire size of the form. If you want to select a size for the control, click the System Monitor Control icon once and then, when the crosshair appears, hold down and drag the mouse to the size you want the control to occupy on the form.


Immediately after inserting the control, the application is in Design mode, so you can format the control within a document. For more information, see the procedure "To format the control in a document" later in this chapter.

To insert the control in an HTML page


    Using a text editor, create a page to include the control. To place the control on the page, insert the <OBJECT> tag and specify the class ID as follows:


    <OBJECT classid="clsid:C4D2D8E0-D1DD-11CE-940F-008029004347">
    </OBJECT>

    This places the control in the document and, when you view the page in a Web browser, you can add counters or modify control properties as described in the procedures that appear later in this chapter.

    To include functions in your page that automate the setting of properties or addition of counters, use scripts written in Visual Basic Scripting Edition (VBScript), or use Microsoft® FrontPage®, as described in the following procedure.


To insert the System Monitor control in a Web page created with Microsoft FrontPage


    In a new or existing FrontPage Web page, on the Insert menu, select Other Components, and then select ActiveX Control.

    In the ActiveX Control Properties dialog box, select Sysmon Graph Control in the Pick A Control list box.

    To add VBScript, click Extended, and complete the Extended Attributes dialog box as needed.

    For more information about VBScript, see the VBScript link on the Web Resources page at http://windows.microsoft.com/windows2000/reskit/webresources.


Formatting the Control in a Document


The default appearance of the control can vary based on the document in which it resides. This is because the control takes the ambient properties of the document in which it is running. For example, when placed in Microsoft Word or FrontPage, the graph background, font, and chart background color might be reset to the default color and font used by those documents. Therefore, after you insert the control in a Microsoft Office application, you might want to change its appearance with respect to the document itself.

Using Design mode in Visual Basic or Office documents, you can easily manipulate the control's attributes, such as size or position, as you can with any linked or embedded object. In addition, you have access to the control's properties, methods, and events from the Visual Basic editor for programming the control's behavior within the document. (The control's user interface is inactive when the document is in Design mode.) Note that there are slight differences in how some of the Office applications handle formatting the inserted control.

NOTE


When changing the properties of the control, it is possible to set colors for BackColor, ForeColor, or GraphBackground, or to set graph line colors that are not visible. Therefore, make sure to check the appearance of your control display after you make changes to its properties.

In addition, you cannot programmatically format the properties and methods of the control using the Visual Basic editor. Use VBScript or Microsoft® Jscript® in your HTML editor for this purpose.

To format the control in a document


    Resume Design mode and make the changes you want. To resume Design mode in PowerPoint, exit the Slide Show view.


      To change the position of the control in the document, drag the control to another position in the container.

      To change the height or width of the control in the document, drag one of the selection handles of the control in the appropriate direction.


    To access the control properties or the Visual Basic code editor, right-click the control and select Properties or View Code, as appropriate. In the Visual Basic code editor window, you can view the Object Browser if needed.

    Notice that some commands on this shortcut menu (such as Cut, Copy, or Paste) are designed for other embedded or linked objects in that document; they are not relevant to the control and might be unavailable (dimmed).


NOTE


When you use Microsoft Office applications, it is possible to modify the control in the document so that the control's properties become inaccessible. This occurs because the control is being converted into an embedded object. For example, if you click the System Monitor Control Object command in Microsoft Word (by right-clicking the control) and select the Convert command, the Convert dialog box appears. If you click OK in this box, the control's properties and view-code option become unavailable. You will not be able to change the position or the size of the object in Word.


    Exit Design mode before trying to add counters or to edit the control's default properties.


Notice that the appearance of the control might not update properly until you exit Design mode.

For information about the control's objects, properties, and so on, see the Software Development Kit (SDK) documentation in the MSDN Library at http://windows.microsoft.com/windows2000/reskit/webresources.

/ 335