WM_NEXTDLGCTL

Àμö

wParam : ´ÙÀ½ Æ÷Ä¿½º¸¦ ¿Å±æ ÄÁÆ®·ÑÀ» ÁöÁ¤ÇÑ´Ù. lParamÀÌ TRUEÀÏ °æ¿ì Æ÷Ä¿½º¸¦ ¹ÞÀ» ÄÁÆ®·ÑÀÇ Çڵ鰪À» ÁöÁ¤Çϸç lParamÀÌ FALSEÀÏ °æ¿ì ÀÌÀü, ¶Ç´Â ´ÙÀ½ ÄÁÆ®·ÑÀ» ÁöÁ¤ÇÑ´Ù. wParamÀÌ 0ÀÌ¸é ´ÙÀ½ ÄÁÆ®·Ñ·Î Æ÷Ä¿½º°¡ À̵¿µÇ¸ç 0ÀÌ¿ÜÀÇ °ªÀ̸é ÀÌÀü ÄÁÆ®·Ñ·Î Æ÷Ä¿½º¸¦ À̵¿ÇÑ´Ù. Æ÷Ä¿½º¸¦ ¹ÞÀ» ÄÁÆ®·ÑÀº WS_TABSTOP ½ºÅ¸ÀÏÀ» °¡Áö°í ÀÖ¾î¾ß ÇÑ´Ù.

lParam : Æ÷Ä¿½º¸¦ À̵¿½Ãų ¹æ¹ýÀ» ÁöÁ¤ÇÑ´Ù. ÀÌ °ªÀÌ TRUEÀ̸é wParamÀº Æ÷Ä¿½º¸¦ ¹ÞÀ» À©µµ¿ì ÇÚµéÀ» °¡¸®Å°¸ç FALSEÀ̸é wParam°ª¿¡ µû¶ó ÀÌÀü/´ÙÀ½ ÄÁÆ®·Ñ·Î Æ÷Ä¿½º¸¦ ¿Å±ä´Ù.

¼³¸í

´ëÈ­»óÀÚ ÄÁÆ®·ÑÀÇ Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù. ¾î¶² ÄÁÆ®·ÑÀÌ ´ÙÀ½ Æ÷Ä¿½º¸¦ ¹ÞÀ» °ÍÀΰ¡´Â wParam¿Í lParam°ª¿¡ µû¶ó ´Þ¶óÁø´Ù. ¸¸¾à Æ÷Ä¿½º¸¦ ¹ÞÀ» ÄÁÆ®·ÑÀÇ ÇÚµéÀ» ¾Ë°í ÀÖ´Ù¸é lParam¿¡ TRUE¸¦ ÁÖ°í wParam¿¡ ÄÁÆ®·ÑÀÇ Çڵ鰪À» Àü´ÞÇÏ¸é µÈ´Ù. ÇöÀç Æ÷Ä¿½º¸¦ °¡Áø ÄÁÆ®·ÑÀÇ ÀÌÀü ¶Ç´Â ´ÙÀ½ ÄÁÆ®·Ñ·Î À̵¿ÇÏ·Á¸é lParam¿¡ FALSE¸¦ ÁÖ°í wParamÀ¸·Î ÀÌÀü(0ÀÌ¿Ü) ¶Ç´Â ´ÙÀ½(0)À» ÁöÁ¤ÇÑ´Ù.

ÀÌ ¸Þ½ÃÁö´Â SetFocus·Î ´Ü¼øÈ÷ ÀÔ·Â Æ÷Ä¿½º¸¦ ¿Å±â´Â °Íº¸´Ù ÈξÀ ´õ ¸¹Àº ÀÏÀ» ÇÑ´Ù. »õ·Î Æ÷Ä¿½º¸¦ ¹ÞÀº ÄÁÆ®·ÑÀÌ µðÆúÆ® ¹öÆ°ÀÏ °æ¿ì °æ°è¼±À» µÎ²®°Ô ¹Ù²Ù°í ¿¡µðÆ® ÄÁÆ®·ÑÀ̸é ÅؽºÆ®¸¦ ¼±ÅÃÇØ ÁØ´Ù. ´Ù¸¥ ÀÛ¾÷À» ÇÏ´ø Áß¿¡ Æ÷Ä¿½º¸¦ º¯°æÇÏ°íÀÚ ÇÑ´Ù¸é SendMessage ÇÔ¼ö·Î ÀÌ ¸Þ½ÃÁö¸¦ º¸³»¼­´Â ¾ÈµÇ¸ç ¹Ýµå½Ã PostMessage ÇÔ¼ö·Î ¸Þ½ÃÁö¸¦ ºÙ¿©¾ß ÇÑ´Ù.

¸®ÅÏ

ÀÌ ¸Þ½ÃÁö¸¦ ó¸®ÇßÀ¸¸é 0À» ¸®ÅÏÇØ¾ß ÇÑ´Ù.

¿¹Á¦

¿¹Á¦ 1

´ÙÀ½ ¿¹Á¦´Â ÀÌ ¸Þ½ÃÁö·Î Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù. ¸¶¿ì½º ÁÂ¿ì ¹öÆ°À» ´©¸£¸é Æ÷Ä¿½º°¡ À̵¿µÈ´Ù.

#include 
#include "resource.h"

BOOL CALLBACK MainDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam);
HINSTANCE g_hInst;
HWND hDlgMain;

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance
	,LPSTR lpszCmdParam,int nCmdShow)
{
	g_hInst=hInstance;
	
	DialogBox(g_hInst, MAKEINTRESOURCE(IDD_DIALOG1), HWND_DESKTOP, MainDlgProc);
	
	return 0;
}

BOOL CALLBACK MainDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
	switch(iMessage) {
	case WM_INITDIALOG:
		hDlgMain = hDlg;
		return TRUE;
	case WM_LBUTTONDOWN:
		PostMessage(hDlg,WM_NEXTDLGCTL,0,(LPARAM)FALSE);
		return 0;
	case WM_RBUTTONDOWN:
		PostMessage(hDlg,WM_NEXTDLGCTL,(WPARAM)GetDlgItem(hDlg,IDC_BUTTON3),
			(LPARAM)TRUE);
		return 0;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			EndDialog(hDlg,IDOK);
			return TRUE;
		case IDCANCEL:
			EndDialog(hDlg,IDCANCEL);
			return TRUE;
		}
		return FALSE;
	}
	return FALSE;
}

¿ÞÂÊ ¹öÆ°À» ´©¸£¸é ÇöÀç Æ÷Ä¿½º¸¦ °¡Áø ÄÁÆ®·ÑÀÇ ´ÙÀ½ ÄÁÆ®·Ñ·Î Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù. ¿À¸¥ÂÊ ¹öÆ°À» ´©¸£¸é ¹«Á¶°Ç Button3À¸·Î Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù.

Ç÷§Æû

95ÀÌ»ó

ÂüÁ¶

 


written by http://www.winapi.co.kr