Microsoft KB Archive/257989

= How To Pin and Unpin Files in SourceSafe from OLE Automation in Visual C++ =

Article ID: 257989

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual SourceSafe 5.0 Standard Edition
 * Microsoft Visual SourceSafe 6.0 Standard Edition

-



This article was previously published under Q257989



SUMMARY
The OLE Automation for Visual SourceSafe does not directly expose the pinning functionality. You can use the functions in the "More Information" section of this article to pin and unpin a file from a Visual C++ program.

NOTE: This sample code assumes that you reference the Visual SourceSafe OLE Automation by using this code:
 * 1) import "path to ssapi.dll" no_namespace



MORE INFORMATION
This function pins a file: int PinFile(IVSSItemPtr objItem, int version) {  // Pinning code IVSSItemPtr   objOldItem; IVSSItemPtr   objProject; CComVariant   varVer;

varVer = version;

objOldItem = objItem->GetVersion(varVer); objProject = objItem->GetParent;

objProject->Share(objOldItem, "", 0);

return 1; } This function unpins a file: int UnpinFile(IVSSItemPtr objItem) {  // Unpinning code IVSSItemPtr   objOldItem; IVSSItemPtr   objProject; CComVariant   varVer = 0;

objOldItem = objItem->GetVersion(varVer); objProject = objItem->GetParent;

objProject->Share(objOldItem, "", 0);

return 1; }

