?? worddlg.cpp
字號:
// CodeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "cradle.h"
#include "WordDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CwordDlg dialog
int atoibase2(const char * string)
{
int nRet=0;
const char* temp=string;
int len=strlen(string);
while((*temp)!=0)
{
nRet+=(((*temp)-48)<<(len-1-(temp-string)));
temp+=1;
}
return nRet;
}
CwordDlg::CwordDlg(CWnd* pParent /*=NULL*/)
: CDialog(CwordDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CwordDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CwordDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CwordDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CwordDlg, CDialog)
//{{AFX_MSG_MAP(CwordDlg)
ON_EN_CHANGE(IDC_CODE32, OnChangeCode32)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CwordDlg message handlers
BOOL CwordDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
for(int i=0; i<32; i++)
{
m_ctrlChoose[i].SubclassDlgItem(IDC_CODE1+i,this);
m_ctrlChoose[i].SetLimitText(8);
CString str;
itoa(m_ytCodeSelecting[i],str.GetBuffer(100),2);
str.ReleaseBuffer();
char temp[9];
while(str.GetLength()<8)
str.Insert(0,'0');
memcpy(temp,str.Right(8),8);
temp[9]=0;
m_ctrlChoose[i].SetSel(0,-1);
m_ctrlChoose[i].ReplaceSel(temp);
}
for(i=0; i<5; i++)
{
m_ctrlAct[i].SubclassDlgItem(IDC_CODE_UP+i,this);
m_ctrlAct[i].SetLimitText(8);
CString str;
itoa(m_ytCodeAction[i],str.GetBuffer(100),2);
str.ReleaseBuffer();
char temp[9];
while(str.GetLength()<8)
str.Insert(0,'0');
memcpy(temp,str.Right(8),8);
temp[9]=0;
m_ctrlAct[i].SetSel(0,-1);
m_ctrlAct[i].ReplaceSel(temp);
}
for(i=0; i<6; i++)
{
m_ctLens[i].SubclassDlgItem(IDC_CODE_FOCUS1+i,this);
m_ctLens[i].SetLimitText(8);
CString str;
itoa(m_ytCodeLens[i],str.GetBuffer(100),2);
str.ReleaseBuffer();
char temp[9];
while(str.GetLength()<8)
str.Insert(0,'0');
memcpy(temp,str.Right(8),8);
temp[9]=0;
m_ctLens[i].SetSel(0,-1);
m_ctLens[i].ReplaceSel(temp);
}
for(i=0; i<3; i++)
{
m_ctrlStatus[i].SubclassDlgItem(IDC_CODE_LIGHT+i,this);
m_ctrlStatus[i].SetLimitText(8);
CString str;
itoa(m_ytCodeIdentity[i],str.GetBuffer(100),2);
str.ReleaseBuffer();
char temp[9];
while(str.GetLength()<8)
str.Insert(0,'0');
memcpy(temp,str.Right(8),8);
temp[9]=0;
m_ctrlStatus[i].SetSel(0,-1);
m_ctrlStatus[i].ReplaceSel(temp);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CwordDlg::OnOK()
{
// TODO: Add extra validation here
//to edit : write to ini file to save code settings
char code[9];
code[9]=0;
for(int i=0; i<32; i++)
{
m_ctrlChoose[i].GetLine(0,code,8);
m_ytCodeSelecting[i]=(BYTE)atoibase2(code);
}
for(i=0; i<5; i++)
{
m_ctrlAct[i].GetLine(0,code,8);
m_ytCodeAction[i]=(BYTE)atoibase2(code);
}
for(i=0; i<6; i++)
{
m_ctLens[i].GetLine(0,code,8);
m_ytCodeLens[i]=(BYTE)atoibase2(code);
}
for(i=0; i<3; i++)
{
m_ctrlStatus[i].GetLine(0,code,8);
m_ytCodeIdentity[i]=(BYTE)atoibase2(code);
}
CDialog::OnOK();
}
void CwordDlg::OnChangeCode32()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -