www.pudn.com > ExMIS.rar > ExMISDlg.cpp, change:2011-05-23,size:17522b


// ExMISDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "ExMIS.h" 
#include "ExMISDlg.h" 
 
//添加的 
#include "LoginDlg.h" 
#include "SetDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAboutDlg dialog used for App About 
 
class 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() 
 
///////////////////////////////////////////////////////////////////////////// 
// CExMISDlg dialog 
 
CExMISDlg::CExMISDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CExMISDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CExMISDlg) 
		// 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 CExMISDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CExMISDlg) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CExMISDlg, CDialog) 
	//{{AFX_MSG_MAP(CExMISDlg) 
	ON_WM_SYSCOMMAND() 
	ON_WM_PAINT() 
	ON_WM_QUERYDRAGICON() 
	ON_COMMAND(ID_MENUITEM_CAL, OnMenuitemCal) 
	ON_COMMAND(ID_MENUITEM_DATA, OnMenuitemData) 
	ON_COMMAND(ID_MENUITEM_HELP, OnMenuitemHelp) 
	ON_COMMAND(ID_MENUITEM_NOTEPAD, OnMenuitemNotepad) 
	ON_COMMAND(ID_MENUITEM_QUIT, OnMenuitemQuit) 
	ON_COMMAND(ID_MENUITEM_RELOGIN, OnMenuitemRelogin) 
	ON_COMMAND(ID_MENUITEM_STAT, OnMenuitemStat) 
	ON_COMMAND(ID_MENUITEM_USER, OnMenuitemUser) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CExMISDlg message handlers 
 
BOOL CExMISDlg::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 
	  m_nBaudRate=COM_BAUD_19200; 
      m_nComPort=COM_1; 
	  m_nProtocol=COM_ASCII; 
	 // m_nBaudRate=COM_BAUD_19200 
	  online=FALSE; 
		   
	   
 
	//添加3: 工具栏 
	TBBUTTON button[10]; 
	int i=0,nStringLength; 
	CString string; 
	TCHAR * pString; 
	 
	m_ImageList.Create(42,42,ILC_COLOR32|ILC_MASK,0,0);	//创建图像列表框,32色,48X48象素	 
 
	m_ToolBar.EnableAutomation(); 
	m_ToolBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDR_TOOLBAR); 
	//向IMAGELIST对象添加资源图标 
	 
	for(i=IDI_ICON1;i<=IDI_ICON8;i++) 
	{		 
		m_ImageList.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(i)));		 
	}	 
	m_ToolBar.SetImageList(&m_ImageList);	 
 
	//如果此处循环错误则不能正常显示文字 
	for(i=0;i<8;i++) 
	{ 
		button[i].dwData=0; 
		button[i].fsState=TBSTATE_ENABLED; 
		button[i].fsStyle=TBSTYLE_BUTTON; 
		button[i].iBitmap=i; 
		string.LoadString(i);		 
		//为第一个字符再加一个'\0',用于向工具栏里加字符串 
		nStringLength=string.GetLength()+1; 
		pString=string.GetBufferSetLength(nStringLength); 
		button[i].iString=m_ToolBar.AddStrings(pString); 
		string.ReleaseBuffer(); 
	} 
	//将工具栏的命令ID与菜单绑定 
	button[0].idCommand=ID_MENUITEM_RELOGIN; 
	button[1].idCommand=ID_MENUITEM_DATA; 
	button[2].idCommand=ID_MENUITEM_STAT; 
	button[3].idCommand=ID_MENUITEM_USER; 
	button[4].idCommand=ID_MENUITEM_NOTEPAD; 
	button[5].idCommand=ID_MENUITEM_CAL; 
	button[6].idCommand=ID_MENUITEM_HELP; 
	button[7].idCommand=ID_MENUITEM_QUIT; 
 
	m_ToolBar.AddButtons(8,button); 
 
	button[0].fsStyle=TBSTYLE_SEP; 
	//添加分隔条,应该从后向前添加 
	m_ToolBar.InsertButton(7,&button[0]); 
	m_ToolBar.InsertButton(6,&button[0]); 
	m_ToolBar.InsertButton(4,&button[0]); 
	m_ToolBar.InsertButton(1,&button[0]); 
	 
	m_ToolBar.AutoSize; 
	m_ToolBar.SetStyle(TBSTYLE_FLAT|CCS_TOP);	//更改风格 
 
	//*状态栏 
	m_StatusBar.EnableAutomation(); 
	m_StatusBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDR_STATUSBAR); 
	int xpos=::GetSystemMetrics(SM_CXSCREEN); 
	int width[3]; 
	width[1]=xpos*0.2; 
	width[2]=xpos*0.67; 
	width[3]=xpos; 
	CString sText; 
	CString OP="MRKJ"; 
	sText="操作员:【"+OP+"】"; 
	m_StatusBar.SetParts(3,&width[1]); 
	m_StatusBar.SetText("武汉大学测绘学院",0,SBT_NOBORDERS); 
	m_StatusBar.SetText(sText,2,SBT_NOBORDERS); 
 
	//初始化OLE环境 
	if(!AfxOleInit()) 
	{ 
	  AfxMessageBox("OLE初始化失败");	  
	} 
 
	//调登录对话框 
	OnMenuitemRelogin(); 
	 
 
 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CExMISDlg::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 CExMISDlg::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 CExMISDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
void CExMISDlg::OnMenuitemCal()  
{ 
	// TODO: Add your command handler code here 
	//调计算器 
	WinExec("calc.exe",SW_SHOW); 
} 
 
void CExMISDlg::OnMenuitemData()  
{ 
	// TODO: Add your command handler code here 
    GRC_TYPE      Result; 
	if(online) 
	{ 
		AfxMessageBox("仪器已经处于连接状态!"); 
		return ; 
	} 
 
	Result = COM_Init(); 
   
 
	Result = COM_OpenConnection(m_nComPort, m_nBaudRate, 1); 
  if (Result == GRC_OK) 
    { // check if correct baudrate set 
      AfxMessageBox("仪器成功连接!"); 
      /*** debug ***/ //Result = COM_GetBaudRate(TmpBaudRate); 
    } 
 
  if (Result != GRC_OK) 
    { 
      COM_ViewError(Result, "COM_OpenConnection"); 
      Result = COM_End(); 
      return; 
    } 
 
  // set communication timeout  
  Result = COM_SetTimeOut(5); // 5s 
 
   
  online = TRUE; 
   
	 
 
} 
 
void CExMISDlg::OnMenuitemHelp()  
{ 
	// TODO: Add your command handler code here 
	AfxMessageBox("help"); 
} 
 
void CExMISDlg::OnMenuitemNotepad()  
{ 
//调记事本 
	WinExec("notepad.exe",SW_SHOW); 
} 
 
 
void CExMISDlg::OnMenuitemQuit()  
{ 
	// TODO: Add your command handler code here 
	AfxMessageBox("QUIT"); 
} 
 
void CExMISDlg::OnMenuitemRelogin()  
{ 
	// TODO: Add your command handler code here 
	CLoginDlg Dlg; 
	Dlg.DoModal();		 
} 
 
void CExMISDlg::OnMenuitemStat()  
{ 
	// TODO: Add your command handler code here 
	/********* Declarations **********/ 
	GRC_TYPE rc; 
    TMC_HZ_V_ANG OnlyAngle; 
    double SlopeDistance; 
    /****** End of Declarations ******/ 
	 
  // activate distance measurement 
    rc = TMC_DoMeasure(TMC_DEF_DIST, TMC_AUTO_INC); 
    if (rc == GRC_OK) 
	{ 
     // distance measurement successful 
     rc = TMC_GetSimpleMea(3000, OnlyAngle,SlopeDistance, TMC_MEA_INC); 
       if (rc == GRC_OK) 
	   { 
         // use distance and angle values 
		 HRESULT hr; 
		 try 
		 { 
			 hr=m_pConn.CreateInstance("ADODB.Connection");//创建Connection对象 
			 if(SUCCEEDED(hr)) 
			 { 
				 hr=m_pConn->Open("GEO","","",-1); 
			 } 
 
			 //向数据库添加数据distance and angle values 
			_variant_t RecordsAffected; 
			CString strSQL; 
			strSQL.Format("INSERT INTO 学习测量表(dV,dH,dS) VALUE('%s','%s','%s')",OnlyAngle.dV,OnlyAngle.dHz,SlopeDistance); 
 
             m_pConn->Execute((_bstr_t)strSQL,&RecordsAffected,adCmdText); 
 
 
 
		 } 
		 catch(_com_error e) 
		 { 
			 CString errormessage; 
			 errormessage.Format("连接数据库失败!\r\n错误信息:%s",e.ErrorMessage()); 
			 AfxMessageBox(errormessage); 
 
		 } 
 
 
	   } 
       else 
	   { 
// something with TMC_GetSimpleMea went wrong 
	   } 
	 } 
   else 
   { 
	   // something with dist. measurement went wrong 
   } 
 
 
   //关闭连接 
   	rc=COM_CloseConnection(); 
	if(rc!=GRC_OK) 
	{ 
		AfxMessageBox("Can't close connection!"); 
 
	} 
	 
	rc=COM_End(); 
	//AfxMessageBox("STAT"); 
} 
 
void CExMISDlg::OnMenuitemUser()  
{ 
	// TODO: Add your command handler code here 
 
	 //自动检测前的设置 
// 1.补偿器功能设置 
GRC_TYPE rc; 
ON_OFF_TYPE SwCorr; 
// clear distance first before you change the state 
TMC_DoMeasure(TMC_CLEAR, TMC_AUTO_INC); 
// deactivate the compensator 
// if it is not already 
rc = TMC_GetInclineSwitch(SwCorr); 
if (SwCorr != ON) 
{ 
  rc = TMC_SetInclineSwitch(ON); 
  if (rc == GRC_OK) 
  // successfully deactvated 
  {} 
 
else 
{AfxMessageBox("补偿器设置不成功!");} 
// set not successful (subsystem busy) 
} 
 
//2.气压温度设置 
TMC_ATMOS_TEMPERATURE AtmCorr; 
TMC_GetAtmCorr(AtmCorr); 
// set new wet and dry temperature 
AtmCorr.dDryTemperature=60; 
AtmCorr.dWetTemperature=80; 
TMC_SetAtmCorr(AtmCorr); 
 
//3.棱镜常数设置 
 const double Corr = 0.1; 
 
double PrismCorr; 
// set the prism constant to 
// 0.1 if not already set 
rc = TMC_GetPrismCorr(PrismCorr); 
if (PrismCorr != Corr) 
{ 
rc = TMC_SetPrismCorr(Corr); 
if (rc == GRC_OK) 
{ 
// set of prisma corr successful 
} 
else 
{ 
AfxMessageBox("棱镜常数设置不成功!"); 
// Invalid parameter 
} 
} 
 
//4.折光系数设置 
const double EarthRadius = 6378000; 
 
TMC_REFRACTION Refractive; 
// check the earth radius setting 
// and reset if necessary 
rc = TMC_GetRefractiveCorr(Refractive); 
if (Refractive.dEarthRadius != EarthRadius) 
{ 
Refractive.dEarthRadius = EarthRadius; 
rc = TMC_SetRefractiveCorr(Refractive); 
if (rc == GRC_OK) 
{ 
// set of earth radius successful 
} 
else 
{ 
AfxMessageBox("遮光系数设置不成功!"); 
// set not successful (subsystem busy) 
} 
} 
 
//5.测站坐标及仪器高设置 
//将测站坐标设置为零 
TMC_STATION Station, NullStation; 
NullStation.dE0 = 0; 
NullStation.dN0 = 0; 
NullStation.dH0 = 0; 
NullStation.dHi = 0; 
// reset station coordinates to 0 
rc = TMC_GetStation(Station); 
if ((Station.dE0 != 0)|| 
(Station.dN0 != 0)|| 
(Station.dH0 != 0)|| 
(Station.dHi != 0)) 
{ 
	rc = TMC_SetStation(NullStation); 
if (rc == GRC_OK) 
{ 
// reset of station successful 
} 
else 
{ 
// reset not successful (subsystem busy) 
} 
} 
 
//自动检测常数设置完毕 
 
 
//自动检测一般流程 
//1.定向 
int mbd=10;           //mbd 目标点的数量 
for(int i=0;i<mbd;i++) 
{ 
  GRC_TYPE Result; 
// clear existing distance first 
TMC_DoMeasure(TMC_CLEAR); 
// set orientation to 0 
Result=TMC_SetOrientation(0.0); 
if(Result!=GRC_OK) 
{ 
// error or warning handling 
} 
 
   
//TMC_SetOrientation(double HzOrientation); 
 
 
//2.设置棱镜高 
//TMC_SetHeight() 
 
TMC_HEIGHT NewHeight; 
NewHeight.dHr=0.0; 
rc = TMC_SetHeight(NewHeight); 
if (rc == GRC_OK) 
{ 
// set of height successful 
} 
else 
{ 
	AfxMessageBox("TMC is busy, no set possible!"); 
// TMC is busy, no set possible 
} 
 
 
 
//3.定位 
//AUT_MakePositioning4(dHz,dV,AUT_NORMAL,AUT_POSITION,False); 
GRC_TYPE  hrc; 
short i; 
BOOL TryAgain = TRUE; 
AUT_TIMEOUT TimeoutPar; 
AUT_POSMODE POSMode = AUT_PRECISE; 
short nComTimeOut, nOldComTimeOut; 
rc=GRC_IVRESULT; 
hrc = COM_GetTimeOut(nOldComTimeOut); 
hrc = AUS_SetUserAtrState(ON); // for the ATR mode 
// AUT_TARGET necessary, 
// otherwise not necessary 
while(rc!=GRC_OK || TryAgain) 
{ 
rc = AUT_MakePositioning(1.3, 1.6, POSMode, 
AUT_TARGET, FALSE ); 
switch (rc) 
{ 
case GRC_OK: 
//Positioning successful and precise 
break; 
/*case GRC_AUT_TIMEOUT: 
// measure timeout fault: increase timeout 
hrc = AUT_ReadTimeout(TimeoutPar); 
TimeoutPar.adPosTimeout[0] 
= __min(TimeoutPar.adPosTimeout[0]+=5,60); 
TimeoutPar.adPosTimeout[1] 
= __min(TimeoutPar.adPosTimeout[1]+=5,60); 
hrc = AUT_SetTimeout(TimeoutPar); 
break; 
case GRC_COM_TIMEDOUT: 
//increase timeout 
hrc = COM_GetTimeOut(nComTimeOut); 
nComTimeOut=__min(nComTimeOut+=5, 60); 
hrc = COM_SetTimeOut(nComTimeOut); 
break; 
case GRC_AUT_ANGLE_ERROR: 
// error within angle measurement: 
// switch inclination correction off 
hrc = TMC_SetInclineSwitch(OFF); 
break; 
default: 
// precise position not possible 
TryAgain = FALSE;*/ 
//if (rc == GRC_AUT_INCACC) 
//{ 
//Position successful but not precise 
//} 
//else 
{ 
	// Positioning not successful 
// here further error analyse possible 
//} 
//break; 
} 
} 
rc = AUS_SetUserAtrState(OFF); // Note: LOCK mode will 
// be automatically 
// reseted ! 
hrc = COM_SetTimeOut(nOldComTimeOut);// Set old time- 
// out 
 
//4.启动ATR功能 
//AUT_SetATRStatus(ON_) 
rc=AUT_SetATRStatus(ON); 
if(rc==GRC_OK) 
{ 
} 
else 
{ 
	AfxMessageBox("未能开启ATR!"); 
} 
 
//5.搜索棱镜(精密照准目标) 
 //AUT_FineAdjust3(0.05,0.05,False); 
 
ON_OFF_TYPE ATRState; 
double dHzSearchRange, dVSearchRange; 
dHzSearchRange=0.08;// search range in [rad] 
dVSearchRange=0.08; // search range in [rad] 
Result = AUS_GetUserAtrState(ATRState);// The ATR- 
// Status must // be set for 
// the fine 
// adjust 
// functionality 
if(ATRState==ON) 
{ 
// performs a fine position with a max. target 
// search range of 0.08rad (5gon) in Hz and V 
// direction 
Result = AUT_FineAdjust(dHzSearchRange, 
dVSearchRange, 
FALSE); 
/*switch (Result) // function return code 
{ 
case (GRC_OK): 
//fine adjust successful and precise 
break; 
case (GRC_AUT_NO_TARGET): 
//no target found. 
break; 
case (GRC_AUT_MULTIPLE_TARGETS): 
//multiple targets found. 
break; 
case (GRC_AUT_BAD_ENVIRONMENT): 
//inadequate environment conditions. 
	break; 
default: 
//fine adjust not successful 
//here further error analyse possible 
break; 
}*/ 
} 
 
//6.锁定目标 
//AUT_SetLockStatus(ON_) 
//AUT_LockIn 
 
GRC_TYPE result; 
result = AUS_SetUserLockState(ON);// enable lock mode 
if(result==GRC_OK) 
{ 
result = AUT_LockIn(); // activate target tracking 
if(result != GRC_OK) 
{ 
// Error handling 
} 
} 
 
 
//7.设置角度补偿功能后测量距离和角度 
//TMC_DoMeasure(TMC_CLEAR,TMC_AUTO_INC) 
//TMC_SerAngSwitch(SwCorr) 
//BAP_MeasDistanceAngle(BAP_DEF_DIST,dH,dV,dDistance) 
TMC_HZ_V_ANG OnlyAngle; 
    double SlopeDistance; 
    /****** End of Declarations ******/ 
	 
  // activate distance measurement 
    rc = TMC_DoMeasure(TMC_DEF_DIST, TMC_AUTO_INC); 
    if (rc == GRC_OK) 
	{ 
     // distance measurement successful 
     rc = TMC_GetSimpleMea(3000, OnlyAngle,SlopeDistance, TMC_MEA_INC); 
 
	 //利用角度和斜距数据 
	 HRESULT hr; 
		 try 
		 { 
			 hr=m_pConn.CreateInstance("ADODB.Connection");//创建Connection对象 
			 if(SUCCEEDED(hr)) 
			 { 
				 hr=m_pConn->Open("GEO","","",-1); 
			 } 
 
			 //向数据库添加数据distance and angle values 
			_variant_t RecordsAffected; 
			CString strSQL; 
			strSQL.Format("INSERT INTO 观测数据表(dV,dH,dS) VALUE('%s','%s','%s')",OnlyAngle.dV,OnlyAngle.dHz,SlopeDistance); 
 
             m_pConn->Execute((_bstr_t)strSQL,&RecordsAffected,adCmdText); 
 
 
 
		 } 
		 catch(_com_error e) 
		 { 
			 CString errormessage; 
			 errormessage.Format("连接数据库失败!\r\n错误信息:%s",e.ErrorMessage()); 
			 AfxMessageBox(errormessage); 
 
		 } 
 
 
 
	} 
 
 
 
 
//8.设置测量模式后获取测量坐标 
//TMC_DoMeasure(TMC_DEF_DIST,TMC_AUTO_INC) 
//TMC_GetCoordinate1(1000,Coordinate,TMC_AUTO_INC) 
 
TMC_COORDINATE Coordinate; 
// make a single distance measurement first 
rc=TMC_DoMeasure(TMC_DEF_DIST, TMC_AUTO_INC); 
if(rc==GRC_OK) 
{// before you get the coordinates 
Result=TMC_GetCoordinate(1000,Coordinate, 
TMC_AUTO_INC); 
} 
 
 
//9.关闭锁定ATR功能 
//AUT_SetLockStatus(OFF) 
//AUT_setATRStatus(OFF) 
 
rc=AUT_SetLockStatus(OFF); 
if(rc=GRC_OK) 
{ 
} 
else 
{ 
	AfxMessageBox("未能关闭Lock!"); 
} 
 
rc=AUT_SetATRStatus(OFF); 
if(rc=GRC_OK) 
{ 
} 
else 
{ 
	AfxMessageBox("未能关闭ATR!"); 
} 
 
 
 
} 
 
 
 
 
//10.倒镜 
//AUT_ChangeFace4(AUT_PRECISE,AUT_POSITION,FALSE) 
 
 
//11.关闭连接后自动关闭全站仪 
 
//COM_CloseConnection() 
//COM_End() 
//COM_SwitchOffTPS(0) 
 
	//AfxMessageBox("USER"); 
	rc=COM_CloseConnection(); 
	if(rc!=GRC_OK) 
	{ 
		AfxMessageBox("Can't close connection!"); 
 
	} 
	 
	rc=COM_End(); 
 
} 
}