wyx234k 2017-07-27 06:12 采纳率: 0%
浏览 8498

0xC000041D: 用户回调期间遇到未经处理的异常。。

请大神指教一下,调试时****围着部分提示0x010020FF 处有未经处理的异常(在 MFC.exe 中): 0xC000041D: 用户回调期间遇到未经处理的异常。。

MFCDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "MFC.h"
#include "MFCDlg.h"
#include "afxdialogex.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// 用于应用程序“关于”菜单项的 CAboutDlg 对话框

class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();

// 对话框数据

#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持

// 实现
protected:
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()

// CMFCDlg 对话框

CMFCDlg::CMFCDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_MFC_DIALOG, pParent)
, n(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMFCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CMFCDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_Open, &CMFCDlg::OnBnClickedButtonOpen)
END_MESSAGE_MAP()

// CMFCDlg 消息处理程序

BOOL CMFCDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();

// 将“关于...”菜单项添加到系统菜单中。

// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
    BOOL bNameValid;
    CString strAboutMenu;
    bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
    ASSERT(bNameValid);
    if (!strAboutMenu.IsEmpty())
    {
        pSysMenu->AppendMenu(MF_SEPARATOR);
        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
}

// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
//  执行此操作
SetIcon(m_hIcon, TRUE);         // 设置大图标
SetIcon(m_hIcon, FALSE);        // 设置小图标

// TODO: 在此添加额外的初始化代码

return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE

}

void CMFCDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}

// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。

void CMFCDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文

    SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

    // 使图标在工作区矩形中居中
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // 绘制图标
    dc.DrawIcon(x, y, m_hIcon);
}
else
{
    CDialogEx::OnPaint();
    HDC hdc;
    hdc = ::GetDC(m_hWnd);

    EntityData *pointer;
    pointer = entity;
    int i = 0;
    if (pointer != NULL)
    {
        do {

        **************  ************************************************
        MoveToEx(hdc,pointer->data.line.x1, pointer->data.line.y1,NULL);

            LineTo(hdc,pointer->data.line.x2, pointer->data.line.y2);

            pointer = pointer->next;
            ******************************************************************
            i++;
        } while (pointer != NULL);
    }



}

}

//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CMFCDlg::OnQueryDragIcon()
{
return static_cast(m_hIcon);
}

void CMFCDlg::OnBnClickedButtonOpen()
{

CStdioFile file;
// TODO: 在此添加控件通知处理程序代码
// 设置过滤器     
TCHAR szFilter[] = _T("DXF文件(*.dxf)|*.dxf|所有文件(*.*)|*.*||");
// 构造打开文件对话框     
CFileDialog fileDlg(TRUE, _T("dxf"), NULL, 0, szFilter, this);
CString strFilePath;
// 显示打开文件对话框     
if (IDOK == fileDlg.DoModal())
{
    // 得到我们的选择文件的地址,用于之后的打开文件的操作  
    strFilePath = fileDlg.GetPathName();


    //添加读取这个文件内容的代码,CFile::modeRead是说以只读文件的模式打开  

    file.Open(strFilePath, CFile::modeRead);



    /*逐行读取字符串*/

    CString szLine;
    CString strText;
    while (file.ReadString(szLine))
    {
        strText += szLine;
    }



    sscanf(strText, "%d", &code);
    sscanf(strText, "%s", codevalue);
    if (code == 2 && strcmp(codevalue, "ENTITIES") == 0)
    {
        while (strcmp(codevalue, "ENDSEC"))
        {
            sscanf(strText, "%d", &code);
            sscanf(strText, "%s", codevalue);
            if (code == 0 && strcmp(codevalue, "LINE") == 0)
            {
                entity1 = (EntityData *)malloc(DATASIZE);
                strcpy(entity1->id, codevalue);
                sscanf(strText, "%d", &code);

                while (code)
                {
                    switch (code)
                    {
                    case 8:
                        sscanf(strText, "%s", codevalue);
                        sscanf(strText, "%d", &code);
                        strcpy(entity1->layer, codevalue);
                        break;
                    case 10:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.x1 = value;
                        break;
                    case 20:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.y1 = value;
                        break;
                    case 30:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.z1 = value;
                        break;
                    case 11:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.x2 = value;
                        break;
                    case 21:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.y2 = value;
                        break;
                    case 31:
                        sscanf(strText, "%f", &value);
                        sscanf(strText, "%d", &code);
                        entity1->data.line.z2 = value;
                        break;
                    default: {
                        sscanf(strText, "%s", codevalue);
                        sscanf(strText, "%d", &code);
                    }
                    }
                }

                entity2->next = entity1;
                entity2 = entity1;
            }
        }
        entity2->next = NULL;
    }

    entity = entity->next;
}
//关闭文件  
   file.Close();

}

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2018-07-06 16:04
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?