在主对话框中添加菜单,用菜单分别关联了几个子对话框,为什么成功运行完一个子对话框关闭后再点菜单弹出另一个对话框运行就会崩溃?整个程序用到了画图,和简单的输入输出
解决方案 »
- 如何使用CRecordset类对数据库进行增、删、改操作
- 关于EVC连接模拟器的问题(急迫求解)
- 对话框问题(急!!!)
- 如何编译核心编程上的例子
- 我在OnDraw里用条件语句保存了两个图,我想在按button1时显示图1,按button2时显示图2,但是,我在button的命令处理函数里如何触发OnDraw
- 请问打开EXCEL文件的命令
- 求助串口问题
- 问个题外话:有没有把pdf文件转换成Word文档的工具?
- 请问VB能不能编写COM+组件?
- 很简单的一个位图,20白拿!
- vc6.0 ON_EN_UPDATE和ON_EN_CHANGE同时输入3个字怎样才能只响应一次
- mfc写的MP3怎么实现点下按键,自动顺序播放列表里面的歌曲
// zong2Dlg.cpp : implementation file
//#include "stdafx.h"
#include "zong2.h"
#include "zong2Dlg.h"#include "zhibycl_dlg.h"
#include "bianq_dlg.h"
#include "ccfx_dlg.h"
#include "mohpg_dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App Aboutclass 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()/////////////////////////////////////////////////////////////////////////////
// CZong2Dlg dialogCZong2Dlg::CZong2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CZong2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CZong2Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void CZong2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CZong2Dlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CZong2Dlg, CDialog)
//{{AFX_MSG_MAP(CZong2Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_MENUITEM32771, OnMenuitem_zbycl)
ON_COMMAND(ID_MENUITEM32772, OnMenuitem_ccfx)
ON_COMMAND(ID_MENUITEM32773, OnMenuitem_bquan)
ON_COMMAND(ID_MENUITEM32774, OnMenuitem_mohpg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CZong2Dlg message handlersBOOL CZong2Dlg::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 CZong2Dlg::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 CZong2Dlg::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 CZong2Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}void CZong2Dlg::OnMenuitem_zbycl()
{
// TODO: Add your command handler code here
zhibycl_dlg infodlg;
infodlg.DoModal();
}void CZong2Dlg::OnMenuitem_ccfx()
{
// TODO: Add your command handler code here
ccfx_dlg infodlg;
infodlg.DoModal();
}void CZong2Dlg::OnMenuitem_bquan()
{
// TODO: Add your command handler code here
bianq_dlg infodlg;
infodlg.DoModal();
}void CZong2Dlg::OnMenuitem_mohpg()
{
// TODO: Add your command handler code here
mohpg_dlg infodlg;
infodlg.DoModal();
}
//#include "stdafx.h"
#include "zong2.h"
#include "bianq_dlg.h"#include "matlib.h"
#include "bianquancg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// bianq_dlg dialog
bianq_dlg::bianq_dlg(CWnd* pParent /*=NULL*/)
: CDialog(bianq_dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(bianq_dlg)
m_f = _T("f.txt");
m_x1 = _T("x1.txt");
m_m = 3;
m_n = 8;
m_wenjian = _T("qwe.txt");
m_alf1 = 0.2;
m_alf2 = 0.4;
m_em = 0.0;
//}}AFX_DATA_INIT IsFirse1 = true;
}
void bianq_dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(bianq_dlg)
DDX_Text(pDX, IDC_EDIT_alf1, m_alf1);
DDX_Text(pDX, IDC_EDIT_alf2, m_alf2);
DDX_Text(pDX, IDC_EDIT_em, m_em);
DDX_Text(pDX, IDC_EDIT_f, m_f);
DDX_Text(pDX, IDC_EDIT_m, m_m);
DDX_Text(pDX, IDC_EDIT_n, m_n);
DDX_Text(pDX, IDC_EDIT_wenjian, m_wenjian);
DDX_Text(pDX, IDC_EDIT_x1, m_x1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(bianq_dlg, CDialog)
//{{AFX_MSG_MAP(bianq_dlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// bianq_dlg message handlersvoid bianq_dlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
initM(MATCOM_VERSION); Mm File_Name_c1 ,File_Name_c2, E1_m,File_Name_c3;
int Length_Name1, Length_Name2, Length_Name3 ;
/////////////////////////
Length_Name1 = m_f.GetLength(); File_Name_c1 = zeros(1,Length_Name1);
for(int i = 1; i < Length_Name1+1; i++)
File_Name_c1.r(i) = m_f[i-1];
/////////////////////////
Length_Name2 = m_x1.GetLength(); File_Name_c2 = zeros(1,Length_Name2);
for( i = 1; i < Length_Name2+1; i++)
File_Name_c2.r(i) = m_x1[i-1];/////////////////////////
Length_Name3 = m_wenjian.GetLength(); File_Name_c3 = zeros(1,Length_Name3);
for( i = 1; i < Length_Name3 +1; i++)
File_Name_c3.r(i) = m_wenjian[i-1];
////////////画图区域初始化////////////////
clf();
//figure((CL(1.0)));
Mm plothandle1;
//设定画图区域
CWnd *p1 = NULL;
p1 = (CWnd *)GetDlgItem(IDC_STATIC_tu);
plothandle1 = winaxes(p1->m_hWnd);
if(IsFirse1 == true)
{
IsFirse1 = false;
figure_close();
} E1_m = bianquancg(m_n, m_m, m_alf1, m_alf2, File_Name_c1 ,File_Name_c2,File_Name_c3 );
m_em = E1_m.r(1,1);UpdateData(false);
exitM();
}
][/code]