Trying to get floats from a text field

Hi Im having trouble getting data in raw form out of a text field. I have the following line creating a text field in a window:

1
2
3
4
5
6
7
8
input1 = 
CreateWindow(TEXT("Edit"), 
NULL, 
WS_CHILD | WS_VISIBLE | WS_BORDER, 
20, 20, 85, 20,  
handle, 
(HMENU) findex_i1, 
NULL, NULL);


later, I have this code change the title text to whatever I type into that field:

1
2
3
	len=GetWindowTextLength(input1)+1;   						
	GetWindowText(input1, strbuffer, len);				        
	SetWindowText(handle, strbuffer);	


This is ultimately not what I want to do. I want to type floating point values into the text field then use them in some calculation and output a result. Simple. Problem is I cant seem to get what I type into the text field as a double or any other basic data type. The functions above return none of those and the variable "strbuffer" is an LPWSTR pointer defined as TCHAR strbuffer[30] so I cannot use it as a string to convert into a double.

How do I go about storing my text field input into a double as in:
double my_text_input = ~numbers I typed into the text field~


Thank you for your help!
Last edited on
Have you tried converting it with a stringstream?
Topic archived. No new replies allowed.