다음을 통해 공유


IVsUIShellOpenDocument.SearchProjectsForRelativePath Method

Definition

Converts a relative path for a document to an absolute path that can be passed to OpenDocumentViaProject(String, Guid, IServiceProvider, IVsUIHierarchy, UInt32, IVsWindowFrame).

public:
 int SearchProjectsForRelativePath(System::UInt32 grfRPS, System::String ^ pszRelPath, cli::array <System::String ^> ^ pbstrAbsPath);
public:
 int SearchProjectsForRelativePath(unsigned int grfRPS, Platform::String ^ pszRelPath, Platform::Array <Platform::String ^> ^ pbstrAbsPath);
int SearchProjectsForRelativePath(unsigned int grfRPS, std::wstring const & pszRelPath, std::Array <std::wstring const &> const & pbstrAbsPath);
public int SearchProjectsForRelativePath (uint grfRPS, string pszRelPath, string[] pbstrAbsPath);
abstract member SearchProjectsForRelativePath : uint32 * string * string[] -> int
Public Function SearchProjectsForRelativePath (grfRPS As UInteger, pszRelPath As String, pbstrAbsPath As String()) As Integer

Parameters

grfRPS
UInt32

[in] Flags specifying how the search path should be resolved. For more information, see __VSRELPATHSEARCHFLAGS.

pszRelPath
String

[in] Relative path to the document. This might simply be the file name.

pbstrAbsPath
String[]

[out, retval] Full path name of the document. This is the same as the pszMkDocument string value.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIShellOpenDocument::SearchProjectsForRelativePath(  
   [in] VSRELPATHSEARCHFLAGS grfRPS,  
   [in] LPCOLESTR pszRelPath,  
   [out, retval] BSTR *pbstrAbsPath  
);  

This method uses two strategies:

  • Enumerates project items in all projects and compares pszRelPath to the pszMkDocument (or project path, if the RPS_MatchByProjectPath flag is specified) of the project item. The comparison is not case-sensitive. The value of pszRelPath can be a document name without a path or a document name with a partial path that matches a valid right-hand portion of the pszMkDocument (or project path). The active project is given first priority. This step can be skipped by setting the grfRPS parameter to a value of RPS_SkipEnumProjectItems.

  • Ask all globally registered IVsRelativePathResolver objects to resolve the path. This mechanism allows a project language service to resolve relative paths against non-project items (for example, if a project has the concept of an INCLUDE search path). Global IVsRelativePathResolver objects should register a service GUID (SID) as a sub-key under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\RelativePathResolvers key in the registry. QueryService is called for each registered service for the IVsRelativePathResolver interface. This step can be skipped by setting the grfRPS parameter equal to RPS_SkipGlobalResolvers.

If neither of the methods attempted results in a match, the function sets *pbstrAbsPath to null and returns S_FALSE.

Applies to