移动窗口时发生堆栈溢出(C ++,winapi)

时间:2014-12-16 18:09:38

标签: c++ winapi visual-studio-2012

所以我有一个相当大的程序,并且一个新的错误已经开始出现,我似乎无法追踪 - 并且撤消我记得最近所做的改变并没有被证明是富有成效的。下面的所有代码实际上都是从程序开始的 - 但仍未改变。至少可以说,我很困惑。 ; _;

如果它有助于诊断;我使用的是Visual Studio 2012 Express和OpenCV API。

因此,我可以通过两种方式始终获得错误:

  1. 尝试通过标题栏抓取窗口并移动
  2. 尝试"隐藏"与任何选项交互后的选项窗口(即使只是单击文本框 - 无需实际更改/输入任何内容)。

    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
            case IDOK:
                SendMessage(g_hOptions, WM_COMMAND, IDAPPLY, NULL);
                ShowWindow(g_hOptions, SW_HIDE); //Causes the issue
            break;
            case IDAPPLY:
                //Never Crashes Program
            break;
            case IDCANCEL:
                SendMessage(cboDotColors, CB_SETCURSEL, currentDot, 0);
                SendMessage(cboBackgroundColors, CB_SETCURSEL, currentBG, 0);
                SendMessage(cboCentralColors, CB_SETCURSEL, currentCen, 0);
                SendMessage(cboCornerColor, CB_SETCURSEL, currentCC, 0);
                SendMessage(cboSaveShots, CB_SETCURSEL, currentSS, 0);
                SendMessage(cboDebugMode, CB_SETCURSEL, currentDM, 0);
                SendMessage(cboTextOutput, CB_SETCURSEL, currentTO, 0);
                SendMessage(cboLighting, CB_SETCURSEL, lightingCondition, 0);
                SetDlgItemText(g_hOptions, IDD_MINSIZE_ETB, const_cast<char *>(to_string(minPixelCount).c_str()));
                SetDlgItemText(g_hOptions, IDD_MAXSIZE_ETB, const_cast<char *>(to_string(maxPixelCount).c_str()));
                SetDlgItemText(g_hOptions, IDD_VISUALTHRESH_ETB, const_cast<char *>(to_string(visualThreshold).c_str()));
                SetDlgItemText(g_hOptions, IDD_ALIGNMENTTHRESH_ETB, const_cast<char *>(to_string(alignmentThreshold).c_str()));
                SetDlgItemText(g_hOptions, IDD_DELAY_MULTIPLIER_ETB, const_cast<char *>(to_string(endDelayMultiplier).c_str()));
                SetDlgItemText(g_hOptions, IDD_DELAY_DIVISOR_ETB, const_cast<char *>(to_string(endDelayDivisor).c_str()));
                SetDlgItemText(g_hOptions, IDD_PICTURE_DELAY_ETB, const_cast<char *>(to_string(pictureWait).c_str()));
                ShowWindow(g_hOptions, SW_HIDE);
        {
    
  3. (以上情况有些截然不同,因为其他事情似乎并没有与此问题相互作用/导致问题。)

    触发它的事情:显示选项窗口,移动选项窗口,更改选项窗口,应用这些更改,将焦点从/返回到程序,使用程序执行它的正常功能,并让它在那里无所事事。

    所以这是从Visual Studio弹出的实际错误:

      

    ProjectNameHere.exe中0x01447FB7处的未处理异常:0xC00000FD:堆栈溢出(参数:0x00000000,0x03332000)。

    第一个和最后一个数字可能会有所不同。 如果我点击'#34;继续&#34;它转向另一个错误:

      

    ProjectNameHere.exe中0x01447FB7处的未处理异常:0xC0000005:访问冲突读取位置0x03330000。

    这里的数字相同 - 它们在两个错误之间保持一致。 如果我继续尝试推动它,那第二个错误就不会进一步改变 - 只是重复一遍。

    崩溃时运行的线程总是:[10 ###] msvcr110d.dll!_threadstartex 当我看到&#34; Call Stack&#34;在VS中,我实际写的最近执行的行是&#34;返回DefWindowProc(hwnd,msg,wParam,lParam);&#34;

    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        switch(msg)
        {
            case WM_CREATE:
                g_hOptions = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS), hwnd, OptionsDlgProc);
                g_hbmBoard = ConvertIplImageToHBITMAP(targetBoardImg);
                g_hbmGreenLight = ConvertIplImageToHBITMAP(GreenLightOff);
                g_hbmWorkingLight = ConvertIplImageToHBITMAP(GreenLightOff);
                g_hbmWorkingIndicator = ConvertIplImageToHBITMAP(WorkingIndicatorNull);
                if(g_hbmBoard == NULL)
                {
                    setExitError(1001);
                    MessageBox(hwnd, "Could not load target board!", "Error", MB_OK | MB_ICONEXCLAMATION);
                }
                hDataBox = CreateWindowEx(WS_EX_STATICEDGE, TEXT("EDIT"), TEXT(""),
                    WS_CHILD | WS_VISIBLE | ES_READONLY | WS_BORDER |
                    ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL,
                    screenResW - 349, 100, 315, 470,
                    hwnd, (HMENU)NULL, NULL, NULL );
                CreateWindow(TEXT("Button"), TEXT("Load and Process"),
                    WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
                    screenResW - 349, 35, 315, 50,
                    hwnd, (HMENU) ID_START_STOP, NULL, NULL );
                CreateWindow(TEXT("Button"), TEXT("Clear Processing"),
                    WS_VISIBLE | WS_CHILD,
                    screenResW - 349, 585, 155, 35,
                    hwnd, (HMENU) ID_BUTTON_CLEARPROCESSING, NULL, NULL );
                CreateWindow(TEXT("Button"), TEXT("Save Data"),
                    WS_VISIBLE | WS_CHILD,
                    screenResW - 349, 630, 155, 35,
                    hwnd, (HMENU) ID_FILE_SAVE, NULL, NULL );
                CreateWindow(TEXT("Button"), TEXT("Clear Data"),
                    WS_VISIBLE | WS_CHILD,
                    screenResW - 189, 585, 155, 35,
                    hwnd, (HMENU) ID_FILE_CLEAR, NULL, NULL );
                CreateWindow(TEXT("Button"), TEXT("Quit"),
                    WS_VISIBLE | WS_CHILD,
                    screenResW - 189, 630, 155, 35,
                    hwnd, (HMENU) ID_FILE_EXIT, NULL, NULL );
            break;
            case WM_PAINT:
                g_hbmBoard = ConvertIplImageToHBITMAP(targetBoardImg);
                BITMAP bm;
                PAINTSTRUCT ps;
                HDC hdc = BeginPaint(hwnd, &ps);
                HDC hdcMem = CreateCompatibleDC(hdc);
    
                HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBoard);
                GetObject(g_hbmBoard, sizeof(bm), &bm);
                BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
    
                hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmGreenLight);
                GetObject(g_hbmGreenLight, sizeof(bm), &bm);
                BitBlt(hdc, screenResW - 59, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
    
                hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmWorkingLight);
                GetObject(g_hbmWorkingLight, sizeof(bm), &bm);
                BitBlt(hdc, screenResW - 94, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
    
                hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmWorkingIndicator);
                GetObject(g_hbmWorkingIndicator, sizeof(bm), &bm);
                BitBlt(hdc, screenResW - 129, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
    
                SelectObject(hdcMem, hbmOld);
                DeleteDC(hdcMem);
    
                EndPaint(hwnd, &ps);
            break;
            case WM_COMMAND:
                if(HIWORD(wParam) == BN_CLICKED)
                {
                    switch(LOWORD(wParam))
                    {
                        //case ID_BUTTON_CAMVIEW:
                            //{
                                //if(!camviewOn)
                                //{thread (displayCameraView).detach();}
                            //}
                        break; // Whoops! Not that this should affect anything...
                        case ID_FILE_SAVE:
                        {
                            if(textBoxCoords != "")
                            {
                                OPENFILENAME ofn;
                                WCHAR savefile[MAX_PATH+1] = L"";
                                ZeroMemory(&ofn, sizeof(ofn));
                                ofn.lStructSize = sizeof(ofn); 
                                ofn.hwndOwner = hwnd;
                                ofn.lpstrFilter = (LPCSTR)"Text(*.txt)\0*.txt\0All Files(*.*)\0*.*\0";
                                ofn.lpstrFile = (LPSTR)savefile;
                                ofn.nMaxFile = MAX_PATH;
                                ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
                                ofn.lpstrDefExt = (LPCSTR)"txt";
                                if(textOutput){cout << "Choosing save file...\n";}
                                if(GetSaveFileName(&ofn))
                                {
                                    ifstream checkFile;
                                    checkFile.open(ofn.lpstrFile);
                                    if(checkFile.good())
                                    {
                                        checkFile.close();
                                        if(textOutput){cout << "File exists.\n";}
                                        if(MessageBox(hwnd, "File exists. Overwrite?", "Overwrite?", MB_ICONEXCLAMATION | MB_YESNO) == IDYES)
                                        {
                                            ofstream outputFile;
                                            outputFile.open ((ofn.lpstrFile), fstream::in | fstream::out | fstream::trunc);
                                            if(outputFile.is_open())
                                            {
                                                outputFile << textBoxCoords;
                                                outputFile.close();
                                                if(textOutput){cout << "File overwritten.\n";}
                                            }
                                            else
                                            {
                                                if(textOutput){cout << "File failed to open.\n";}
                                                MessageBox(hwnd, "File could not be saved.", "Error!",
                                                    MB_ICONEXCLAMATION | MB_OK);
                                                outputFile.close(); // Just in case.
                                            }
                                        }
                                        else
                                        {
                                            if(textOutput){cout << "File not overwritten.\n";}
                                        }
                                    }
                                    else
                                    {
                                        checkFile.close();
                                        ofstream outputFile;
                                        outputFile.open ((ofn.lpstrFile), fstream::in | fstream::out | fstream::trunc);
                                        if(outputFile.is_open())
                                        {
                                            outputFile << textBoxCoords;
                                            outputFile.close();
                                            if(textOutput){cout << "File Saved.\n";}
                                        }
                                        else
                                        {
                                            if(textOutput){cout << "File failed to open.\n";}
                                            MessageBox(hwnd, "File could not be saved.", "Error!",
                                                MB_ICONEXCLAMATION | MB_OK);
                                            outputFile.close(); // Just in case.
                                        }
                                    }
                                }
                                else
                                {if(textOutput){cout << "File save canceled.\n";}}
                            }
                            else
                            {MessageBox(hwnd, "Nothing to save.", "Error!", MB_ICONEXCLAMATION | MB_OK);}
                        }
                        break;
                        case ID_FILE_LOAD:
                        {
                            OPENFILENAME ofn;
                            WCHAR loadfile[MAX_PATH+1] = L"";
                            ZeroMemory(&ofn, sizeof(ofn));
                            ofn.lStructSize = sizeof(ofn); 
                            ofn.hwndOwner = hwnd;
                            ofn.lpstrFilter = (LPCSTR)"Text(*.txt)\0*.txt\0All Files(*.*)\0*.*\0";
                            ofn.lpstrFile = (LPSTR)loadfile;
                            ofn.nMaxFile = MAX_PATH;
                            ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
                            ofn.lpstrDefExt = (LPCSTR)"txt";
                            if(textOutput){cout << "Choosing load file...\n";}
                            if(GetOpenFileName(&ofn))
                            {
                                ifstream inputFile;
                                inputFile.open(ofn.lpstrFile);
                                if (inputFile.is_open())
                                {
                                    if(textBoxCoords == "" || MessageBox(hwnd, "Loading a file will clear all current datapoints. Unsaved data will be lost. Are you sure you want to proceed?",
                                        "Barrel full of monkeys?", MB_ICONEXCLAMATION | MB_YESNO) == IDYES)
                                    {
                                        textBoxCoords = "";
                                        inputFile.seekg(0, std::ios::end);
                                        textBoxCoords.reserve(inputFile.tellg());
                                        inputFile.seekg(0, std::ios::beg);
                                        textBoxCoords.assign((std::istreambuf_iterator<char>(inputFile)), std::istreambuf_iterator<char>());
                                        refreshTargetBoard();
                                        if(textOutput){cout << "Data loaded.\n";}
                                        inputFile.close();
                                    }
                                }
                                else
                                {
                                    if(textOutput){cout << "File does not exist or cannot  be read.\n";}
                                        MessageBox(hwnd, "File could not be opened.", "Error!",
                                            MB_ICONEXCLAMATION | MB_OK);
                                }
                            }
                            else
                            {if(textOutput){cout << "File load canceled.\n";}}
                        }
                        break;
                        case ID_BUTTON_RESETERRORS:
                        {
                            exitCode = 0;
                            g_hbmGreenLight = ConvertIplImageToHBITMAP(GreenLightOff);
                            program_ON = false;
                            char Starp[6];
                            sprintf(Starp, "Start");
                            SetDlgItemTextA(hwnd, ID_START_STOP, (LPCSTR)Starp);
                            updateMainWindow();
                            clickPoint[0].X = -1; clickPoint[0].Y = -1;
                            clickPoint[1].X = -1; clickPoint[1].Y = -1;
                            clickPoint[2].X = -1; clickPoint[2].Y = -1;
                            clickPoint[3].X = -1; clickPoint[3].Y = -1;
                            done = true;
                        }
                        break;
                        case ID_BUTTON_CLEARPROCESSING:
                        {
                            //Not written yet.
                        }
                        break;
                        case ID_FILE_CLEAR:
                        {
                            if(textBoxCoords == "" || MessageBox(hwnd, "All unsaved data will be lost.\r\nAre you sure you wish to proceed?", "Make data go \"Bye-Bye\"?", MB_ICONEXCLAMATION | MB_YESNO) == IDYES)
                            {
                                textBoxCoords = "";
                                refreshTargetBoard();
                                if(textOutput){cout << "Data cleared.\n";}
                            }
                        }
                        break;
                        case ID_FILE_OPTIONS:
                        {
                            if(g_hOptions != NULL)
                            {ShowWindow(g_hOptions, SW_SHOW);}//AnimateWindow(g_hOptions, 200, AW_ACTIVATE);}
                            else
                            {MessageBox(hwnd, "Options window failed to be created", "Warning!", MB_OK | MB_ICONINFORMATION);}
                        }
                        break;
                        case ID_FILE_CALIBRATE:
                        {if(textOutput){cout << "Calibration window not yet available.\n";}}
                        break;
                        case ID_FILE_EXIT:
                        {exitProg = true; done = true; Sleep(30); PostMessage(hwnd, WM_CLOSE, 0, 0);}
                        break;
                        case ID_HELP_INST:
                        {if(textOutput){cout << "Instructions window not yet available.\n";}} // TODO
                        break;
                        case ID_HELP_ABOUT:
                        {if(textOutput){cout << "About window not yet available.\n";}} // TODO
                        break;
                        case ID_LOAD_PROCESS:
                        {
                            if(exitCode == 0)
                            {
                                done = false;
                                if(!program_ON)
                                {
                                    program_ON = true;
                                    thread (pointProc).detach();
                                    thread (workingIndicatorFunction).detach();
                                }
                            }
                        }
                        break;
                        case ID_START_STOP:
                        {
                            if(exitCode == 0)
                            {
                                if(!program_ON)
                                {
                                    g_hbmGreenLight = ConvertIplImageToHBITMAP(GreenLightOn);
                                    program_ON = true;
                                    char Starp[5];
                                    sprintf(Starp, "Stop");
                                    SetDlgItemTextA(hwnd, ID_START_STOP, (LPCSTR)Starp);
                                    updateMainWindow();
                                    done = false;
                                    thread (pointProc).detach();
                                    thread (workingIndicatorFunction).detach();
                                    if(true) // Part of functionality that was changed earlier.
                                    {
                                        const int MAX_SHOTFILE_LINES = 512;
                                        IplImage* imgB4;
                                        IplImage* imgAR;
                                        Mat TempB4;
                                        Mat TempAR;
                                        ifstream shotFile;
                                        shotFile.open("Input Pictures/ShotFile.txt");
                                        if(shotFile.good())
                                        {
                                            char shotFileLine[MAX_SHOTFILE_LINES][512] = {};
                                            int countUp = 0;
                                            string lineGot = "";
                                            while(!shotFile.eof() && countUp < MAX_SHOTFILE_LINES)
                                            {
                                                std::getline(shotFile, lineGot);
                                                int lineGotSize = lineGot.size();
                                                for(int i = 0; i < lineGotSize; i++)
                                                {shotFileLine[countUp][i] = lineGot.at(i);}
                                                countUp++;
                                            }
                                            for(int i = 0; i < countUp; i++)
                                            {
                                                if(isalnum(shotFileLine[i][0]))
                                                {
                                                    string filenames[2];
                                                    int fileCoords[8];
    
                                                    int numSearch = 0;
                                                    int numCheck = 0;
                                                    int totalShotFileWords = 0;
    
                                                    string shotFileLineStr(shotFileLine[i]);
    
                                                    for(;numSearch < 512;numSearch++)
                                                    {
                                                        if(shotFileLine[i][numSearch] == ' ' || shotFileLine[i][numSearch] == NULL)
                                                        {
                                                            if(totalShotFileWords < 2)
                                                            {
                                                                filenames[totalShotFileWords] = "Input Pictures/" + shotFileLineStr.substr(numCheck, (1+numSearch-numCheck));
                                                            }
                                                            else if(totalShotFileWords < 10)
                                                            {
                                                                for(int count = numCheck; count < numSearch; count++)
                                                                {if(!isdigit(shotFileLine[i][count])){goto malformed_coords;}}
                                                                istringstream(shotFileLineStr.substr(numCheck, (1+numSearch-numCheck))) >> fileCoords[totalShotFileWords-2];
                                                            }
                                                            numCheck = numSearch+1;
                                                            totalShotFileWords++;
                                                        }
                                                        if(shotFileLine[i][numSearch] == NULL){break;}
                                                    }
                                                    malformed_coords:
                                                    if(totalShotFileWords < 2) // Not enough filenames
                                                    {/*\Nothing Happens\*/}
                                                    else if(totalShotFileWords < 10) // Not enough coords
                                                    {
                                                        imgB4 = cvLoadImage( filenames[0].c_str(), 1);
                                                        if(imgB4 != NULL)
                                                        {
                                                            TempB4 = imgB4;
                                                            imgAR = cvLoadImage( filenames[1].c_str(), 1);
                                                            if (imgAR != NULL)
                                                            {
                                                                TempAR = imgAR;
                                                                Mat TestshotB4 = TempB4*1;
                                                                Mat TestshotAR = TempAR*1;
                                                                falsePics(TestshotB4, TestshotAR, ++audioCount);
                                                                cvReleaseImage(&imgB4);
                                                                cvReleaseImage(&imgAR);
                                                                delete imgB4;
                                                                delete imgAR;
                                                            }
                                                        }
                                                    }
                                                    else // Got everything
                                                    {
                                                        imgB4 = cvLoadImage( filenames[0].c_str(), 1);
                                                        if(imgB4 != NULL)
                                                        {
                                                            TempB4 = imgB4;
                                                            imgAR = cvLoadImage( filenames[1].c_str(), 1);
                                                            if (imgAR != NULL)
                                                            {
                                                                TempAR = imgAR;
                                                                Mat TestshotB4 = TempB4*1;
                                                                Mat TestshotAR = TempAR*1;
                                                                coords testShotCyanCoordsA, testShotCyanCoordsB, testShotCyanCoordsC, testShotCyanCoordsD;
                                                                testShotCyanCoordsA.X = fileCoords[0]; testShotCyanCoordsA.Y = fileCoords[1];
                                                                testShotCyanCoordsB.X = fileCoords[2]; testShotCyanCoordsB.Y = fileCoords[3];
                                                                testShotCyanCoordsC.X = fileCoords[4]; testShotCyanCoordsC.Y = fileCoords[5];
                                                                testShotCyanCoordsD.X = fileCoords[6]; testShotCyanCoordsD.Y = fileCoords[7];
                                                                falsePics(TestshotB4, TestshotAR, ++audioCount, testShotCyanCoordsA, testShotCyanCoordsB, testShotCyanCoordsC, testShotCyanCoordsD);
                                                                cvReleaseImage(&imgB4);
                                                                cvReleaseImage(&imgAR);
                                                                delete imgB4;
                                                                delete imgAR;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        shotFile.close();
                                    }
                                }
                                else
                                {
                                    g_hbmGreenLight = ConvertIplImageToHBITMAP(GreenLightOff);
                                    program_ON = false;
                                    char Starp[20];
                                    sprintf(Starp, "Load and Process");
                                    SetDlgItemTextA(hwnd, ID_START_STOP, (LPCSTR)Starp);
                                    updateMainWindow();
                                    done = true;
                                }
                            }
                        }
                        break;
                    }
                }
                        break;
            case WM_CLOSE:
            {
                if(textBoxCoords == "" || MessageBox(hwnd, "Are you certain you wish to exit?\r\nAll unsaved data will be lost.", "Leaving so soon?", MB_ICONEXCLAMATION | MB_YESNO) == IDYES)
                {
                    DestroyWindow(hwnd);
                }
            }
            break;
            case WM_DESTROY:
            {
                if(textOutput){cout << "\nExiting.\n\n";}
                else{if(IsWindow(consoleWindow)){ShowWindow(consoleWindow, SW_SHOW);} cout << "\nExiting.\n\n";}
                PostQuitMessage(0);
            }
            break;
            default:
                cout << setw(10) << hwnd << setw(10) << msg << setw(15) << wParam << setw(15) << lParam << endl;
                //Recent addition when this started. If you think the info I get from this would help, please ask!
                return DefWindowProc(hwnd, msg, wParam, lParam); // <===This thing!
        }
        return 0;
    }
    

    它崩溃的实际代码是&#34; chkstk.asm&#34;:&#34; test dword ptr [eax],eax&#34;

    ; Find next lower page and probe
    cs20:
            sub     eax, _PAGESIZE_         ; decrease by PAGESIZE
            test    dword ptr [eax],eax     ; probe page. <====
            jmp     short cs10
    

    以下是Visual Studio的完整堆栈跟踪/调用堆栈:

    Project1.exe!_chkstk() Line 99  Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_SendMessageW@16()   Unknown
    msctf.dll!UIComposition::UpdateCompositionRect(class IMCLock &) Unknown
    msctf.dll!CIMEUIWindowHandler::ImeUINotifyHandler(struct HWND__ *,unsigned int,unsigned int,long)   Unknown
    msctf.dll!CIMEUIWindowHandler::ImeUIWndProcWorker(struct HWND__ *,unsigned int,unsigned int,long)   Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_SendMessageToUI@20()    Unknown
    user32.dll!_ImeNotifyHandler@16()   Unknown
    user32.dll!_ImeWndProcWorker@20()   Unknown
    user32.dll!_ImeWndProcW@16()    Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_RealDefWindowProcWorker@20()    Unknown
    user32.dll!_RealDefWindowProcA@16() Unknown
    user32.dll!_DefWindowProcA@16() Unknown
    Project1.exe!WndProc(HWND__ * hwnd=0x000f04be, unsigned int msg=642, unsigned int wParam=11, long lParam=0) Line 1842   C++
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_SendMessageW@16()   Unknown
    imm32.dll!_MakeIMENotify@28()   Unknown
    imm32.dll!_ImmSetCompositionWindow@8()  Unknown
    user32.dll!_ImeSetContextHandler@16()   Unknown
    user32.dll!_ImeWndProcWorker@20()   Unknown
    user32.dll!_ImeWndProcW@16()    Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_RealDefWindowProcWorker@20()    Unknown
    user32.dll!_RealDefWindowProcA@16() Unknown
    user32.dll!_DefWindowProcA@16() Unknown
    Project1.exe!WndProc(HWND__ * hwnd=0x000f04be, unsigned int msg=641, unsigned int wParam=1, long lParam=-1073741809) Line 1842  C++
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_SendMessageW@16()   Unknown
    imm32.dll!_ImmSetActiveContext@12() Unknown
    user32.dll!_FocusSetIMCContext@8()  Unknown
    user32.dll!_ImeSystemHandler@16()   Unknown
    user32.dll!_ImeWndProcWorker@20()   Unknown
    user32.dll!_ImeWndProcW@16()    Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_DispatchClientMessage@20()  Unknown
    user32.dll!___fnDWORD@4()   Unknown
    ntdll.dll!_KiUserCallbackDispatcher@12()    Unknown
    user32.dll!_GetWindowInfo@8()   Unknown
    user32.dll!_RealDefWindowProcA@16() Unknown
    user32.dll!_DefWindowProcA@16() Unknown
    Project1.exe!WndProc(HWND__ * hwnd=0x000f04be, unsigned int msg=6, unsigned int wParam=1, long lParam=1640404) Line 1842    C++
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_DispatchClientMessage@20()  Unknown
    user32.dll!___fnDWORD@4()   Unknown
    ntdll.dll!_KiUserCallbackDispatcher@12()    Unknown
    user32.dll!_GetWindowInfo@8()   Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallDlgProcCheckWow@32()    Unknown
    user32.dll!_DefDlgProcWorker@20()   Unknown
    user32.dll!_DefDlgProcA@16()    Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_SendMessageWorker@20()  Unknown
    user32.dll!_SendMessageW@16()   Unknown
    user32.dll!_xxxButtonNotifyParent@8()   Unknown
    user32.dll!_xxxBNReleaseCapture@8() Unknown
    user32.dll!_ButtonWndProcWorker@20()    Unknown
    user32.dll!_ButtonWndProcA@16() Unknown
    user32.dll!_InternalCallWinProc@20()    Unknown
    user32.dll!_UserCallWinProcCheckWow@32()    Unknown
    user32.dll!_DispatchMessageWorker@8()   Unknown
    user32.dll!_DispatchMessageA@4()    Unknown
    Project1.exe!WinMain(HINSTANCE__ * hInstance=0x00000000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00000000, int nCmdShow=1) Line 1914 C++
    Project1.exe!std::_Bind<0,void,int (__stdcall*)(HINSTANCE__ *,HINSTANCE__ *,char *,int),HINSTANCE__ *,HINSTANCE__ *,char *,int,std::_Nil,std::_Nil,std::_Nil>::operator()() Line 1152   C++
    Project1.exe!std::_LaunchPad<std::_Bind<0,void,int (__stdcall*)(HINSTANCE__ *,HINSTANCE__ *,char *,int),HINSTANCE__ *,HINSTANCE__ *,char *,int,std::_Nil,std::_Nil,std::_Nil> >::_Run(std::_LaunchPad<std::_Bind<0,void,int(__stdcall*)(HINSTANCE__ *,HINSTANCE__ *,char *,int),HINSTANCE__ *,HINSTANCE__ *,char *,int,std::_Nil,std::_Nil,std::_Nil> > * _Ln=0x0012fafc) Line 196  C++
    Project1.exe!std::_LaunchPad<std::_Bind<0,void,int (__stdcall*)(HINSTANCE__ *,HINSTANCE__ *,char *,int),HINSTANCE__ *,HINSTANCE__ *,char *,int,std::_Nil,std::_Nil,std::_Nil> >::_Go() Line 187 C++
    msvcp110d.dll!_Call_func(void * _Data=0x0012fafc) Line 52   C++
    msvcr110d.dll!_callthreadstartex() Line 354 C
    msvcr110d.dll!_threadstartex(void * ptd=0x00bcaba8) Line 337    C
    kernel32.dll!@BaseThreadInitThunk@12()  Unknown
    ntdll.dll!___RtlUserThreadStart@8() Unknown
    ntdll.dll!__RtlUserThreadStart@8()  Unknown
    

    我实际上不确定从哪里开始。帮助

    (如果您需要更多相关信息,请询问 - 我并不完全确定这里有什么相关内容,并且有很多代码和大量数据......编辑:这对所有人来说应该是显而易见的......)

1 个答案:

答案 0 :(得分:4)

深入了解调用堆栈。堆栈溢出的一个常见原因是无限递归。 DefWindowProc会以某种方式执行最终调用WndProc的内容,然后调用DefWindowProc,然后调用WndProc吗?中间可能存在多层函数调用。

它也可能只是过度使用堆栈。增加堆栈大小的几种方法之一是:http://msdn.microsoft.com/en-us/library/tdkhxaks.aspx

其他可能的原因是堆栈上的大量分配(通常涉及alloca)或堆栈损坏。