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

📄 dlgstar.cpp

📁 使用vc++技术实现光电机串口通信管理程序
💻 CPP
字号:
// DlgStar.cpp : implementation file
//

#include "stdafx.h"
#include "pcm120.h"
#include "DlgStar.h"
#include "DlgAllStaSet.h"


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

/////////////////////////////////////////////////////////////////////////////
// CDlgStar dialog


CDlgStar::CDlgStar(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgStar::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgStar)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgStar::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgStar)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgStar, CDialog)
	//{{AFX_MSG_MAP(CDlgStar)
	ON_BN_CLICKED(IDC_BTN_TOSDH, OnBtnTosdh)
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_BTN_TOLCT, OnBtnTolct)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgStar message handlers

void CDlgStar::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

void CDlgStar::OnBtnTosdh() 
{
	// TODO: Add your control notification handler code here
		////////////////////////读串口信息//////////////////////////////////////////////////
	CDlgAllStaSet dlgalstaset;
	CString strPath;
	char GetPath[255];
	char GetExe[255];
	dlgalstaset.GetModulePath(strPath,NULL);
	strPath+="config.ini";
	GetPrivateProfileString("General","EMS路径","C:\\TMaster1000 EMS\\",GetPath,255,strPath);
	GetPrivateProfileString("General","EMS可执行文件名","TMaster1000 EMS.exe",GetExe,255,strPath);
	CString strDir;
	CString strAllPath;
	CString strExe;
	strDir=(LPCTSTR)GetPath;
	strExe=(LPCTSTR)GetExe;
	strAllPath=strDir+strExe;
	//////////////////////////////////////////////////////////////////////////
	ShellExecute(this->GetSafeHwnd(),"open",strAllPath,NULL,strDir,SW_SHOWNORMAL);


}

HBRUSH CDlgStar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if(nCtlColor==CTLCOLOR_BTN)
	{
		pDC->SetBkColor(RGB(75,175,191));
		
	}
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CDlgStar::OnBtnTolct() 
{
	// TODO: Add your control notification handler code here
	CDlgAllStaSet dlgalstaset;
	CString strPath;
	char GetPath[255];
	char GetExe[255];
	dlgalstaset.GetModulePath(strPath,NULL);
	strPath+="config.ini";
	GetPrivateProfileString("General","LCT路径","C:\\TMaster1000 LCT V8.14\\",GetPath,255,strPath);
	GetPrivateProfileString("General","LCT可执行文件名","TMaster1000 LCT.exe",GetExe,255,strPath);
	CString strDir;
	CString strAllPath;
	CString strExe;
	strDir=(LPCTSTR)GetPath;
	strExe=(LPCTSTR)GetExe;
	strAllPath=strDir+strExe;
	//////////////////////////////////////////////////////////////////////////
	ShellExecute(this->GetSafeHwnd(),"open",strAllPath,NULL,strDir,SW_SHOWNORMAL);
}

⌨️ 快捷键说明

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