┌──────────────────────────────────────────────────────────────────────┐ │Process a WM_QUERYCONVERTPOS message to allow a user to perform │ │SBCS-DBCS conversion at the spot where the cursor is located. │ └──────────────────────────────────────────────────────────────────────┘
The WM_QUERYCONVERTPOS message is sent to the window when the end user tries to enter DBCS conversion mode. The message is sent to verify whether it is allowed to enter the conversion mode, and query the position of the conversion window. The parameters and return value of the message are as follows:
param1
The default window procedure will assume the fixed-position conversion. The pre-defined window controls handle this message according to their characteristics. For instance, the Frame Control window procedure returns QCP_NOCONVERT. On the contrary, the Entry Field Control window procedure provides the on-the-spot conversion as default. Refer to "OS/2 Technical Library Presentation Manager Programming Reference vol.3" for the detail of the behavior of each control.
On-The-Spot conversion (Intermediate result) shows how the On-the-spot conversion is performed on a PM screen. A user inputs a word using its pronunciation into a small window opened at the current cursor position, window of which back ground color is black. An intermediate result of DBCS conversion is displayed at the small window each time the user pushes the conversion key.
Fixed-Position conversion (Intermediate result) shows the Fixed-Position conversion. See the intermediate result is shown at the bottom of the window, where we called the status line.
On both conversions, DBCS characters are put into the application window
after the user pushes the enter key (Conversion result). On - The - Spotconversion(
Intermediateresult )
Fixed-Position conversion (Intermediate result)
Conversion result
Allowing on-the-spot conversion (source: MISCEDIT.C) is a source code example
how the WM_QUERYCONVERTPOS message is to be treated.
Allowing on-the-spot conversion (source: MISCEDIT.C)
typedef struct CurPos
{
USHORT usCharNum; /* on which character... */
USHORT usLineNum; /* of which line ? */
POINTL ptlCursor; /* cursor position in pel */
LONG cx; /* cursor size */
LONG cy;
} CURPOS;
...
MRESULT EXPENTRY editorWinProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
static BOOL flSpot = FALSE; /* indicates if on-the-spot is performed */
...
switch( msg )
{
...
case WM_QUERYCONVERTPOS:
{
PRECTL pCurPos;
pCurPos = (PRECTL)PVOIDFROMMP(mp1);
if( flSpot == TRUE )
{
/* set on-the-spot conversion if the flag is on */
pCurPos->xLeft = curpos.ptlCursor.x;
pCurPos->yBottom = curpos.ptlCursor.y;
pCurPos->xRight = 0;
pCurPos->yTop = 0;
}
else
{
/* set fixed-position conversion if the flag is off */
pCurPos->xLeft = -1;
pCurPos->yBottom = -1;
pCurPos->xRight = 0;
pCurPos->yTop = 0;
}
return (MRESULT)QCP_CONVERT; /* allow conversion */
}
...