microsoft.public.pocketpc.developer: Re: How to resize SIP?
Now I can resize the with the function below, but I can't modify the
initial size of the board. And the SIP resize itelf ony after hide it
and showing again.
static IIMCallback* g_pIMCallback;
.
.
.
.
void changeBoardSize (HWND hwnd) {
IMINFO iminfo;
RECT rt, rtCliens, re;
BeginPaint(hwnd, &ps);
GetWindowRect(hwnd, &rtCliens);
rt.left=rtCliens.left;
rt.top=rtCliens.bottom-board[actboard][0];
rt.right=rtCliens.right;
rt.bottom=rtCliens.bottom;
iminfo.rcSipRect=rt;
g_pIMCallback->SetImInfo(&iminfo);
EndPaint(hwnd, &ps);
InvalidateRect(hwnd, &rt, true);
drawboard(actboard, hwnd);
UpdateWindow(hwnd);
}
The initial size informations are in this function I think. But I can
enter everything for the height, the initial size don't change.
STDMETHODIMP CInputMethod::GetInfo( IMINFO *pimi )
{
HBITMAP hbm;
if( !g_hImagelistWide )
{
g_hImagelistWide = ImageList_Create(
32,
16,
ILC_COLOR | ILC_MASK,
1,
1 );
g_hImagelistNarrow = ImageList_Create(
16,
16,
ILC_COLOR | ILC_MASK,
1,
1 );
if( hbm = LoadBitmap( g_hInstDll, MAKEINTRESOURCE(IDB_WIDE1) ) )
{
ImageList_AddMasked( g_hImagelistWide, hbm, RGB(192,192,192) );
DeleteObject( hbm );
}
if( hbm = LoadBitmap( g_hInstDll, MAKEINTRESOURCE(IDB_NARROW1) ) )
{
ImageList_AddMasked( g_hImagelistNarrow, hbm,
RGB(192,192,192) );
DeleteObject( hbm );
}
}
pimi->fdwFlags = SIPF_DOCKED;
pimi->hImageNarrow = (HANDLE)g_hImagelistNarrow;
pimi->hImageWide = (HANDLE)g_hImagelistWide;
pimi->iNarrow = pimi->iWide = 0;
pimi->rcSipRect.left = 0;
pimi->rcSipRect.top = 0;
pimi->rcSipRect.right = 240,
pimi->rcSipRect.bottom = 80;
return NOERROR;
}
I know, I must to use any of the functions in the help:
\Microsoft Windows CE\API referene\Input Panel\Interfaces\
But I could not realize connection beetwen the help and beetween the
sample program.
Additional info from the readme.txt:
1. The system calls the dll containing the code for the custom SIP
mechanism, which implements the IInputMethod interface.
2. The Select method is called to create the input window using the
Dvorak keyboard bitmap.
3. The system calls GetInfo to get information in an IMINFO structure
about the size and other aspects of the input context.
4. The system calls ReceiveSipInfo to inform the input method of size,
placement information. It should react to this call by resizing itself
appropriately.
5. Finally, RegisterCallback is called to give the input method a
pointer to a IMCallBack interface. This interface is used to return
keystrokes to applications.
6. When the user taps a key on the keyboard, the input method recognizes
the mouse event location on its keyboard bitmap. It scans the bitmap
horizontally and vertically to place the tap inside a particular key.
7. A large array on constants is maintained defining the value of each
key on the keyboard and its pixel location so this scanning mechanism
can be accomplished.
8. The keystroke is processed and various flags are checked such as CAPS
lock, shift, etc. Once the proper keystroke has been determined, it is
returned to the application using the IICallBack:SendCharEvents method.
IICallBack: SendVirtualKey is used if the virtual key code is desired
(an example could be when the windows key was pressed if such a key
exists on the keyboard). Virtual key codes are defined in Windows CE
help.
9. The state of the keyboard is updated as the key is no longer pressed.
Code must be careful to check for sticky keys such as CAPS in this
situation.