共用方式為


IVsTrackProjectDocumentsEvents2.OnQueryAddFiles Method

Definition

This method notifies the client when a project has requested to add files.

public:
 int OnQueryAddFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, int cFiles, cli::array <System::String ^> ^ rgpszMkDocuments, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILEFLAGS> ^ rgFlags, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> ^ pSummaryResult, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> ^ rgResults);
public:
 int OnQueryAddFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, int cFiles, Platform::Array <Platform::String ^> ^ rgpszMkDocuments, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILEFLAGS> ^ rgFlags, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> ^ pSummaryResult, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> ^ rgResults);
int OnQueryAddFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject const & pProject, int cFiles, std::Array <std::wstring const &> const & rgpszMkDocuments, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILEFLAGS> const & rgFlags, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> const & pSummaryResult, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYADDFILERESULTS> const & rgResults);
public int OnQueryAddFiles (Microsoft.VisualStudio.Shell.Interop.IVsProject pProject, int cFiles, string[] rgpszMkDocuments, Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILEFLAGS[] rgFlags, Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILERESULTS[] pSummaryResult, Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILERESULTS[] rgResults);
abstract member OnQueryAddFiles : Microsoft.VisualStudio.Shell.Interop.IVsProject * int * string[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILEFLAGS[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILERESULTS[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYADDFILERESULTS[] -> int
Public Function OnQueryAddFiles (pProject As IVsProject, cFiles As Integer, rgpszMkDocuments As String(), rgFlags As VSQUERYADDFILEFLAGS(), pSummaryResult As VSQUERYADDFILERESULTS(), rgResults As VSQUERYADDFILERESULTS()) As Integer

Parameters

pProject
IVsProject

[in] Project requesting to add files.

cFiles
Int32

[in] Number of files to add.

rgpszMkDocuments
String[]

[in] Array of files to add to the project.

rgFlags
VSQUERYADDFILEFLAGS[]

[in] Array of flags associated with each file. For a list of rgFlags values, see VSQUERYADDFILEFLAGS.

pSummaryResult
VSQUERYADDFILERESULTS[]

[out] Summary result object. This object is a summation of the yes and no results for the array of files passed in rgpszMkDocuments. If the result for a single file in the array is no, then pSummaryResult is equal to VSQUERYADDFILERESULTS_AddNotOK; if the results for all files are yes, then pSummaryResult is equal to VSQUERYADDFILERESULTS_AddOK. For a list of pSummaryResult values, see VSQUERYADDFILERESULTS.

rgResults
VSQUERYADDFILERESULTS[]

[out] Array of results for each individual file. For a list of rgResults values, see VSQUERYADDFILERESULTS.

Returns

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

Remarks

COM Signature

From IVsTrackProjectDocumentsEvents2.idl

HRESULT IVsTrackProjectDocumentsEvents2::OnQueryAddFiles(  
   [in] IVsProject *pProject,  
   [in] int cFiles,  
   [in, size_is(cFiles)] const LPCOLESTR rgpszMkDocuments[],  
   [in, size_is(cFiles)] const VSQUERYADDFILEFLAGS rgFlags[],  
   [out] VSQUERYADDFILERESULTS *pSummaryResult,  
   [out, size_is(cFiles)] VSQUERYADDFILERESULTS rgResults[]  
);  

Use IVsTrackProjectDocumentEvents2.OnQueryAddFiles to indicate whether specified files can be added to the project. Only deny a query if allowing the operation would compromise your stable state. For example, source control denies add queries if a file being added conflicts with an existing file already under source control.

Applies to