¿øÇü |
HWND SetFocus(HWND hWnd); |
MFC ¿øÇü |
CWnd* CWnd::SetFocus( ); |
Àμö |
¢ºhWnd : Æ÷Ä¿½º¸¦ °¡Áú À©µµ¿ìÀÇ ÇÚµé. NULLÀÏ °æ¿ì ¸ðµç Å°º¸µå ÀÔ·ÂÀ» ¹«½ÃÇÑ´Ù. |
¸®ÅÏ |
ÀÌÀü¿¡ Æ÷Ä¿½º¸¦ °¡Áö°í ÀÖ´ø À©µµ¿ìÀÇ ÇÚµéÀ» ¸®ÅÏÇÑ´Ù. hWnd°¡ ¹«È¿ÇÑ À©µµ¿ì°Å³ª °°Àº ½º·¹µå¿¡ ÀÖ´Â À©µµ¿ì°¡ ¾Æ´Ò °æ¿ì ¸®ÅÏ°ªÀº NULLÀÌ µÈ´Ù. |
¼³¸í |
Æ÷Ä¿½º¶õ ÀÔ·Â ÃÐÁ¡À̸ç Æ÷Ä¿½º¸¦ °¡Áø À©µµ¿ì¿¡°Ô Å°º¸µå ¸Þ½ÃÁö°¡ Àü´ÞµÈ´Ù. Çѹø¿¡ ÇϳªÀÇ À©µµ¿ì¸¸ Æ÷Ä¿½º¸¦ °¡Áú ¼ö ÀÖÀ¸¸ç º¸Åë »ç¿ëÀÚ°¡ ÄÁÆ®·ÑÀ» ¼±ÅÃÇÔÀ¸·Î½á Æ÷Ä¿½º¸¦ À̵¿½ÃÅ°Áö¸¸ ÇÁ·Î±×·¥ÀÌ ÀÌ ÇÔ¼ö·Î Æ÷Ä¿½º¸¦ °Á¦·Î À̵¿½Ãų ¼öµµ ÀÖ´Ù. ÀÌ ÇÔ¼ö´Â hWnd À©µµ¿ì·Î Æ÷Ä¿½º¸¦ °Á¦·Î À̵¿½ÃÅ°´Âµ¥ ÀÌ À©µµ¿ì´Â ¹Ýµå½Ã °°Àº ½º·¹µå¿¡ ¼ÓÇØ ÀÖ¾î¾ß ÇÑ´Ù. Æ÷Ä¿½º¸¦ º¯°æÇϱâ Àü¿¡ ÀÌÀü¿¡ Æ÷Ä¿½º¸¦ °¡Áö°í ÀÖ´ø À©µµ¿ì·Î WM_KILLFOCUS ¸Þ½ÃÁö¸¦ º¸³»ÁÖ¸ç »õ·Î ½i¼¸¦ ¹Þ´Â À©µµ¿ì·Î WM_SETFOCUS ¸Þ½ÃÁö¸¦ º¸³»ÁØ´Ù. »õ·Î Æ÷Ä¿½º¸¦ ¹Þ´Â À©µµ¿ì¿Í ±× ºÎ¸ð À©µµ¿ì´Â È°¼ºÈµÈ´Ù. º¸Åë WM_CREATE¿¡¼ ¿øÇÏ´Â ÄÁÆ®·Ñ¿¡ Æ÷Ä¿½º¸¦ ¼³Á¤Çϱâ À§ÇØ ÀÌ ÇÔ¼ö¸¦ »ç¿ëÇÑ´Ù. ´ëÈ»óÀÚÀÇ °æ¿ì WM_INITDIALOG ¸Þ½ÃÁö¸¦ ¹Þ¾ÒÀ» ¶§ ÀÌ ÇÔ¼ö¸¦ È£ÃâÇÏ¿© Æ÷Ä¿½º¸¦ À̵¿½ÃÅ°´Âµ¥ ÀÌ °æ¿ì ¹Ýµå½Ã FALSE¸¦ ¸®ÅÏÇØ ÁÖ¾î¾ß ÇÑ´Ù. ´ÙÀ½ ¿¹Á¦´Â 4°³ÀÇ ÄÁÆ®·ÑÀ» »ý¼ºÇÏ°í ±× Áß ¿¡µðÆ® ÄÁÆ®·Ñ¿¡ Ãʱâ Æ÷Ä¿½º¸¦ ÁØ´Ù. HWND hB,hE,hL,hC; LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam) { switch(iMessage) { case WM_CREATE: hB=CreateWindow("button","¹öÆ°",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10,10,100,25,hWnd,(HMENU)0,g_hInst,NULL); hE=CreateWindow("edit",NULL,WS_CHILD | WS_VISIBLE | WS_BORDER, 120,10,200,25,hWnd,(HMENU)1,g_hInst,NULL); hL=CreateWindow("listbox",NULL,WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOTIFY,10,50,100,100,hWnd,(HMENU)2,g_hInst,NULL); hC=CreateWindow("combobox",NULL,WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, 120,50,100,200,hWnd,(HMENU)3,g_hInst,NULL); SetFocus(hE); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return(DefWindowProc(hWnd,iMessage,wParam,lParam)); } |
Âü°íÇÔ¼ö |
GetFocus : ÇöÀç Æ÷Ä¿½º¸¦ °¡Áø À©µµ¿ìÀÇ ÇÚµéÀ» Á¶»çÇØÁØ´Ù. |
Ç÷§Æû | 95ÀÌ»ó |
ÂüÁ¶ |
|
written by http://www.winapi.co.kr
|