Hello all,
I new to Win32 programming with C++. I am trying to get a text box to accept integer or decimal numbers only. I was hoping there would some method like Tryparse to do this.
I am not using any MFC or windows forms. Pure C++ only.
I have the following code in place:
Code:
TR szText1 = new WCHAR[bufSize];
LPWSTR szText2 = new WCHAR[bufSize];
LPWSTR szText3 = new WCHAR[bufSize];
double num1, num2, num3;
GetWindowText(hwndThickness, szText1, bufSize);
GetWindowText(hwndTheta, szText2, bufSize);
GetWindowText(hwndTexheight, szText3, bufSize);
num1=_wtof(szText1);
num2=_wtof(szText2);
num3=_wtof(szText3);
if(_tcslen(szText1)==0 || _tcslen(szText2)==0 || _tcslen(szText3)==0)
{
MessageBox(hWnd, L"One or more input fields left blank", L"!!!!", MB_OK);
}
Thanks