Validate ComboBox Items

Hello.
I have a little problem in my win32 api program. I have a combobox with 4 items, item1, item2, item3, item4 and a textbox.
The validation is simple, but i know why it not works.
here is the validation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
case WM_COMMAND:
{
   	switch(LOWORD(wParam))
	{
         	case ONFILETEXT2:
		{
			if (ONFILETEXT2)
			{
				SetWindowText(FATCASTATUSBOX1, TEXT("Text1"));
				UpdateWindow(FATCASTATUSBOX1);
			}
			else
			{
				SetWindowText(FATCASTATUSBOX1, TEXT(""));
				UpdateWindow(FATCASTATUSBOX1);
			}
		}
        
	}
break;
}
return 0;



so, the combobox has 4 items:
1
2
3
4
SendMessage(ONFILECOMBOBOX, CB_ADDSTRING, ONFILETEXT1, (LPARAM) _T(""));
SendMessage(ONFILECOMBOBOX, CB_ADDSTRING, ONFILETEXT2, (LPARAM) _T("Text1"));
SendMessage(ONFILECOMBOBOX, CB_ADDSTRING, ONFILETEXT3, (LPARAM) _T("Text2"));
SendMessage(ONFILECOMBOBOX, CB_ADDSTRING, ONFILETEXT4, (LPARAM) _T("Text3"));


then, when i want to select Text1 from combobox, the second one, FATCASTATUSBOX1 will be replaced with the text i put to WM_COMMAND. actually i dont know how to append the second item. i mean the condition if from validation. what can i do ? thx

ps: sorry for my bad english.
Last edited on
anyone ? please?
You're not checking the actual notification code in your WM_COMMAND handler. When the selection changes in a combobox it generates a WM_COMMAND message with a CBN_SELCHANGE notification code.

CBN_SELCHANGE:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775821%28v=vs.85%29.aspx

Combobox reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775792%28v=vs.85%29.aspx
Topic archived. No new replies allowed.