📄 file_control.cpp
字号:
// File_Control.cpp : implementation file
//
#include "stdafx.h"
#include "Dan_backcom.h"
#include "File_Control.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// File_Control dialog
File_Control::File_Control(CWnd* pParent /*=NULL*/)
: CDialog(File_Control::IDD, pParent)
{
m_bFileState=FALSE;
m_nNum=0;
//{{AFX_DATA_INIT(File_Control)
m_num_con = 0;
//}}AFX_DATA_INIT
}
void File_Control::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(File_Control)
DDX_Text(pDX, IDC_NUM_CON, m_num_con);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(File_Control, CDialog)
//{{AFX_MSG_MAP(File_Control)
ON_COMMAND(ID_NUMOFCON, OnNumofcon)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// File_Control message handlers
void File_Control::OnCreatefile()
{
if(m_bFileState==TRUE) //设置文件名为空
{
m_NewFileName="";
hwnd=NULL;
}
char szPathFile[MAX_PATH]; //文件名
GetModuleFileName(NULL,szPathFile,MAX_PATH);
int i;
int n=strlen(szPathFile);
for(i=n;szPathFile[i]!=92;i--)
szPathFile[i]='\0';
CString sFilename=szPathFile;
FILE *fp;
CString str[31];
for(i=1;i<=30;i++)
str[i].Format("%s后方交会计算外方位元素%d.txt",sFilename,i);
m_nNum++;
m_NewFileName=str[m_nNum];
if((fp=fopen(m_NewFileName,"w"))==NULL)
{
AfxMessageBox("无法打开文件");
return;
}
fclose(fp);
ShellExecute(NULL, "open", m_NewFileName, NULL, sFilename,SW_SHOWNORMAL); //文件打开,待输入
m_bFileState=true;
}
void File_Control::OnOpenfile()
{
CFileDialog backcom(TRUE,"txt",".txt");
if(backcom.DoModal()==IDOK)
{
m_NewFileName=backcom.GetPathName();
ShellExecute(hwnd,NULL,m_NewFileName,NULL,NULL,SW_SHOWNORMAL);
}
m_bFileState=TRUE;
}
void File_Control::OnNumofcon()
{
// TODO: Add your command handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -