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

📄 setposition.cpp

📁 服务端: 这是一个完整的基于Wince 4.1图形图象,网络通讯(C/S)模式下的商用程序源代码包.
💻 CPP
字号:
// SetPosition.cpp : implementation file
//

#include "stdafx.h"
#include "PPPServer.h"
#include "SetPosition.h"

#include "pppserverdlg.h"

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

extern CString m_ini_pathname;
extern CPPPServerDlg *m_main_dlg;
extern bool m_show_demo_flag;
/////////////////////////////////////////////////////////////////////////////
// CSetPosition dialog


CSetPosition::CSetPosition(CWnd* pParent /*=NULL*/)
	: CDialog(CSetPosition::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetPosition)
	m_startx = 0;
	m_starty = 0;
	//}}AFX_DATA_INIT
}


void CSetPosition::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetPosition)
	DDX_Text(pDX, IDC_POSX_EDIT, m_startx);
	DDV_MinMaxLong(pDX, m_startx, 0, 1024);
	DDX_Text(pDX, IDC_POSY_EDIT, m_starty);
	DDV_MinMaxLong(pDX, m_starty, 0, 768);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetPosition, CDialog)
	//{{AFX_MSG_MAP(CSetPosition)
	ON_BN_CLICKED(IDC_SETPOS_BUTTON, OnSetposButton)
	ON_BN_CLICKED(IDC_OK_BUTTON, OnOkButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetPosition message handlers

BOOL CSetPosition::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//read parameter file
	//...m_startx,m_starty
	m_startx=m_system_para.m_show_startx;
	m_starty=m_system_para.m_show_starty;
	//POS X
	CSpinButtonCtrl *pXSpin=(CSpinButtonCtrl *)GetDlgItem(IDC_POSX_SPIN);
	ASSERT(pXSpin!=NULL);
	pXSpin->SetBuddy(GetDlgItem(IDC_POSX_EDIT));
	pXSpin->SetRange(0,1024);
	pXSpin->SetPos(m_startx);
	//POS Y
	CSpinButtonCtrl *pYSpin=(CSpinButtonCtrl *)GetDlgItem(IDC_POSY_SPIN);
	ASSERT(pYSpin!=NULL);
	pYSpin->SetBuddy(GetDlgItem(IDC_POSY_EDIT));
	pYSpin->SetRange(0,768);
	pYSpin->SetPos(m_starty);

	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetPosition::OnSetposButton() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
    m_system_para.m_show_startx=m_startx;
	m_system_para.m_show_starty=m_starty;
	//save
	
	 FILE *fp;
	 fp=_tfopen(m_ini_pathname,L"wb");
	 if(fp)
	 {
       
	   fwrite((char*)&m_system_para,1,sizeof(SYSTEM_PARAMETER),fp);  
	   
       fclose(fp);
	 }
	 /*
	 //way 2 HAVE BUG!!!
	 char str[256];
	 _ltoa(m_show_startx,str,10);
	 CFG_set_key(m_ini_pathname,"POSITION","X",str);
	 _ltoa(m_show_starty,str,10);
	 CFG_set_key(m_ini_pathname,"POSITION","Y",str);
	 */
	 //
    //send set pos size message	
	 m_main_dlg->m_demo_dlg.SetPosSize(m_system_para.m_show_startx,
		                               m_system_para.m_show_starty,
		                               m_system_para.m_show_width,
									   m_system_para.m_show_height,
									   m_show_demo_flag);
	 //
	 	EndDialog(0);
}

void CSetPosition::OnOkButton() 
{
	// TODO: Add your control notification handler code here
		EndDialog(0);
}

⌨️ 快捷键说明

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