Microsoft KB Archive/242229

= How To Create an OCX View with the MMC Snap-in Designer for Visual Basic =

Article ID: 242229

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Management Console 1.1
 * Microsoft Management Console 1.2
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q242229



SUMMARY
The Microsoft Management Console (MMC) Snap-in Designer for Visual Basic offers the ability to create result views based on ActiveX UserControls. The use of ActiveX UserControls allows for greater flexibility in what can be displayed in the Result View window. This article outlines the steps needed to create an OCX View.



Steps to Create an OCX View
 Start Visual Basic and select a new SnapIn project from the New Project dialog box. Add a new UserControl to the project. By default this new UserControl will be named UserControl1. Open the SnapIn1 Designer. Under the Static node, right-click the ResultView node, and then select Add New Result View -> OCX View from the pop-up menu. By default, the new Result View will be named OCXView1. Right-click the OCXView1 node and select Properties from the pop-up menu. When the property dialog box appears for OCXView1, set the ProgID text field to the ProgID of the project's UserControl (Snapin.UserControl1). Close the property sheet when done. Right-click the main parent node, Snapin1, and select Properties. When the Snap-in property sheet appears, set the Default Result View value to OCXView1. Close the property sheet.</li>  Open the UserControl1 code window, and add the following code: Private Sub UserControl_Click UserControl.BackColor = vbRed End Sub </li> Compile the project and start MMC.</li> Load the snap-in into MMC and select the SnapIn1 scope item. The UserControl will be rendered in the result view window.</li> Click anywhere in the result view window and the background color of the window will change to red.</li></ol>