CorrectWritingEx 

2.0     

Sends text to the CorrectText dialog box to allow the user to edit text using the Japanese Data Input Window. (Japanese version only.)

INT CorrectWritingEx( HWND hwnd, LPSTR lpText, UINT cbText, LPCWX lpcwx )

Parameters

hwnd

Handle of the owner of the CorrectText dialog box or writing tool used to edit the text. This can be NULL.

lpText

Far pointer to a buffer containing text to correct. This is copied into the Data Input Window's edit control.  If lpText is NULL, a WM_GETTEXT message is sent to the text source window, specified by the hwndText member of lpcwx, or if lpcwx or its hwndText member is NULL, to hwnd.  On successful exit, a WM_SETTEXT message will be sent to that window with modified text.

cbText

Size of the lpText buffer. If the source of the text is an edit control constrained by EM_LIMITTEXT, cbText should reflect that size. If lpText is NULL, the cbText value will be used to limit text if it is greater than zero; otherwise, no limit is used and the returned text may be of arbitrary size.

lpcwx

Address of a CWX3BE5AK5 structure, or NULL. The structure is used to specify optional correction parameters; for a description of its members, see CWX. If this value is NULL, the following default assumptions are made:

    The text window is the same as the owner window hwnd.

    A default recognition context is used.

    The edit control style is a combination of ES_LEFT and ES_MULTILINE.

    All text is selected; the caption is "Edit Text".

    Most recently use values for context flags, keyboard, keyboard states, position, and size are used.

Return Value

If there is a programming or memory error, the negative value CWXR_ERROR is returned. Otherwise, one of the following nonnegative values is returned:

Constant

Description

CWXR_MODIFIED

User pressed the OK button.

CWXR_UNMODIFIED

User pressed the Cancel button, or closed the dialog, or pressed the OK button but did not make any changes to the text.

 

Comments

An application must be sure to initialize the CWX3BE5AK5 structure properly if it is used. In particular, the cbSize member must be set to sizeof(CWX), and the remaining fields (at least up to dwSel) are typically set to zero.

Example

The following example shows how to initialize and call CorrectWritingEx when a button is pressed in a dialog:

CWX cwx = { sizeof(CWX), 0, NULL, NULL, { 0}, 0L, 0L};

 

cwx.hwndText = GetDlgItem(hdlg, IDD_ETSL);     // dialog edit

cwx.dwEditStyle = GetWindowLong(cwx.hwndText, GWL_STYLE)

     | ES_PASSWORD;

cwx.dwSel = SendMessage(cwx.hwndText, EM_GETSEL, 0, 0);

_fstrcpy((LPSTR)cwx.szCaption, (LPSTR)"Enter your password:");

 

// we specify kbd and context, but use MRU placement

cwx.wApplyFlags = CWXA_KBD | CWXA_STATE | CWXA_CONTEXT;

 

// don't update most-recently used settings for this one-shot:

cwx.wApplyFlags |= CWXA_NOUPDATEMRU;

cwx.ixkb = CWXK_QWERTY;

cwx.rgState[CWXK_QWERTY-CWXK_FIRST] = CWXKS_HAN | CWXKS_ROMA;

cwx.dwFlags = CWX_NOTOOLTIPS | CWX_TOPMOST;    // no distractions

 

if (CorrectWritingEx(hdlg, NULL, 0, &cwx) != CWXR_MODIFIED)

     ErrBox(EB_WHOAREYOU);

// validate pwd in the text window etc...

 

See Also

CWX