2025-04-27 07:49:33 -04:00

771 lines
24 KiB
Plaintext

// Copyright (c) 1997-1999 Microsoft Corporation
// SingleView.odl : type library source for ActiveX Control project.
// This file will be processed by the Make Type Library (mktyplib) tool to
// produce the type library (SingleView.tlb) that will become a resource in
// SingleView.ocx.
///////////////////////////////////////////////////////////////////////
//////////////////// METHODS //////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//*********************************************************************
// GetEditMode
//
// Get the current state of the edit mode flag.
//
// Parameters:
// None.
//
// Returns:
// long
// 0 = WMI browser mode. No properties can be added or
// deleted, property names and types are read-only.
// Property values may be modified if the READ qualifier is FALSE.
//
// 1 = WMI studio mode. Properties can be created, deleted, and
// edited.
//
//
//*********************************************************************
// SetEditMode
//
// Set the view's edit mode flag.
//
// Parameters:
// [in] long lEditMode
// 0 = WMI browser mode. No properties can be added or
// deleted, property names and types are read-only.
// Property values may be modified if the READ qualifier is FALSE.
//
// 1 = WMI studio mode. Properties can be created, deleted, and
// edited.
//
//
// Returns:
// Nothing.
//
//*********************************************************************
// RefreshView
//
// This method causes the contents of the view to be re-loaded from
// the database.
//
// Parameters:
// None.
//
// Returns:
// long
// S_OK if successful, a failure code if some error occurred.
//
//*********************************************************************
// NotifyWillShow
//
// This method is defunct and will be removed from the API.
//
//
// Parameters:
// None.
//
// Returns:
// Nothing.
//
//*********************************************************************
// DeleteInstance
//
// This method deletes the currently selected instance.
//
// Parameters:
// None.
//
// Returns:
// long
// S_OK if successful, a failure code otherwise.
//
//*********************************************************************
// ExternInstanceCreated
//
// Clients of the SingleView control should call this method to
// when a WMI object instance is created to notify the SingleView
// that this has occurred.
//
// Parameters:
// LPCTSTR szObjectPath
// The full path of the HMOM class object.
//
// Returns:
// Nothing.
//
//*********************************************************************
// ExternInstanceDeleted
//
// Clients of this SingleView control should call this method when
// an instance of a WMI class is deleted.
//
// Parameters:
// LPCTSTR szObjectPath
// The full path of the HMOM class object.
//
// Returns:
// Nothing.
//
//*********************************************************************
// QueryCanCreateInstance
//
// Call this method to see whether or not it is OK to call CreateInstance
// to create an instance of the currently selected class. This method
// checks various attributes of the current class, such as whether or not
// it has a key to verify that it makes sense to create an instance of
// the class.
//
// Parameters:
// None.
//
// Returns:
// long
// TRUE if it is OK to call CreateInstance to create an instance
// of the current class.
//
//*********************************************************************
// CSingleViewCtrl::QueryCanDeleteInstance
//
// Call this method to determine whether or not it is OK to call "DeleteInstance" to
// delete the current instance. This method will return FALSE if there is no current
// instance to delete, etc.
//
// Parameters:
// None.
//
// Returns:
// BOOL
// TRUE if the current instance can be deleted, FALSE if there is
// no current instance or it can't be deleted.
//
//*********************************************************************
// QueryNeedsSave
//
// Query to determine whether the currently selected object has
// been modified and needs to be saved. If the object has been
// modified, it can be saved by calling "SaveData".
//
//
// Parameters:
// None.
//
// Returns:
// long
// TRUE if there is something that needs to be saved.
//
//*********************************************************************
// QueryObjectSelected
//
// Check to see whether or not the object has a selection.
//
// Parameters:
// None.
//
// Returns:
// long
// TRUE if an object is currently selected, FALSE otherwise.
//
//*********************************************************************
// GetObjectPath
//
// Get the object path at the given object position.
//
// Parameters:
// [in] long lPosition
// One of the following:
// 0 = Current object
// 1 = First object
// 2 = Last object
//
// Note that only a value of zero for the "current object" makes
// sense for the SingleView control.
//
// Returns:
// BSTR
// The specified object path, or NULL if no object
// exists at the given position.
//
//*********************************************************************
// StartViewEnumeration
//
// Start the enumeration of alternate (custom) views.
//
// Parameters:
// [in] long lWhere
// 0 = The default view.
// 1 = The currently selected view.
// 2 = The first view.
// 3 = The last view.
//
// Returns:
// long
// The view position.
//
//*********************************************************************
// GetTitle
//
// The container calls this method to get the title and icon to
// display in the title bar.
//
// Parameters:
// [out] BSTR FAR* pbstrTitle
// Pointer to the place to return the view's title.
//
// [out] LPDISPATCH FAR* lpdispPicture
// The picture dispatch pointer for the title bar icon to
// be displayed. NULL if no icon should be displayed.
//
// Returns:
// long
// S_OK if the title and icon were returned successfully,
// E_FAIL otherwise.
//
//*********************************************************************
// GetViewTitle
//
// Get the title of the view at the given position.
//
// Note that various alternat or custom views of an object may
// exist and that this method provides a way to get the view's
// title.
//
// Parameters:
// [in] long lPosition
// 0 = The default view.
// 1 = The currently selected view.
// 2 = The first view.
// 3 = The last view.
//
// Returns:
// BSTR
// The view title.
//
//*********************************************************************
// NextViewTitle
//
// Get the title of the view at the next position.
//
// This method is useful when enumerating view titles. Sell also
// StartViewEnumeration.
//
// Parameters:
// [in] long lPosition
// The view position. The initial value of lPosition is obtained
// by calling StartViewEnumeration.
//
// [out] BSTR FAR* pbstrTitle
// The view title is returned here.
//
//
// Returns:
// long
// The position of the view title that is returned, -1 if a
// "next" view does not exist.
//
//*********************************************************************
// PrevViewTitle
//
// Get the title of the view at the previous position.
//
// This method is useful when enumerating view titles. Sell also
// StartViewEnumeration.
//
// Parameters:
// [in] long lPosition
// The view position. The initial value of lPosition is obtained
// by calling StartViewEnumeration.
//
// [out] BSTR FAR* pbstrTitle
// The view title is returned here.
//
// Returns:
// long
// The position of the view title that is returned, -1 if a
// "previous" view does not exist.
//
//*********************************************************************
// SelectView
//
// Select the specified view.
//
// Parameters:
// [in] long lPosition
// The position of the view returned by StartViewEnumeration,
// NextViewTitle, or PrevViewTitle.
//
// Returns:
// long
// S_OK if the view selection was successful.
//
//*********************************************************************
// StartObjectEnumeration
//
// Start enumeration of objects.
//
// Parameters:
// [in] long lWhere
// 0 = Currently selected object.
// Returns:
// SCODE
// S_OK if the view selection was successful.
//
//*********************************************************************
// GetObjectTitle
//
// Get a title for the specified object that is suitable for display
// to the user. Note that the title is not necessarily the object path.
//
// Parameters:
// [in] long lWhere
// 0 = Currently selected object.
// Returns:
// BSTR
// The object's title.
//
//*********************************************************************
// SaveData
//
// Save changes to current object.
//
// Parameters:
// None
//
// Returns:
// long
// S_OK if successful, otherwise a failure code.
//
//*********************************************************************
// AddContextRef
//
// Increment the reference count for the specified context handle.
//
// Parameters:
// [out] long lCtxtHandle
// The context handle.
//
// Returns:
// long
// S_OK if the reference count was successfully incremented,
// a failure code otherwise.
//
//*********************************************************************
// CSingleViewCtrl::ReleaseContext
//
// Decrement the reference count for the specified context handle.
//
// Parameters:
// [out] long lCtxtHandle
// The context handle.
//
// Returns:
// SCODE
// S_OK if the reference count was successfully decremented,
// a failure code otherwise.
//
//*********************************************************************
// RestoreContext
//
// Restore the state of this SingleView control to the previously saved
// context.
//
// Parameters:
// long lCtxtHandle
// This is the handle of the context to restore to.
//
// Returns:
// SCODE
// S_OK if the view's context could be restored, a failure code
// otherwise.
//
//*********************************************************************
// GetContext
//
// Take a snapshot of the current state of this SingleView control,
// save the state in a context object and return a handle to the
// context object. The intial reference count to the context object
// will be one. The context object will be deleted when its reference
// count is decremented to zero.
//
// Parameters:
// [out] long FAR* plCtxtHandle
// This is a pointer to the place to return the context
// handle.
//
// Returns:
// SCODE
// S_OK if the context was returned successfully, E_FAIL
// if not.
//
//*********************************************************************
// NextObject
//
// Get the position of the next object in the currently selected view.
//
// Parameters:
// [in] long lPosition
// The position value returned by StartObjectEnumeration,
// PrevObject, or NextObject.
//
// Returns:
// long
// The position of the next object.
//
//*********************************************************************
// PrevObject
//
// Get the position of the previous object in the currently selected view.
//
// Paramters:
// [in] lPosition
// The position value returned by StartObjectEnumeration,
// PrevObject, or NextObject.
//
// Returns:
// long
// The positon of the previous object.
//
//*********************************************************************
// CSingleViewCtrl::SelectObjectByPath
//
// Select the specified object.
//
// Parameters:
// [in] LPCTSTR szObjectPath
// The WMI object path.
//
// Returns:
// long
// S_OK if the object is selected, a failure code
// otherwise.
//
//*********************************************************************
// SelectObjectByPosition
//
// Select the specified object in the currently selected view. This
// provides a way to jump to an object that appears in an alternate
// (custom) view of the current object.
//
// Parameters:
// [in] long lPos
// The object position in the currently selected view.
//
// Returns:
// SCODE
// S_OK if the object was selected successfully, a failure code
// otherwise.
//
//
//*********************************************************************
// SelectObjectByPointer
//
// Select an object given a pointer to the IWbemClassObject. This is useful for
// selecting objects that have no path such as objects that are embedded in other
// objects.
//
// Note that it is assumed that this object will reside in the most recently used
// namespace.
//
// Parameters:
// [in] LPUNKNOWN lpunkServices
// The IWbemServices pointer.
//
// [in] LPUNKNOWN lpunkClassObject
// A pointer to the object. This should be the IWbemClassObject pointer.
//
// long bExistsInDatabase
// TRUE if the object already exists in the database.
//
// Returns:
// long
// S_OK if successful, otherwise a failure code.
//
//*********************************************************************
// CreateInstance
//
// Create an instance of the specified class and make the newly created instance
// the current object.
//
// Parameters:
// LPCTSTR szClassName
// The class name.
//
// Returns:
// long
// S_OK if successful, a failure code otherwise.
//
//*********************************************************************
// CreateInstanceOfCurrentClass
//
// Create an instance of the currently selected class.
//
// Parameters:
// None.
//
// Returns:
// long
// S_OK if successful, a failure code otherwise.
//
//*********************************************************************
//_____________________________________________________________________
///////////////////////////////////////////////////////////////////////
//////////////////// EVENTS ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//_____________________________________________________________________
//*********************************************************************
// NotifyViewModified
//
// The SingleView fires this event when the view is modified in some
// way that changes its state, but not necessarily in a way that
// requires the current object to be saved.
//
// Parameters:
// None.
//
// Returns:
// Nothing.
//
//*********************************************************************
// NotifySaveRequired
//
// The SingleView fires this event when the current object is modified.
//
// Parameters:
// None.
//
// Returns:
// Nothing.
//
//*********************************************************************
// JumpToMultipleInstanceView
//
// The SingleView fires this event to request that a multiple instance
// view of an array of object should be displayed.
//
// Parameters:
// [in] BSTR szTitle
// The title to be displayed for the multiple instances.
//
// [in] VARIANT varPathArray
// An array of WMI object paths.
//
// Returns:
// Nothing.
//
//*********************************************************************
// NotifySelectionChanged
//
// The SingleView fires this event when the current object changes
// in an alternate (custom) view.
//
// Parameters:
// None.
//
// Returns:
// Nothing.
//
//*********************************************************************
// NotifyContextChanged
//
// The SingleView fires this event when the current context changes.
//
// Parameters:
// [in] long bPushContext
// TRUE if the current context has changed in a way that requires the
// new context to be pushed onto its context stack.
//
// Returns:
// Nothing.
//
//*********************************************************************
// GetWbemServices
//
// The SingleView fires this event when it needs to get an IWbemServices
// pointer for the current namespace and object path.
//
// Parameters:
// [in] BSTR szNamespace
// The desired namespace.
//
// [in] VARIANT* pvarUpdatePointer
// The singleview will set the type of this variant to VT_I4 and its lVal
// to FALSE. A value of FALSE means that a new services pointer should be
// returned via pvarServices.
//
// [in, out] VARIANT* pvarServices
// The IWbemServices pointer is returned in the punkVal member of the variant.
//
// [in, out] VARIANT* pvarSc
// The SCODE value for the login is returned via the lVal member of this variant.
// The type of this variant must be VT_I4.
//
// [in, out] VARIANT* pvarUserCancel
// The boolVal member of the variant is set to TRUE if the user cancelled the
// services login, FALSE otherwise. The vt member must be VT_BOOL.
//
//*********************************************************************
// NOTIFYChangeRootOrNamespace
//
// The SingleView fires this event to notify the container that the user has changed the
// root or namespace.
//
// Parameters;
// [in] BSTR szRootOrNamespace
// The path to the new root or namesapce.
//
// [in] long bChangeNamespace
// TRUE to if szRootOrNamespace containes the new namespace, FALSE if
// szRootOrNamespace contains a root path.
//
// [in] long bEchoSelectObject
// TRUE if the code that catches this event should fire back an event to
// select an object (and thus replacing the current selection in the SingleView)
//
// Returns:
// Nothing.
//
//*********************************************************************
// NotifyInstanceCreated
//
// The SingleView fires this event when it creates an new WMI object
// instance.
//
// Parameters:
// [in] BSTR szObjectPath
// The WMI object path for the newly created instance.
//
// Returns:
// Nothing.
//
//*********************************************************************
#include <olectl.h>
#include <idispids.h>
[ uuid(2745E5F2-D234-11D0-847A-00C04FD7BB08), version(1.0),
helpfile("SingleView.hlp"),
helpstring("WMI Object Viewer Control"),
control ]
library SINGLEVIEWLib
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB);
// Primary dispatch interface for CSingleViewCtrl
[ uuid(2745E5F3-D234-11D0-847A-00C04FD7BB08),
helpstring("Dispatch interface for WMI Object Viewer Control"), hidden ]
dispinterface _DSingleView
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CSingleViewCtrl)
[id(1), helpstring("Current Namespace")] BSTR NameSpace;
[id(DISPID_READYSTATE), helpstring("Download Status"), readonly] long ReadyState;
[id(2), helpstring("All Properties or Display Subset")] long PropertyFilter;
//}}AFX_ODL_PROP
methods:
// NOTE - ClassWizard will maintain method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(CSingleViewCtrl)
[id(3), helpstring("Get Read or Modify State")] long GetEditMode();
[id(4), helpstring("Set Read or Modify State")] void SetEditMode(long lEditMode);
[id(5), helpstring("Redraw from Repository")] long RefreshView();
[id(6), helpstring("Prepare to View")] void NotifyWillShow();
[id(7), helpstring("Delete Instance")] long DeleteInstance();
[id(8), helpstring("WMI Object Created")] void ExternInstanceCreated(BSTR szObjectPath);
[id(9), helpstring("WMI Object Deleted")] void ExternInstanceDeleted(BSTR szObjectPath);
[id(10), helpstring("Can Instance be Created")] long QueryCanCreateInstance();
[id(11), helpstring("Can Instance be Deleted")] long QueryCanDeleteInstance();
[id(12), helpstring("Is Current Object Modified")] long QueryNeedsSave();
[id(13), helpstring("Is Current Object Selected")] long QueryObjectSelected();
[id(14), helpstring("Get Path of Selected Object")] BSTR GetObjectPath(long lPosition);
[id(15), helpstring("Start Enumeration of Views")] long StartViewEnumeration(long lWhere);
[id(16), helpstring("Get View Title and Icon")] long GetTitle(BSTR* pszTitle, IDispatch** lpPictureDisp);
[id(17), helpstring("Get Current View Title")] BSTR GetViewTitle(long lPosition);
[id(18), helpstring("Get Next View Title")] long NextViewTitle(long lPositon, BSTR* pbstrTitle);
[id(19), helpstring("Get Previous View Title")] long PrevViewTitle(long lPosition, BSTR* pbstrTitle);
[id(20), helpstring("Current Position of the View")] long SelectView(long lPosition);
[id(21), helpstring("Start Enumeration of Objects")] long StartObjectEnumeration(long lWhere);
[id(22), helpstring("Get Title of Selected Object")] BSTR GetObjectTitle(long lPos);
[id(23), helpstring("Save Changes to Current Object")] long SaveData();
[id(24), helpstring("Increment Context Ref Count")] long AddContextRef(long lCtxtHandle);
[id(25), helpstring("Decrement Context Ref Count")] long ReleaseContext(long lCtxtHandle);
[id(26), helpstring("Restore Control State from Context")] long RestoreContext(long lCtxtHandle);
[id(27), helpstring("Save Control State and Return Context")] long GetContext(long* plCtxthandle);
[id(28), helpstring("Position of Next Object in Current View")] long NextObject(long lPosition);
[id(29), helpstring("Position of Previous Object in Current View")] long PrevObject(long lPosition);
[id(30), helpstring("Select Specified Object by Path")] long SelectObjectByPath(BSTR szObjectPath);
[id(31), helpstring("Select Specified Object by Position")] long SelectObjectByPosition(long lPosition);
[id(32), helpstring("Select Specified Object by Pointer")] long SelectObjectByPointer(IUnknown* lpunkWbemServices, IUnknown* lpunkClassObject, long bExistsInDatabase);
[id(33), helpstring("Create and Select Instance")] long CreateInstance(BSTR szClassName);
[id(34), helpstring("Create Instance of Current Class")] long CreateInstanceOfCurrentClass();
//}}AFX_ODL_METHOD
[id(DISPID_ABOUTBOX)] void AboutBox();
};
// Event dispatch interface for CSingleViewCtrl
[ uuid(2745E5F4-D234-11D0-847A-00C04FD7BB08),
helpstring("Event interface for WMI Object Viewer Control") ]
dispinterface _DSingleViewEvents
{
properties:
// Event interface has no properties
methods:
// NOTE - ClassWizard will maintain event information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_EVENT(CSingleViewCtrl)
[id(1), helpstring("View has Changed State")] void NotifyViewModified();
[id(2), helpstring("Object has been Modified")] void NotifySaveRequired();
[id(3), helpstring("Launch Multiple Instance View")] void JumpToMultipleInstanceView(BSTR szTitle, VARIANT varPathArray);
[id(4), helpstring("New Selection in Custom View")] void NotifySelectionChanged();
[id(5), helpstring("Current Context has Changed")] void NotifyContextChanged(long bPushContext);
[id(6), helpstring("Get IWbemServices Pointer Request")] void GetWbemServices(BSTR szNamespace, VARIANT* pvarUpdatePointer, VARIANT* pvarServices, VARIANT* pvarSc, VARIANT* pvarUserCancel);
[id(7), helpstring("Namespace or root has changed")] void NOTIFYChangeRootOrNamespace(BSTR szRootOrNamespace, long bChangeNamespace, long bEchoSelectObject);
[id(8), helpstring("New WMI Object Instance Created")] void NotifyInstanceCreated(BSTR szObjectPath);
[id(DISPID_READYSTATECHANGE), helpstring("Download Status Change")] void ReadyStateChange();
[id(9), helpstring("Request to Become UI Active")] void RequestUIActive();
//}}AFX_ODL_EVENT
};
// Class information for CSingleViewCtrl
[ uuid(2745E5F5-D234-11D0-847A-00C04FD7BB08),
helpstring("WMI Object Viewer Control"), control ]
coclass ObjectViewer
{
[default] dispinterface _DSingleView;
[default, source] dispinterface _DSingleViewEvents;
};
//{{AFX_APPEND_ODL}}
//}}AFX_APPEND_ODL}}
};