Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize

Visual Basic Code Example: Retrieving MSMQQueueInfo.Journal

This example provides a function that receives the path name of an existing queue and returns the MSMQQueueInfo.Journal property for it, which can be used to display the journaling level of the queue.

This function can return the journaling level of a local private queue from information stored on the local computer, but must retrieve information stored in the directory service to return the journaling level of a local or remote public queue. This function cannot be used to obtain the journaling level of a remote private queue.

For information on how Message Queuing uses the journaling level of the queue, see Target Journaling.

To retrieve MSMQQueueInfo.Journal

  1. Declare the objects needed to retrieve queue properties. This routine declares an MSMQQueueInfo object.

  2. Create the MSMQQueueInfo object. This example then uses MSMQQueueInfo.PathName to set the path name to the string passed to the function.

  3. Call MSMQQueueInfo.Refresh to obtain the current registered settings of the queue properties.

    ms701465.note(en-us,VS.85).gifNote
    This call retrieves the settings of all properties of the queue with the path name set. If no such queue exists, an error message is displayed.

  4. Return the local setting of MSMQQueueInfo.Journal.

Code Example

The following code example can be run on all versions of Message Queuing.

Function GetJournalLevel( _
                         strPathname As String _
                         ) As Long
  Dim qinfo As MSMQQueueInfo

  ' Create the MSMQQueueInfo object.
  Set qinfo = New MSMQQueueInfo
  qinfo.PathName = strPathname
  On Error GoTo ErrorHandler
  
  ' Retrieve the internally registered property values.
  qinfo.Refresh
  
  ' Return the local setting of MSMQQueueInfo.Journal.
  GetJournalLevel = qinfo.Journal
  Exit Function
  
ErrorHandler:
  MsgBox "Error " + Hex(Err.Number) + " was returned." _
          + Chr(13) + Err.Description
End Function
Show:
© 2015 Microsoft