편집 제어의 상위 창 WndProc에서 EN_UPDATE를 잡고 커서 위치를 설정하면 "입력하는 동안 포인터 숨기기"를 피할 수 있습니다.
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}