Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)
int QuerySaveFiles ( [InAttribute] uint rgfQuerySave, [InAttribute] int cFiles, [InAttribute] string rgpszMkDocuments, [InAttribute] uint rgrgf, [InAttribute] VSQEQS_FILE_ATTRIBUTE_DATA rgFileInfo, out uint pdwQSResult )
int QuerySaveFiles ( /** @attribute InAttribute() */ UInt32 rgfQuerySave, /** @attribute InAttribute() */ int cFiles, /** @attribute InAttribute() */ String rgpszMkDocuments, /** @attribute InAttribute() */ UInt32 rgrgf, /** @attribute InAttribute() */ VSQEQS_FILE_ATTRIBUTE_DATA rgFileInfo, /** @attribute OutAttribute() */ /** @ref */ UInt32 pdwQSResult )
[in] Flags are currently unused. The caller should always pass in the default null flag, which is zero.
[in] File count.
[in] Path to the file on the disk.
[in] Flags whose values are taken from theenumeration for valid file attributes. Default = 0.
[in] Values taken from the rgrgf is 0.structure containing information about the file attributes. Can be a null reference (Nothing in Visual Basic); is ignored if
[out] Pointer to a value taken from theenumeration.
Return ValueIf the method fails, it returns an error code. If it succeeds, it returns:
Save the file. The file should not be read-only at this point.
This method has not put up a Save As dialog box, but either it is quietly telling you to do so, or the user has been prompted and has selected Save As. If you are editing a conventional file, you are encouraged to callat this point.
The user was notified that the file is read-only and has elected either to not save or to cancel the operation. The choice depends on the/ methods .
If the editor is trying to save multiple files, you must know the batching state and the difference between no and cancel. Call themethod for each individual file. If the environment returns QSR_NoSave_UserCanceled or , then the save is canceled. If the environment returns , then that one file in the batch will not be saved, but you can continue to save the other files.
Proceed with save (QSR_SaveOK).
Do not save (QSR_NoSave_Continue).
Save as (QSR_ForceSaveAs).
Cancel Save (QSR_NoSave_UserCanceled or QSR_NoSave_Cancel).
HRESULT QuerySaveFiles( [in] VSQuerySaveFlags rgfQuerySave, [in] int cFiles, [in, size_is(cFiles)] const LPCOLESTR rgpszMkDocuments, [in, size_is(cFiles)] const VSQEQSFlags rgrgf, [in, size_is(cFiles)] const VSQEQS_FILE_ATTRIBUTE_DATA rgFileInfo, [out, retval] VSQuerySaveResult *pdwQSResult );
Before a project or editor saves a file, it must call this method or the QuerySaveFile method. For project files, these calls are automatically completed by the solution, which knows when to save a project file. Editors are responsible for making these calls unless the editor implementation ofuses the helper function method. If your editor implements IVsPersistDocData2 in this way, then the call to QuerySaveFile method or QuerySaveFiles is made for you.
Call this method before saving anything to disk. It will handle read-only and checked-in files in a uniform, shared way.
This method might need to issue a checkout command to ensure that the file is writable (for example, if the file was edited in memory). For a source control provider that provides for the “checkout local version” option, this is a safe operation. For a source control provider that does not, the checkout operation cannot be completed without data loss. In this case, Save As is the only option.