应该是缓冲区溢出了。
没有代码估计看不了
// zhongjianzhouDlg.cpp : implementation file // #include "stdafx.h" #include "biansuqi.h" #include "zhongjianzhouDlg.h" #include "uf.h" #include <string.h> #include "uf_modl.h" #include <stdlib.h> #include <stdio.h> #include <math.h> #include "uf_part.h" #include "uf_ui_ugopen.h" #include "uf_modl_expressions.h" #include <uf_defs.h> #include <uf_exit.h> #include <uf_ui.h> #include <uf_styler.h> #include <uf_mb.h> #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CzhongjianzhouDlg dialog CzhongjianzhouDlg::CzhongjianzhouDlg(CWnd* pParent /*=NULL*/) : CDialog(CzhongjianzhouDlg::IDD, pParent) { //{{AFX_DATA_INIT(CzhongjianzhouDlg) m_1 = _T(""); m_2 = _T(""); m_3 = _T(""); m_4 = _T(""); //}}AFX_DATA_INIT } void CzhongjianzhouDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CzhongjianzhouDlg) DDX_Control(pDX, IDC_EDIT4, m_44); DDX_Control(pDX, IDC_EDIT3, m_33); DDX_Control(pDX, IDC_EDIT2, m_22); DDX_Control(pDX, IDC_EDIT1, m_11); DDX_Text(pDX, IDC_EDIT1, m_1); DDX_Text(pDX, IDC_EDIT2, m_2); DDX_Text(pDX, IDC_EDIT3, m_3); DDX_Text(pDX, IDC_EDIT4, m_4); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CzhongjianzhouDlg, CDialog) //{{AFX_MSG_MAP(CzhongjianzhouDlg) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CzhongjianzhouDlg message handlers BOOL CzhongjianzhouDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here UF_initialize(); tag_t part; char part_names[]="D:\my_bysj\moban\daodangzhou.prt";//模板位置 UF_PART_load_status_t error_status; if(UF_PART_open(part_names,&part,&error_status)==1) AfxMessageBox("load error!");//载入模板,头文件 uf_part if(UF_PART_set_display_part(part) == 1) AfxMessageBox("load error!"); { double f2,*f1; f1=&f2; UF_MODL_eval_exp("dzc",f1); char sz[20]; sprintf(sz,"%.2lf",f2); m_11.SetWindowText(sz); } { double f2,*f1; f1=&f2; UF_MODL_eval_exp("lzc",f1); char sz[20]; sprintf(sz,"%.2lf",f2); m_22.SetWindowText(sz); } { double f2,*f1; f1=&f2; UF_MODL_eval_exp("dn",f1); char sz[20]; sprintf(sz,"%.2lf",f2); m_33.SetWindowText(sz); } { double f2,*f1; f1=&f2; UF_MODL_eval_exp("l",f1); char sz[20]; sprintf(sz,"%.2lf",f2); m_44.SetWindowText(sz); } int scope=1; int mode=1; UF_PART_close(part,scope,mode); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CzhongjianzhouDlg::OnButton1() { // TODO: Add your control notification handler code here UpdateData(TRUE); CString stjjj; tag_t part; char part_name[]="D:\my_bysj\moban\daodangzhou.prt";//模板位置 UF_PART_load_status_t error_status; if(UF_PART_open(part_name,&part,&error_status)==1) AfxMessageBox("load error!");//载入模板,头文件 uf_part if(UF_PART_set_display_part(part) == 1) AfxMessageBox("load error!"); ////////////////////////////////////////////////////////////////////// CString s1="dzc="; s1+=m_1; UF_MODL_edit_exp((LPSTR)(LPCTSTR)s1); CString s2="lzc="; s2+=m_2; UF_MODL_edit_exp((LPSTR)(LPCTSTR)s2); CString s3="dn="; s3+=m_3; UF_MODL_edit_exp((LPSTR)(LPCTSTR)s3); CString s4="l="; s4+=m_4; UF_MODL_edit_exp((LPSTR)(LPCTSTR)s4); UF_MODL_update(); //////////////////////////////////////////////////////////// //char new_name[]="D:\888n.prt"; //int abc=UF_PART_save_as(new_name); // stjjj.Format("%d",abc); // AfxMessageBox(stjjj); CFileDialog fileDlg(FALSE); fileDlg.m_ofn.lpstrTitle="文件保存";//对话框名 fileDlg.m_ofn.lpstrFilter=".prt";//保存文件格式 fileDlg.m_ofn.lpstrDefExt=_T("prt");//保存文件格式 char *filename,files[133]; if(IDOK==fileDlg.DoModal()) { CString pathName = fileDlg.GetPathName(); int i,j; filename=(LPSTR)(LPCTSTR)pathName; int len=strlen(filename); for(i=0,j=0;i<len;i++,j++) { if(filename[i] == '\') { files[j]='\'; j++; } files[j]=filename[i]; } files[j]='�'; int abc = UF_PART_save_as(files); } int scope=1; int mode=1; UF_PART_close(part,scope,mode); UF_terminate (); CDialog::EndDialog(TRUE); }