This documentation is archived and is not being maintained.

IVsSccManager2.GetSccGlyph Method

This method is called by projects to discover the source control glyphs to use on files and the files' source control status; this is the only way to get status.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int GetSccGlyph(
	int cFiles,
	string[] rgpszFullPaths,
	VsStateIcon[] rgsiGlyphs,
	uint[] rgdwSccStatus


Type: System.Int32
[in] Count of files. It should be greater than 0 if there are files under source code control. Currently, the environment supports only a count of 1.
Type: System.String[]
[in] Array of paths to files; cannot be null.
Type: Microsoft.VisualStudio.Shell.Interop.VsStateIcon[]
[out] Array of icons corresponding to rgpszFullPaths; cannot be null. See VsStateIcon for additional information.
Type: System.UInt32[]
[out] Specifies status for corresponding rgpszFullPaths entry. For a list of possible values, see File Status Code Enumerator. This parameter can be null.

Return Value

Type: System.Int32
The method returns S_OK if at least one of the files is controlled, S_FALSE if none is controlled.

COM Signature

From ivssccmanager2.idl

HRESULT GetSccGlyph(
   [in] int cFiles,
   [in, size_is(cFiles)] const LPCOLESTR rgpszFullPaths[],
   [out, size_is(cFiles)] VsStateIcon rgsiGlyphs[],
   [out, size_is(cFiles)] DWORD rgdwSccStatus[]

This method is called by projects to discover the source control glyphs to use on files. When a project first opens at startup, it calls this method to get the glyphs for the project. After startup, the environment provides glyphs to the project using SccGlyphChanged. The glyphs are denoted by the environment's icon index (VsStateIcon enumeration).

How This Method is Used by Projects

The source control status per file is also optionally returned; however, projects are encouraged to use the glyphs, but not to cache source control status. Call this method each time status is needed, rather than maintaining your own record of status bits.

When the project receives the GetProperty method (VSHPROPID_StateIconIndex) call from the environment, it should call GetSccGlyph for the appropriate file or files for the VSITEMID specified in that call. The project does not need to store the returned state icon—the environment will store it. It is important to note that a project is allowed to call GetSccGlyph when called by the environment with GetProperty, but when it is called by SccGlyphChanged, the project is handed the glyphs and does not need to call GetSccGlyph again. The project can immediately pass the given glyphs to the environment using the SetProperty method, unless the parameters to SccGlyphChanged are null. In this case, the project should call the environment for all of the VSITEMID s in the project.

Be aware of the following:

  • If a file is under source control, the SCC_STATUS_CONTROLLED flag is set.

  • If the current user checks out a file into the designated working directory, the SCC_STATUS_CHECKEDOUT flag is set.