Question

So, hello everybody.

I've got MSVC6 installed on win2k on virtual machine, but executable is run under wine emulating winXP (weird eh?).

I have some code, that creates an array of EDIT fields:

        for (i=0; i<NDRIVES_MASK+1; i++) {
            hWndEdit_Nstep[i] = CreateWindowEx (NULL,
                "EDIT",
                "0",
                WS_CHILD|WS_VISIBLE|WS_BORDER,
                150, // x
                45+40*i,  // y
                75,  // w
                40,  // h
                hWnd,
                (HMENU)IDC_NSTEP_EDIT[i],
                GetModuleHandle(NULL),
                NULL);
            sprintf(str, "Число полушагов [%3d]", i);
        };

And I've got some other code part, that attempts to read data in those EDITs:

            for (i=0; i<NDRIVES_MASK+1; i++) {
                DriveN = i;
                printf("--- [DEBUG] - DriveN - %#x\n", DriveN);
                SendMessage(hWndEdit_Nstep[DriveN],
                          WM_GETTEXT,
                          (WPARAM)256,
                          (LPARAM)buftext);
                Nsteps = _wtoi(buftext);
                printf("--- [DEBUG] - Nsteps - %#x\n", Nsteps);
                wprintf(L"--- [DEBUG] - Nsteps - %s\n", buftext);
            }   // for (i, ndrives)

UPDATE:

buftext is declared as follows:

wchar_t buftext[256];

My question is - when I enter only one-digit decimal in any one or even in a couple of those EDITs those numbers a read and output correctly. But when I type in multiple-digit decimals - they're treat as zero. What this problem is about?

Thanks in advance. Sorry for my broken English.

Was it helpful?

Solution

You don't show the declaration of buftext, but I suspect that you typed it as a wide character buffer and used _wtoi when you intended to use atoi.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top