Article ID: 169927 - View products that this article applies to.
This article was previously published under Q169927
This article has been archived. It is offered "as is" and will no longer be updated.
The sample code in this article, along with the description of the structures and functions used, provides a guide to retrieving a collection of SourceSafe items and getting the history for these items. The sample code is written in C++.
The SourceSafe Object Model contains 7 objects. The top-most of these objects is the VSSDatabase object. The first step in any SourceSafe OLE Automation client is to make a connection to a VSSDatabase pointer through the IClassFactory interface. This article assumes that there is already a pointer to the VSSDatabase object. For more information about getting a VSSDatabase pointer, please see the following Knowledge Base article:
169928There are several operations available from the VSSItem object that produce collections. The Items property returns a collection of all children associated with a VSSItem, this is useful for listing all the children of a SourceSafe Project. The Checkouts property returns a collection of all checkouts on a file in Sourcesafe.
(http://support.microsoft.com/kb/169928/EN-US/ )How To Open a SourceSafe Database with OLE Automation in C++
The method discussed in this article is the Versions method, which returns a collection of Version objects. These represent old versions, labels and other actions that have been applied to the file or project in SourceSafe during its lifetime.
Once you have a pointer to a valid IVSSItem, call the get_Versions method. get_Versions requires a long integer containing a number representing flag values, and a pointer to a pointer to an IVSSVersions object.
Call the _NewEnum method from pointer to IVSSVersions passing a pointer to an LPUNKNOWN. Then QueryInterface on the LPUNKNOWN for an IEnumVARIANT interface. The IEnumVARIANT Interface supports Next, Skip, and Reset methods. Using the Next Method within a while loop allows you to retrieve each version within the collection using the punkVal property to get a pointer to IUnknown.
MSDN Library: IClassFactory; IEnumVARIANT Interface; Visual SourceSafe OLE Automation
You can download the header file ssauto.h from the following Web site:
Contact us for more help
Connect with Answer Desk for expert help.