Help Center

CRichEditCtx.OpenDocmethod

Opens a new document.

Windowsmethoddocumented

Syntax

FUNCTION OpenDoc (BYVAL pVar AS VARIANT PTR, BYVAL Flags AS LONG = 0, BYVAL CodePage AS LONG = CP_ACP) AS HRESULT

Parameters

NameDescription
pVarA VARIANT that specifies the name of the file to open.
FlagstomRTF: Open as RTF. tomText: Open as text ANSI or Unicode.
CodePageThe 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