Home COM GDI+ WebBrowser Data Access

DIDiskQuotaControl  Object

 

PROGID

"Microsoft.DiskQuota.1"

CLSID_DIDiskQuotaControl

{7988B571-EC89-11CF-9C00-00AA00A14F56}

IID_DIDiskQuotaControl

{7988B575-EC89-11CF-9C00-00AA00A14F56}

 

 

The NTFS file system allows an administrator to manage disk usage on a shared volume by allocating a specified amount of disk space, or quota limit, to each user. The DiskQuotaControl object allows an administrator to manage a volume's disk quota properties. For instance, you can use this object to set the default quota limit that will be automatically assigned to all new users.

 

Remarks

An administrator can use the DiskQuotaControl object to do a number of tasks, including:

  • Enabling and disabling the volume's disk quota system.

  • Obtaining the status of the quota system on the volume.

  • Denying disk space to users exceeding their quota limit.

  • Specifying the default warning threshold and quota limit values that will be assigned to new users.

  • Adding and removing users.

 

The DiskQuotaControl object allows you to set global default values for the volume for properties such as quota limits. However, each user is represented by a DIDiskQuotaUser object that can be used to specify individual quota settings.

 

There are several ways to obtain a user's DIDiskQuotaUser object:

  • The DIDiskQuotaUser objects for all users with quotas on the volume are exposed as a collection, and can be enumerated. For a discussion of how to enumerate DIDiskQuotaUser objects, see Enumerating Disk Quota Users in the Remarks section of DIDiskQuotaUser.

  • When you add a new user, the AddUser method returns the user's DIDiskQuotaUser object.

  • If you have the user's name, the FindUser method returns the user's DIDiskQuotaUser object.

 

This object makes the essential functionality of the IDiskQuotaControl interface available to scripting and Microsoft Visual Basic-based applications.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IDispatch Methods

Description

GetTypeInfoCount

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

GetTypeInfo

Gets the type information for an object.

GetIDsOfNames

Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.

Invoke

Provides access to properties and methods exposed by an object.

DIDiskQuotaControl Methods and Properties

Description

QuotaState

Sets or retrieves the state of the volume's disk quotas.

QuotaFileIncomplete

Retrieves a Boolean value that indicates whether the quota file for the volume is complete.

QuotaFileRebuilding

Retrieves a Boolean value that indicates whether the quota file for the volume is currently being rebuilt.

LogQuotaThreshold

Sets or retrieves a Boolean value that indicates whether a system event log entry will be made when a user exceeds his or her assigned quota threshold.

LogQuotaLimit

Sets or retrieves a Boolean value that indicates whether a system event log entry will be made when a user exceeds his or her assigned quota limit.

DefaultQuotaThreshold

Sets or retrieves the default quota threshold, in bytes.

DefaultQuotaThresholdText

Retrieves the default quota threshold as a text string.

DefaultQuotaLimit

Sets or retrieves the default quota limit, in bytes.

DefaultQuotaLimitText

Retrieves the default quota limit as a text string.

UserNameResolution

Sets or retrieves a value that controls how user security identifier (SID) are resolved to user names.

Initialize

Opens a specified volume and initializes its quota control object.

ShutdownNameResolution

Shuts down the user name resolution thread.

AddUser

Assigns a nondefault disk quota to a new user.

DeleteUser

Deletes a user from the volume.

FindUser

Finds a user's entry, by name, in the volume's quota file.

InvalidateSidNameCache

Invalidates the security identifier (ID) user name cache.

GiverUserNameResolutionPriority

Places the specified user object next in line for name resolution.

TranslateLogonNameToSID

Translates a logon name to the corresponding user security ID in string format.

_NewEnum

Create a Collection object for user quota entry enumeration.

DIDiskQuotaControl Event

Description

OnUserNameChanged

Occurs when the name information for a DIDiskQuotaUser object has been resolved.

 

AccountStatusConstants

 

%dqAcctResolved = 0

%dqAcctUnavailable = 1
%dqAcctDeleted = 2
%dqAcctInvalid = 3
%dqAcctUnknown = 4
%dqAcctUnresolved = 5

 

 

QuotaStateConstants

 

%dqStateDisable = 0
%dqStateTrack = 1
%dqStateEnforce = 2

 

 

UserNameResolutionConstants

 

%dqResolveNone = 0
%dqResolveSync = 1
%dqResolveAsync = 2

 

 

QuotaState

 

FUNCTION DIDiskQuotaControl_put_QuotaState ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pState AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING DIDiskQuotaControl_put_QuotaState (pthis, pState) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

FUNCTION DIDiskQuotaControl_get_QuotaState ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pState AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[8] USING DIDiskQuotaControl_get_QuotaState (pthis, pState) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

QuotaFileIncomplete

 

FUNCTION DIDiskQuotaControl_get_QuotaFileIncomplete ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pbIncomplete AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING DIDiskQuotaControl_get_QuotaFileIncomplete (pthis, pbIncomplete) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

QuotaFileRebuilding

 

FUNCTION DIDiskQuotaControl_get_QuotaFileRebuilding ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pbRebuilding AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[10] USING DIDiskQuotaControl_get_QuotaFileRebuilding (pthis, pbRebuilding) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

LogQuotaThreshold

 

FUNCTION DIDiskQuotaControl_put_LogQuotaThreshold ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pbLogThreshold AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[11] USING DIDiskQuotaControl_put_LogQuotaThreshold (pthis, pbLogThreshold) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

FUNCTION DIDiskQuotaControl_get_LogQuotaThreshold ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pbLogThreshold AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[12] USING DIDiskQuotaControl_get_LogQuotaThreshold (pthis, pbLogThreshold) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

LogQuotaLimit

 

FUNCTION DIDiskQuotaControl_put_LogQuotaLimit ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pbLogLimit AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[13] USING DIDiskQuotaControl_put_LogQuotaLimit (pthis, pbLogLimit) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

FUNCTION DIDiskQuotaControl_get_LogQuotaLimit ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pbLogLimit AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[14] USING DIDiskQuotaControl_get_LogQuotaLimit (pthis, pbLogLimit) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

DefaultQuotaThreshold

 

FUNCTION DIDiskQuotaControl_put_DefaultQuotaThreshold ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pThreshold AS DOUBLE _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING DIDiskQuotaControl_put_DefaultQuotaThreshold (pthis, pThreshold) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

FUNCTION DIDiskQuotaControl_get_DefaultQuotaThreshold ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pThreshold AS DOUBLE _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING DIDiskQuotaControl_get_DefaultQuotaThreshold (pthis, pThreshold) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

DefaultQuotaThresholdText

 

FUNCTION DIDiskQuotaControl_get_DefaultQuotaThresholdText ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pThresholdText AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[17] USING DIDiskQuotaControl_get_DefaultQuotaThresholdText (pthis, pThresholdText) TO HRESULT
  FUNCTION = HRESULT
  pThresholdText = ACODE$(pThresholdText)

END FUNCTION
 

 

DefaultQuotaLimit

 

FUNCTION DIDiskQuotaControl_put_DefaultQuotaLimit ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pLimit AS DOUBLE _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[18] USING DIDiskQuotaControl_put_DefaultQuotaLimit (pthis, pLimit) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

FUNCTION DIDiskQuotaControl_get_DefaultQuotaLimit ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pLimit AS DOUBLE _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[19] USING DIDiskQuotaControl_get_DefaultQuotaLimit (pthis, pLimit) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

DefaultQuotaLimitText

 

FUNCTION DIDiskQuotaControl_get_DefaultQuotaLimitText ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pLimitText AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[20] USING DIDiskQuotaControl_get_DefaultQuotaLimitText (pthis, pLimitText) TO HRESULT
  FUNCTION = HRESULT
  pLimitText = ACODE$(pLimitText)

END FUNCTION
 

 

UserNameResolution

 

FUNCTION DIDiskQuotaControl_put_UserNameResolution ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pResolutionType AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[21] USING DIDiskQuotaControl_put_UserNameResolution (pthis, pResolutionType) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

FUNCTION DIDiskQuotaControl_get_UserNameResolution ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pResolutionType AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[22] USING DIDiskQuotaControl_get_UserNameResolution (pthis, pResolutionType) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

Initialize

 

FUNCTION DIDiskQuotaControl_Initialize ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL path AS STRING _
, BYVAL bReadWrite AS INTEGER _
  ) AS LONG

  LOCAL HRESULT AS LONG
  path = UCODE$(path)
  CALL DWORD @@pthis[23] USING DIDiskQuotaControl_Initialize (pthis, path, bReadWrite) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

ShutdownNameResolution

 

FUNCTION DIDiskQuotaControl_ShutdownNameResolution ( _
  BYVAL pthis AS DWORD PTR _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[24] USING DIDiskQuotaControl_ShutdownNameResolution (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

AddUser

 

FUNCTION DIDiskQuotaControl_AddUser ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL LogonName AS STRING _
, BYREF ppUser AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  LogonName = UCODE$(LogonName)
  CALL DWORD @@pthis[25] USING DIDiskQuotaControl_AddUser  (pthis, LogonName, ppUser) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

DeleteUser

 

FUNCTION DIDiskQuotaControl_DeleteUser ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pUser AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[26] USING DIDiskQuotaControl_DeleteUser (pthis, pUser) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

FindUser

 

FUNCTION DIDiskQuotaControl_FindUser ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL LogonName AS STRING _
, BYREF ppUser AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  LogonName = UCODE$(LogonName)
  CALL DWORD @@pthis[27] USING DIDiskQuotaControl_FindUser (pthis, LogonName, ppUser) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

InvalidateSidNameCache

 

FUNCTION DIDiskQuotaControl_InvalidateSidNameCache ( _
  BYVAL pthis AS DWORD PTR _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[28] USING DIDiskQuotaControl_InvalidateSidNameCache (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

GiveUserNameResolutionPriority

 

FUNCTION DIDiskQuotaControl_GiveUserNameResolutionPriority ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pUser AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[29] USING DIDiskQuotaControl_GiveUserNameResolutionPriority (pthis, pUser) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

TranslateLogonNameToSID

 

FUNCTION DIDiskQuotaControl_TranslateLogonNameToSID ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL LogonName AS STRING _
, BYREF psid AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG
  LogonName = UCODE$(LogonName)
  CALL DWORD @@pthis[30] USING DIDiskQuotaControl_TranslateLogonNameToSID (pthis, LogonName, psid) TO HRESULT
  FUNCTION = HRESULT
  psid = ACODE$(psid)

END FUNCTION
 

 

_NewEnum

 

FUNCTION DIDiskQuotaControl_NewEnum ( _
  BYVAL pthis AS DWORD PTR _
, BYREF ppEnum AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[31] USING DIDiskQuotaControl_NewEnum (pthis, ppEnum) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION
 

 

DIDiskQuotaControl Events

 


' ****************************************************************************************
' DIDiskQuotaControlEvents dispatch interface
' IID = {7988B581-EC89-11CF-9C00-00AA00A14F56}
' Help string = DIDiskQuotaControlEvents Interface
' Attributes = 4224 [&H1080]  [Nonextensible] [Dispatchable]
' Number of functions = 1
' ****************************************************************************************

' ****************************************************************************************
' EXCEPINFO structure
' ****************************************************************************************
TYPE DIDiskQuotaControlEvents_EXCEPINFO
   wCode AS WORD               ' An error code describing the error.
   wReserved AS WORD           ' Reserved
   bstrSource AS DWORD         ' Source of the exception.
   bstrDescription AS DWORD    ' Textual description of the error.
   bstrHelpFile AS DWORD       ' Help file path.
   dwHelpContext AS DWORD      ' Help context ID.
   pvReserved AS DWORD         ' Reserved.
   pfnDeferredFillIn AS DWORD  ' Pointer to function that fills in Help and description info.
   scode AS DWORD              ' An error code describing the error.
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Returns a pointer to a specified interface on an object to which a client currently holds an
' interface pointer.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, _
   BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   CALL DWORD @@pthis[0] USING DIDiskQuotaControlEvents_IUnknown_QueryInterface(pthis, riid, ppvObj) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Decrements the reference count for the calling interface on a object. If the reference count
' on the object falls to 0, the object is freed from memory.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
   LOCAL DWRESULT AS DWORD
   CALL DWORD @@pthis[2] USING DIDiskQuotaControlEvents_IUnknown_Release(pthis) TO DWRESULT
   FUNCTION = DWRESULT
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IConnectionPointContainer::FindConnectionPoint
' Returns a pointer to the IConnectionPoint interface of a connection point for a specified IID,
' if that IID describes a supported outgoing interface.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_IConnectionPointContainer_FindConnectionPoint ( _
   BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppCP AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   CALL DWORD @@pthis[4] USING DIDiskQuotaControlEvents_IConnectionPointContainer_FindConnectionPoint(pthis, riid, ppCP) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IConnectionPoint::Advise
' Establishes a connection between the connection point object and the client's sink.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_IConnectionPoint_Advise (BYVAL pthis AS DWORD PTR, _
   BYVAL pUnkSink AS DWORD, BYREF pdwCookie AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   CALL DWORD @@pthis[5] USING DIDiskQuotaControlEvents_IConnectionPoint_Advise(pthis, pUnkSink, pdwCookie) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IConnectionPoint::Unadvise
' Terminates an advisory connection previously established through IConnectionPoint_Advise.
' The dwCookie parameter identifies the connection to terminate.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_IConnectionPoint_Unadvise (BYVAL pthis AS DWORD PTR, BYVAL dwCookie AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   CALL DWORD @@pthis[6] USING DIDiskQuotaControlEvents_IConnectionPoint_Unadvise(pthis, dwCookie) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IDispatch virtual table
' ****************************************************************************************
TYPE DIDiskQuotaControlEvents_IDispatchVtbl
   QueryInterface AS DWORD     ' Returns pointers to supported interfaces
   AddRef AS DWORD             ' Increments reference count
   Release AS DWORD            ' Decrements reference count
   GetTypeInfoCount AS DWORD   ' Retrieves the number of type descriptions
   GetTypeInfo AS DWORD        ' Retrieves a description of object's programmable interface
   GetIDsOfNames AS DWORD      ' Maps name of method or property to DispId
   Invoke AS DWORD             ' Calls one of the object's methods, or gets/sets one of its properties
   pVtblAddr AS DWORD          ' Address of the virtual table
   cRef AS DWORD               ' Reference counter
   pthis AS DWORD              ' IUnknown or IDispatch of the control that fires the events
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' UI4 AddRef()
' Increments the reference counter.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_AddRef (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR) AS DWORD
   INCR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_QueryInterface (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, _
   BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
   ppvObj = pCookie
   DIDiskQuotaControlEvents_AddRef pCookie
   FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' UI4 Release()
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_Release (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR) AS DWORD
   LOCAL pVtblAddr AS DWORD
   IF @@pCookie.cRef = 1 THEN
      pVtblAddr = @@pCookie.pVtblAddr
      IF ISTRUE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
         FUNCTION = 0
         EXIT FUNCTION
      ELSE
         FUNCTION = @@pCookie.cRef
         EXIT FUNCTION
      END IF
   END IF
   DECR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' HRESULT GetTypeInfoCount([out] *UINT pctinfo)
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_GetTypeInfoCount (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, BYREF pctInfo AS DWORD) AS LONG
   FUNCTION = %E_NOTIMPL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' HRESULT GetTypeInfo([in] UINT itinfo, [in] UI4 lcid, [out] **VOID pptinfo)
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_GetTypeInfo (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, _
   BYVAL itinfo AS DWORD, BYVAL lcid AS DWORD, BYREF pptinfo AS DWORD) AS LONG
   FUNCTION = %E_NOTIMPL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' HRESULT GetIDsOfNames([in] *GUID riid, [in] **I1 rgszNames, [in] UINT cNames, [in] UI4 lcid, [out] *I4 rgdispid)
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_GetIDsOfNames ( BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, _
   BYREF riid AS GUID, BYVAL rgszNames AS DWORD, BYVAL cNames AS DWORD, BYVAL lcid AS DWORD, BYREF rgdispid AS LONG) AS LONG
   FUNCTION = %E_NOTIMPL
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Builds the IDispatch Virtual Table
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD

   LOCAL pVtbl AS DIDiskQuotaControlEvents_IDispatchVtbl PTR
   LOCAL pUnk AS DIDiskQuotaControlEvents_IDispatchVtbl PTR

   pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
   IF pVtbl = 0 THEN EXIT FUNCTION

   @pVtbl.QueryInterface   = CODEPTR(DIDiskQuotaControlEvents_QueryInterface)
   @pVtbl.AddRef           = CODEPTR(DIDiskQuotaControlEvents_AddRef)
   @pVtbl.Release          = CODEPTR(DIDiskQuotaControlEvents_Release)
   @pVtbl.GetTypeInfoCount = CODEPTR(DIDiskQuotaControlEvents_GetTypeInfoCount)
   @pVtbl.GetTypeInfo      = CODEPTR(DIDiskQuotaControlEvents_GetTypeInfo)
   @pVtbl.GetIDsOfNames    = CODEPTR(DIDiskQuotaControlEvents_GetIDsOfNames)
   @pVtbl.Invoke           = CODEPTR(DIDiskQuotaControlEvents_Invoke)
   @pVtbl.pVtblAddr        = pVtbl
   @pVtbl.pthis            = pthis

   pUnk = VARPTR(@pVtbl.pVtblAddr)
   FUNCTION = pUnk

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Establishes a connection between the connection point object and the client's sink.
' Returns a token that uniquely identifies this connection.
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_ConnectEvents (BYVAL pthis AS DWORD, BYREF pdwCookie AS DWORD) AS LONG

   LOCAL HRESULT AS LONG                 ' HRESULT code
   LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
   LOCAL pCP AS DWORD                    ' IConnectionPoint
   LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
   LOCAL IID_CP AS GUID                  ' Events dispinterface
   LOCAL dwCookie AS DWORD               ' Returned token
   LOCAL pUnkSink AS DWORD               ' IUnknown of the class

   IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
   IID_CP  = GUID$("{7988B581-EC89-11CF-9C00-00AA00A14F56}")

   IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
   HRESULT = DIDiskQuotaControlEvents_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
   IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION

   HRESULT = DIDiskQuotaControlEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
   DIDiskQuotaControlEvents_IUnknown_Release pCPC
   IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION

   pUnkSink = DIDiskQuotaControlEvents_BuildVtbl(pthis)
   IF ISTRUE pUnkSink THEN HRESULT = DIDiskQuotaControlEvents_IConnectionPoint_Advise(pCP, pUnkSink, dwCookie)
   DIDiskQuotaControlEvents_IUnknown_Release pCP
   pdwCookie = dwCookie
   FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Releases the events connection identified with the cookie returned by the ConnectEvents function
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_DisconnectEvents (BYVAL pthis AS DWORD, BYVAL dwCookie AS DWORD) AS LONG

   LOCAL HRESULT AS LONG                 ' HRESULT code
   LOCAL pCPC AS DWORD                   ' IConnectionPointContainer
   LOCAL pCP AS DWORD                    ' IConnectionPoint
   LOCAL IID_CPC AS GUID                 ' IID_IConnectionPointContainer
   LOCAL IID_CP AS GUID                  ' ConnectionEvents dispinterface

   IID_CPC = GUID$("{B196B284-BAB4-101A-B69C-00AA00341D07}")
   IID_CP  = GUID$("{7988B581-EC89-11CF-9C00-00AA00A14F56}")

   IF pthis = 0 THEN FUNCTION = -1 : EXIT FUNCTION
   HRESULT = DIDiskQuotaControlEvents_IUnknown_QueryInterface(pthis, IID_CPC, pCPC)
   IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION

   HRESULT = DIDiskQuotaControlEvents_IConnectionPointContainer_FindConnectionPoint(pCPC, IID_CP, pCP)
   DIDiskQuotaControlEvents_IUnknown_Release pCPC
   IF HRESULT <> %S_OK THEN FUNCTION = HRESULT : EXIT FUNCTION

   HRESULT = DIDiskQuotaControlEvents_IConnectionPoint_Unadvise(pCP, dwCookie)
   DIDiskQuotaControlEvents_IUnknown_Release pCP
   FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Function name: OnUserNameChanged
' Dispatch interface name: DIDiskQuotaControlEvents
' Member identifier: &H00000001 (1)
' ****************************************************************************************
SUB DIDiskQuotaControlEvents_OnUserNameChanged (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, BYREF pdispparams AS DISPPARAMS)

'  =======================================================================================
'  Retrieve the IDispatch reference of the control that has fired the event.
'  =======================================================================================
   LOCAL pthis AS DWORD : pthis = @@pCookie.pthis
'  =======================================================================================

'  =======================================================================================
'  Pointer variables to access the parameters
'  =======================================================================================
   LOCAL pv AS VARIANT PTR : pv = pdispparams.VariantArgs
   LOCAL pvapi AS VARIANTAPI PTR : pvapi = pv
'  =======================================================================================

'  =======================================================================================
'  Parameters in DISPPARAMS are zero based and in reverse order
'  =======================================================================================
'  *** pUser - VarType: VT_PTR->VT_USERDEFINED - Resolved VarType: *DIDiskQuotaUser <dispinterface> - Attributes: &H0 -  [None] ***
   LOCAL pUser AS DWORD : pUser = VARIANT#(@pv[0])
'  =======================================================================================

'  =======================================================================================
'  *** Put your code here ***
'  =======================================================================================


END SUB
' ****************************************************************************************


' ****************************************************************************************
' HRESULT Invoke([in] I4 dispidMember, [in] *GUID riid, [in] UI4 lcid, [in] UI2 wFlags, [in] *DISPPARAMS pdispparams, [out] *VARIANT pvarResult, [out] *EXCEPINFO pexcepinfo, [out] *UINT puArgErr)
' ****************************************************************************************
FUNCTION DIDiskQuotaControlEvents_Invoke (BYVAL pCookie AS DIDiskQuotaControlEvents_IDispatchVtbl PTR, BYVAL dispidMember AS LONG, BYREF riid AS GUID, _
   BYVAL lcid AS DWORD, BYVAL wFlags AS WORD, BYREF pdispparams AS DISPPARAMS, BYREF pvarResult AS VARIANT, _
   BYREF pexcepinfo AS DIDiskQuotaControlEvents_EXCEPINFO, BYREF puArgErr AS DWORD) AS LONG

   FUNCTION = %S_OK

   IF VARPTR(pdispparams) THEN

      SELECT CASE AS LONG dispidMember

         CASE &H00000001  ' (1)  ' // OnUserNameChanged
            DIDiskQuotaControlEvents_OnUserNameChanged(pCookie, pdispparams)
         CASE ELSE
            FUNCTION = %DISP_E_MEMBERNOTFOUND
      END SELECT

   END IF

END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Monday, 03 April 2006 20:37:21 +0200