⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 batttest.cpp

📁 一个通过USB->UART读取C8051F060的程序
💻 CPP
字号:
// BattTest.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "BattTest.h"
#include "BattTestDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CBattTestApp
BEGIN_MESSAGE_MAP(CBattTestApp, CWinApp)
	//{{AFX_MSG_MAP(CBattTestApp)
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBattTestApp construction
CBattTestApp::CBattTestApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

CBattTestApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CBattTestApp initialization
BOOL CBattTestApp::InitInstance()
{
	AfxEnableControlContainer();

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif


	//Y
	g_sRange.nMax  = 60;
	g_sRange.nMin  = -5;
	//Y
	g_sYAxisRange_Zoom.nMax = 60;
	g_sYAxisRange_Zoom.nMin = -5;
	g_sXRange.nMax = 1800000;
	g_sXRange.nMin = -1000;
	g_sXAxisRange_Zoom.nMax = 1800000;
	g_sXAxisRange_Zoom.nMin = -1000;
	


	////////////////////////////////////////////////////////////////////
	//写入注册表
	//SetRegistryKey(_T("热电池自旋测试系统")); 
	//LoadStdProfileSettings();
	

	//写入INI文件
	free((void*)m_pszRegistryKey);  //再清除Ini变量	
	free((void*)m_pszProfileName);	
	//改变Ini文件名
	char pstrPath[APPPATHLEN];
	::pltCurrentPath(pstrPath, max(APPPATHLEN, ::strlen(pstrPath)) );
	CString strPath = (CString(pstrPath) + CString("\\AdjArgu.ini"));
	m_pszProfileName = _tcsdup((LPCTSTR)strPath);

	/////////////////////////////////////////////////////////////////////
	//得到默认的电池数据存放目录
	g_strBattPath = ::AfxGetApp()->GetProfileString("数据目录", "默认路径", NULL);
    //::memcpy(g_pstrPath, strDataPath.GetBuffer(0), min(strDataPath.GetLength(), 256));
	//TRACE1("数据目录 = %s.\n", g_strBattPath);


	
	/////////////////////////////////////////////////////////////////////
	CBattTestDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}
	
	//::WritePrivateProfileString
	//::GetPrivateProfileString

	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -