CRichEditCtx.OpenDocmethod
Opens a new document.
Syntax
FUNCTION OpenDoc (BYVAL pVar AS VARIANT PTR, BYVAL Flags AS LONG = 0, BYVAL CodePage AS LONG = CP_ACP) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
pVar | A VARIANT that specifies the name of the file to open. | |
Flags | tomRTF: Open as RTF. tomText: Open as text ANSI or Unicode. | |
CodePage | The code page to use for the file. Zero (the default value) means CP_ACP (ANSI code page) unless the file begins with a Unicode BOM &hfeff, in which case the file is considered to be Unicode. Note that code page 1200 is Unicode, CP_UTF8 is UTF-8. |
Return value
The return value can be an HRESULT value that corresponds to a system error or COM error code, including one of the following values.
Description
Opens a new document. If another document is open, this method saves any current changes and closes the current document before opening a new one.
Example
DIM dv AS DVARIANT = AfxGetExePath & $"\Test.rtf" pRichEdit.OpenDoc(dv)
Reference
- Defined in AfxNova/CRichEditCtx.inc:4221
- Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
- Topic: CRichEditCtx Class