| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1073 人关注过本帖
标题:[求助]运行MFC时,为什么总是出现要发送错误报告!
只看楼主 加入收藏
sunnyfish
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2006-5-5
收藏
 问题点数:0 回复次数:3 
[求助]运行MFC时,为什么总是出现要发送错误报告!
我这个程序在VC6.0 中编写的
搜索更多相关主题的帖子: MFC 运行 编写 
2006-06-20 18:33
行空天马
Rank: 1
等 级:新手上路
威 望:1
帖 子:523
专家分:0
注 册:2006-5-19
收藏
得分:0 

程序不够strong,有非法操作呗。

比如用指针写了不应该写的内存等。

把代码帖出来,让高手们看看(我不是高手)

[此贴子已经被作者于2006-6-20 18:55:03编辑过]


好好学习,天天向上。
2006-06-20 18:53
sunnyfish
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2006-5-5
收藏
得分:0 

// JinFeng2Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "JinFeng2.h"
#include "JinFeng2Dlg.h"
#include "preDefine.h"
#include "math.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

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

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJinFeng2Dlg dialog

CJinFeng2Dlg::CJinFeng2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CJinFeng2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CJinFeng2Dlg)
m_t = 0.0;
m_tw = 0;
m_td = 0.0;
m_xdsd = 0.0;
m_d = 0.0;
m_h = 0.0;
m_e = 0.0;
m_d1 = 0.0;
m_hh1 = 0.0;
m_hh2 = 0.0;
m_h1 = 0.0;
m_ma1 = 0.0;
m_hd2 = 0.0;
m_ma2 = 0.0;
m_pst = 0.0;
m_pstw = 0.0;
m_dx = 0.0;
m_bhd = 0.0;
m_v = 0.0;
m_tdx = 0.0;
m_ds = 0.0;
m_dsc = 0.0;
m_pv = 0.0;
m_xdsdx = 0.0;
m_hx = 0.0;
m_twx = 0.0;
m_jisuan = 0;
m_pb = 0.0;
m_hd1 = 0.0;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CJinFeng2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CJinFeng2Dlg)
DDX_Control(pDX, IDC_EDIT29, m_0jisuan);
DDX_Control(pDX, IDC_EDIT28, m_0twx);
DDX_Control(pDX, IDC_EDIT27, m_0hx);
DDX_Control(pDX, IDC_EDIT26, m_0xdsdx);
DDX_Control(pDX, IDC_EDIT25, m_0pv);
DDX_Control(pDX, IDC_EDIT24, m_0dsc);
DDX_Control(pDX, IDC_EDIT23, m_0ds);
DDX_Control(pDX, IDC_EDIT22, m_0tdx);
DDX_Control(pDX, IDC_EDIT21, m_0v);
DDX_Control(pDX, IDC_EDIT20, m_0bhd);
DDX_Control(pDX, IDC_EDIT19, m_0dx);
DDX_Control(pDX, IDC_EDIT18, m_0pstw);
DDX_Control(pDX, IDC_EDIT17, m_0pst);
DDX_Control(pDX, IDC_EDIT16, m_0ma2);
DDX_Control(pDX, IDC_EDIT15, m_0hd2);
DDX_Control(pDX, IDC_EDIT14, m_0ma1);
DDX_Control(pDX, IDC_EDIT13, m_0h1);
DDX_Control(pDX, IDC_EDIT12, m_0hh2);
DDX_Control(pDX, IDC_EDIT11, m_0hh1);
DDX_Control(pDX, IDC_EDIT10, m_0hd1);
DDX_Control(pDX, IDC_EDIT9, m_0d1);
DDX_Control(pDX, IDC_EDIT8, m_0e);
DDX_Control(pDX, IDC_EDIT7, m_0h);
DDX_Control(pDX, IDC_EDIT6, m_0d);
DDX_Control(pDX, IDC_EDIT5, m_0xdsd);
DDX_Control(pDX, IDC_EDIT4, m_0td);
DDX_Control(pDX, IDC_EDIT3, m_0tw);
DDX_Control(pDX, IDC_EDIT2, m_0t);
DDX_Control(pDX, IDC_EDIT1, m_0pb);
DDX_Text(pDX, IDC_EDIT2, m_t);
DDX_Text(pDX, IDC_EDIT3, m_tw);
DDX_Text(pDX, IDC_EDIT4, m_td);
DDX_Text(pDX, IDC_EDIT5, m_xdsd);
DDX_Text(pDX, IDC_EDIT6, m_d);
DDX_Text(pDX, IDC_EDIT7, m_h);
DDX_Text(pDX, IDC_EDIT8, m_e);
DDX_Text(pDX, IDC_EDIT9, m_d1);
DDX_Text(pDX, IDC_EDIT11, m_hh1);
DDX_Text(pDX, IDC_EDIT12, m_hh2);
DDX_Text(pDX, IDC_EDIT13, m_h1);
DDX_Text(pDX, IDC_EDIT14, m_ma1);
DDX_Text(pDX, IDC_EDIT15, m_hd2);
DDX_Text(pDX, IDC_EDIT16, m_ma2);
DDX_Text(pDX, IDC_EDIT17, m_pst);
DDX_Text(pDX, IDC_EDIT18, m_pstw);
DDX_Text(pDX, IDC_EDIT19, m_dx);
DDX_Text(pDX, IDC_EDIT20, m_bhd);
DDX_Text(pDX, IDC_EDIT21, m_v);
DDX_Text(pDX, IDC_EDIT22, m_tdx);
DDX_Text(pDX, IDC_EDIT23, m_ds);
DDX_Text(pDX, IDC_EDIT24, m_dsc);
DDX_Text(pDX, IDC_EDIT25, m_pv);
DDX_Text(pDX, IDC_EDIT26, m_xdsdx);
DDX_Text(pDX, IDC_EDIT27, m_hx);
DDX_Text(pDX, IDC_EDIT28, m_twx);
DDX_Text(pDX, IDC_EDIT29, m_jisuan);
DDV_MinMaxInt(pDX, m_jisuan, 1, 7);
DDX_Text(pDX, IDC_EDIT1, m_pb);
DDX_Text(pDX, IDC_EDIT10, m_hd1);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CJinFeng2Dlg, CDialog)
//{{AFX_MSG_MAP(CJinFeng2Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJinFeng2Dlg message handlers

BOOL CJinFeng2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

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

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control
}

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

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CJinFeng2Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
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;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CJinFeng2Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}

double CJinFeng2Dlg::ps(double T)
{
int n;
double max1=0.0,max;
if((T>=-173.15)&&(T<273.15))
{
for(n=0;n<=5;n++)
{
max1=max1+c[n]*pow(T,(n-1));
}
max=exp(max1+c[6]*log(T))/1000;
}
else if((T>=273.15)&&(T<=473.15))
{
for(n=7;n<=11;n++)
{
max1=max1+c[n]*pow(T,(n-8));
}
max=exp(max1+c[12]*log(T))/1000;
}
return(max);
}
/*计算水蒸气的饱和压力的导数*/
double CJinFeng2Dlg::dps(double T)
{
int n;
double max1=0,max;
if((T>=-173.15)&&(T<273.15))
{
for(n=2;n<=5;n++)
{
max1=max1+(n-1)*c[n]*pow(T,(n-2));
}
max=ps(T)*(-c[0]/(T*T)+max1+c[6]/T);
}
else if((T>=273.15)&&(T<=473.15))
{
for(n=9;n<=11;n++)
{
max1=max1+(n-8)*c[n]*pow(T,(n-9));
}
max=ps(T)*(-c[7]/(T*T)+max1+c[12]/T);
}
return(max);
}
double CJinFeng2Dlg::dsc0(double p,double twc)
{
double Twc,max;
Twc=twc+273.15;
max=622*ps(Twc)/(p-ps(Twc));
return(max);
}
/*计算未饱和空气的含湿量*/
double CJinFeng2Dlg::d0(double twc)
{
double max;
max=((2500-2.347*twc)*dsc-1010*(t-twc))/(2500+1.84*t-4.187*twc);
return(max);
}
/*计算比容*/
double CJinFeng2Dlg::v0(double T,double p)
{
double max;
max=0.287055*T*(1+0.0016078*d)/p;
return(max);
}
/*计算比焓*/
double CJinFeng2Dlg::h0()
{
double max;
max=1.010*t+0.001*d*(2500+1.84*t);
return(max);
}
/*迭代求露点温度*/
double CJinFeng2Dlg::td0()
{
double T1,T2,ps0,ps1,y;
if((t>=-100)&&(t<0))
T1=263.15;
else if((t>=0)&&(t<=200))
T1=283.15;
ps0=pv;
y=ps0*1E-5;
do
{
ps1=ps(T1);
T2=T1+(ps0-ps1)/dps(T1);
T1=T2;
}while(fabs(ps0-ps1)>y);
return(T1);
}
/*迭代求湿球温度*/
double CJinFeng2Dlg::tw0()
{
double y,dc0,tw1,tw2,d1,Atw,twx,Ad;
dc0=d;
if(t<-30)
y=fabs(0.8-0.9999*(t+100)/70.0)*dc0;
else
y=dc0*0.00001;
tw1=(t+td)/2.0;
do
{
dsc=dsc0(pb,tw1);
d1=d0(tw1);
Atw=(tw1+273.15)*0.00001;
twx=tw1+Atw;
dsc=dsc0(pb,twx);
Ad=d0(twx)-d1;
tw2=tw1+(dc0-d1)*Atw/Ad;
tw1=tw2;
}while(fabs(dc0-d1)>y);
return(tw1);
}
/*已知湿空气参数大气压力pb,干球温度t,湿球温度tw*/
void CJinFeng2Dlg::qk1()
{
double T,Tw;
pb=m_pb;
t=m_t;
tw=m_tw;
T=t+273.15;
Tw=tw+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
pstw=ps(Tw);
dsc=622*pstw/(pb-pstw);
d=d0(tw);
bhd=d/ds;
pv=pb*d/(622+d);
xdsd=pv/pst;
v=v0(T,pb);
h=h0();
td=td0()-273.15;
}
/*已知空气参数pb,t,td的计算*/
void CJinFeng2Dlg::qk2()
{

double T,Td;
pb=m_pb;
t=m_t;
td=m_td;
T=t+273.15;
Td=td+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
pv=ps(Td);
d=622*pv/(pb-pv);
bhd=d/ds;
xdsd=pv/pst;
v=v0(T,pb);
h=h0();
tw=tw0();
}
/*已知湿空气参数pb,t,xdsd的计算*/
void CJinFeng2Dlg::qk3()
{
double T;
pb=m_pb;
t=m_t;
xdsd=m_0xdsd;
T=t+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
pv=pst*xdsd;
d=622*pv/(pb-pv);
bhd=d/ds;
v=v0(pb,T);
h=h0();
td=td0()-273.15;
tw=tw0();
}
/*已知湿空气的参数pb,t,d的计算*/
void CJinFeng2Dlg::qk4()
{
double T;
pb=m_pb;
t=m_t;
d=m_d;
T=t+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
pv=pb*d/(622+d);
xdsd=pv/pst;
bhd=d/ds;
v=v0(pb,T);
h=h0();
td=td0()-273.15;
tw=tw0();
}
/*已知湿空气参数pb,t,h的计算*/
void CJinFeng2Dlg::qk5()
{
double T;
pb=m_pb;
t=m_t;
h=m_h;
T=t+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
d=1000*(h-1.010*t)/(2500+1.84*t);
pv=pb*d/(622+d);
xdsd=pv/pst;
bhd=d/ds;
v=v0(pb,T);
td=td0()-273.15;
tw=tw0();
}
/*湿空气定热湿变化比过程的计算*/
void CJinFeng2Dlg::qk6()
{
double T;
t=m_0t;
e=m_0e;
d1=m_0d1;
h1=m_0h1;
d=(e*d1-h1+1.010*t)/(e-2.5-(1.84E-3)*t);
T=t+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
d=1000*(h-1.010*t)/(2500+1.84*t);
pv=pb*d/(622+d);;
xdsd=pv/pst;
bhd=d/ds;
v=v0(pb,T);
h=h0();
td=td0()-273.15;
tw=tw0();
}
/*湿空气绝热混合过程的计算*/
void CJinFeng2Dlg::qk7()
{
double a,ma1,ma2,d1,d2,h1,h2,T;
a=ma1/ma2;
d=(d2+a*d1)/(1+a);
h=(h2+a*h1)/(1+a);
t=(h-2.5*d)/(1.010+(1.84E-3)*d);
T=t+273.15;
pst=ps(T);
ds=622*pst/(pb-pst);
pv=pb*d/(622+d);;
xdsd=pv/pst;
bhd=d/ds;
v=v0(pb,T);
h=h0();
td=td0()-273.15;
tw=tw0();
}


void CJinFeng2Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
switch(m_jisuan)
{
case 1:
qk1();
m_pst=pst;
m_ds=ds;
m_pstw=pstw;
m_dsc=dsc;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_tdx=td;
UpdateData(FALSE);
break;

case 2:
qk2();
m_pst=pst;
m_ds=ds;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_twx=tw;
UpdateData(FALSE);
break;

case 3:
qk3();
m_pst=pst;
m_ds=ds;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_v=v;
m_hx=h;
m_tdx=td;
m_twx=tw;
UpdateData(FALSE);
break;

case 4:
qk4();
m_pst=pst;
m_ds=ds;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_tdx=td;
m_twx=tw;
UpdateData(FALSE);
break;

case 5:
qk5();
m_pst=pst;
m_ds=ds;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_tdx=td;
m_twx=tw;
UpdateData(FALSE);
break;

case 6:
qk6();
m_pst=pst;
m_ds=ds;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_tdx=td;
m_twx=tw;
UpdateData(FALSE);
break;

case 7:
qk7();
m_pst=pst;
m_ds=ds;
m_dx=d;
m_bhd=bhd;
m_pv=pv;
m_xdsdx=xdsd*100;
m_v=v;
m_hx=h;
m_tdx=td;
m_twx=tw;
UpdateData(FALSE);
break;
}
}

2006-06-20 21:28
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
程序写完了不代表执行正确,程序是需要自己调试的。

添加断点(F9)-〉调试运行(F5)-〉单步跟踪(F10)函数体细节跟踪(F11)-〉停止调式运行(SHIFT+F5)

找到崩溃的地方后再分析为什么崩溃,如果还有问题再来问吧。

I am a big fan of c plus plus.
2006-06-20 23:13
快速回复:[求助]运行MFC时,为什么总是出现要发送错误报告!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017583 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved