TABによるフォーカス移動
実行環境:
Microsoft Visual Studio 2005
質問:
TABによるフォーカス移動が行えません。どのようにソースを変更すれば宜しいか教えてください。
以下ソース
//ウィンドウプロシージャ
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
HINSTANCE main_inst;
static HFONT main_hfont;
main_inst = (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE ) ;
static HWND hEdit1,hEdit2,hEdit3;
switch (msg) {
case WM_SETFOCUS:
SetFocus(hEdit1);
break;
case WM_COMMAND:
switch(LOWORD(wp)){
case ID_EDIT1:
if(wp == VK_TAB)
SetFocus(hEdit2);
break;
case ID_EDIT2:
if(wp == VK_TAB)
SetFocus(hEdit3);
break;
case ID_EDIT3:
if(wp == VK_TAB)
SetFocus(hEdit1);
break;
}
case WM_CREATE:
hEdit1 = CreateWindowEx( WS_EX_CLIENTEDGE, TEXT("EDIT"),NULL,WS_CHILD|ES_NUMBER|WS_VISIBLE|ES_AUTOHSCROLL, 106, 89, 158, 34, hWnd, (HMENU)ID_EDIT1, main_inst, NULL );
hEdit2 = CreateWindowEx( WS_EX_CLIENTEDGE, TEXT("EDIT"),NULL,WS_CHILD|ES_NUMBER|WS_VISIBLE|ES_NUMBER|ES_AUTOHSCROLL, 106, 143, 158, 34, hWnd, (HMENU)ID_EDIT2, main_inst, NULL );
hEdit3 = CreateWindowEx( WS_EX_CLIENTEDGE, TEXT("EDIT"),NULL,WS_CHILD|ES_NUMBER|WS_VISIBLE|ES_AUTOHSCROLL, 106, 198, 158, 34, hWnd, (HMENU)ID_EDIT3, main_inst, NULL );
CreateWindow( TEXT("BUTTON"),TEXT("起動"),WS_CHILD|WS_VISIBLE|BS_MULTILINE|BS_CENTER, 89, 301, 112, 40, hWnd, (HMENU)ID_BUTTON, main_inst, NULL );
main_hfont = CreateFont( -19, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH|FF_MODERN, TEXT("MS ゴシック") );
SendDlgItemMessage( hWnd, ID_EDIT1, WM_SETFONT, (WPARAM)main_hfont, MAKELPARAM(TRUE, 0) );
SendDlgItemMessage( hWnd, ID_EDIT2, WM_SETFONT, (WPARAM)main_hfont, MAKELPARAM(TRUE, 0) );
SendDlgItemMessage( hWnd, ID_EDIT3, WM_SETFONT, (WPARAM)main_hfont, MAKELPARAM(TRUE, 0) );
SendDlgItemMessage( hWnd, ID_BUTTON, WM_SETFONT, (WPARAM)main_hfont, MAKELPARAM(TRUE, 0) );
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, msg, wp, lp));
}
return 0;
}
補足
素早い回答ありがとうございました 調べてみます