Just jumped into c++ with win32 in Visual Studio 2012. I am experienced in C and C#, but my c++ is a little lacking. The win32 stuff just seems to take any hint of intuition and throw it into a volcano. So far it's been a pain.
Here is what I'm trying to do: 1) Extract text from a textbox "edit" control 2) Convert this text to an int 3) Form a string using a sprintf type formatter for a double-floating point number 4) Take the resulting string and display it in a different text box.
I've tried several different things I've found on the web, but they all come up short. This is the best I could do:
wchar_t buffer[30];
const wchar_t formatString[] = {'%','f','\0'}; //Yes I know this is awful, I don't know how to convert a string literal into a wchar_t array.
GetWindowText(txtFixedPtToFloatInputHandle, &buffer[0], 15);
//Convert to signed integer
fixedPtValue = _wtoi(&buffer[0]);
//get a float
floatVal = 12.50;
//Use formatter to create a string representation
swprintf(buffer, 30, &formatString[0], floatVal);
SetWindowText(txtFixedPtToFloatOutputHandle, buffer);
This is the closest I have come. It's nasty I know, but all other things I've found on the web fell short (LPWSTR, boost::, stdio.h). In this code, all of the buffers get loaded with the correct strings! The problem is that my program closes/exits when the function returns! Any help??