Image

Imageallroy wrote in Imagecpp

Floating point and Edit box Win32 API

I'm using the Win32 C API so if this is the wrong place for this, just let me know.

I'm just wondering if there's a easier way of handling getting a floating point value from an edit box?

What I'm doing now:


int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT));
if(len > 0)
{
int i;
char* buf;
buf = (char*) GlobalAlloc(GPTR, len + 1);
GetDlgItemText(hwnd, IDC_TEXT, buf, len + 1);
// then do an atof on the contents of buf
GlobalFree((HANDLE)buf);
}





I know there's a GetDlgItemInt, but I didn't see one in the API documentation for float, am I missing something?
I'm just learning the Win32 API so be kind :)