Saves the text of the specified document to a specified file. The file name is specified as a Unicode string. You can use this inline function or explicitly send the EE_SAVE_FILEW message.

Editor_SaveFileW( HWND hwnd, int iDoc, BOOL bReplace, LPWSTR szFileName );



Specifies the window handle of the view or frame of EmEditor.


Specifies the index of the target document. If -1 is specified, the currently active document will be targeted.


Specifies TRUE if the text will be saved as by a specified name; the file name EmEditor holds and the title shown on the EmEditor Window will be changed. Specifies FALSE if the copy of the text is saved; the file name EmEditor holds will not be changed.


Specifies a full path file name in bytes.

Return Values

If it is succeeded, the return value is nonzero. If it isn't succeeded, the return value is zero.


Supported on EmEditor Professional Version 5.00 or later.