[Win32API] Edit Control and EN_CHANGE help

mekkatorqu (226)
so I have this code which basically finds any "-" except in first place and adds endstring there, this works fine however when I use WM_SETTEXT it will place that thingy that shows u where u re typing (I have no idea how's it called lol :P) to the start, how do I set it to the end? example how it looks like in editcontrol after finding another "-":

1
2
3
|-5.5
//it should look like this
-5.5|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
case IDC_ARMOR:
				{
					if(HIWORD(wParam) == EN_CHANGE)
					{
						char armor[8];
						GetDlgItemText(hWnd, IDC_ARMOR, armor, sizeof(armor)/sizeof(char));
						for(int i = 1; i < strlen(armor); i++)
						{
							if((int)armor[i] == 45)
							{
								armor[i] = '\0';
								SendMessage(GetDlgItem(hWnd, IDC_ARMOR), WM_SETTEXT, NULL, (LPARAM)armor);
							}
						}
					}
					break;
				}
mekkatorqu (226)
anyone?
webJose (2947)
Use EM_SETSEL: http://msdn.microsoft.com/en-us/library/windows/desktop/bb761661(v=vs.85).aspx . Set both the start and end to the same value, which would be the end of the contained string.

BTW, it is called "caret".
mekkatorqu (226)
thanks!
Registered users can post here. Sign in or register to post.