none
Couple of Errors RRS feed

  • Question

  • I hope that for once that Microsoft may release something that isn't riddles with bugs, but it seems that will never happen...
    Now, onto errors...

    - Error "Object Required". Here's what I did. Using an MFC App project, I renamed the dialog IDD_OPTIONS to IDD_OPTIONS2 and renamed the class it was associated with COptionsDlg to COptionsDlg2. I created a new dialog, copied the IDD_OPTIONS contents to new dialog template. Renamed new template to IDD_OPTIONS. Got an error saying IDD_OPTIONS2 was already in use. Opened resource.h file and deleted IDD_OPTIONS define. Tried again and it works. Now try to assign it a class, COptionsDlg. I get an error saying "Object Required."
    - Unresolved symbol. I was simply building a project when suddenly when linking, it complained that it could not find the symbol fread_s. However, other secure functions (like strcpy_s) worked fine. Using the old, deprecated fread worked fine.
    - Can someone tell what the heck the studio does when trying to add a virtual function or message to a MFC class, when it simply errors you "Unable to add because parent class is ready only"? It was not even able to add normal functions either.
    - Then there's the mystery errors. I'm thinking the framework is messing up? In one project, DDE didn't work right. A textbox was bound to m_Name. But everytime DDE was called with UpdateData(TRUE), it remained empty even though the textbox was NOT empty.
    GetDlgItem(IDC_NAME)->GetWindowText() returned the correct string.
    - Mystery bug: When you typed something--anything--in a textbox, it would terminate the program. The bug did not happen when I used the debugger to track it. The strangeness was that it was affecting another dialog, which closed and thus the application terminated itself (as it was designed to do).
    - Now it seems there's another mystery bug. I have a textbox tied to a control variable m_ShortcutQuit. In a timer, the application would call GetFocus to get the focused control. However, in any of the four testboxes, the hwnd GetFocus()->m_hWnd would NOT match the hwnd in the control variables (
    GetFocus()->m_hWnd != m_ShortcutQuit.m_hWnd), EVEN though the textbox had the focus. The handles did not match.

    I use Visual Studio 2005 Professional. Any help is appreciated with any of these issues.
    Sunday, July 23, 2006 3:20 PM

Answers

  • Claiming that your problems are caused by VS2005 bugs is a pretty tall assertion, you'd actually have to proof it.  With code that reliable reproduces the bug on other workstations.

    All I can answer: don't use fread_s(), it is an internal overload for fread() to handle the case where size and count arguments are swapped.  You won't find it documented anywhere.  fread() is *not* deprecated.
    Monday, July 24, 2006 1:31 PM
    Moderator

All replies

  • Sure, but I'm not sure what I should supply. Source codes can be huge.
    Here's a snippet from the fread_s doesn't work. Does it help at all?

            while ( ! feof(fInput) )
            {
                nRead = (int)fread(strBuffer, /*sizeof(strBuffer),*/ 1, 1000, fInput);
                if (nRead < 1000) strBuffer[nRead] = '\0';
                nPosToWrite = 0;
                for (int i = 0; i < (int)strlen(strBuffer); i++)
                {
                    if (strBufferIdea == '<' && strBuffer[i + 1] == 'F' && strBuffer[i + 2] == 'I' && strBuffer[i + 3] == 'L' && strBuffer[i + 4] == 'E' && strBuffer[i + 5] == '>')
                    {
                        strBufferIdea = '\0';
                        fprintf(fOutput, "%s%s", strBuffer, vFiles[j]);
                        nPosToWrite = i + 6;
                        i++;
                    }
                }
                fputs( (char*)&strBuffer[nPosToWrite], fOutput );
            }

    Sunday, July 23, 2006 3:43 PM
  • Claiming that your problems are caused by VS2005 bugs is a pretty tall assertion, you'd actually have to proof it.  With code that reliable reproduces the bug on other workstations.

    All I can answer: don't use fread_s(), it is an internal overload for fread() to handle the case where size and count arguments are swapped.  You won't find it documented anywhere.  fread() is *not* deprecated.
    Monday, July 24, 2006 1:31 PM
    Moderator
  • If you say so. These are indeed bugs, or unpredicted behaviour, since they are not supposed to happen. Should the studio hinder me from adding overloads to a class with MFC? I think not.
    Monday, July 24, 2006 2:29 PM