📄 xxqkdlg.cpp
字号:
// xxqkdlg.cpp : implementation file
//
#include "stdafx.h"
#include "xxgl.h"
#include "xxqkdlg.h"
#include "strt.h"
#include "ext.h"
#include "func.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Cxxqkdlg::Cxxqkdlg(CWnd* pParent /*=NULL*/)
: CDialog(Cxxqkdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(Cxxqkdlg)
m_czhm = _T("");
m_dzyx = _T("");
m_lxdh = _T("");
m_lxr = _T("");
m_xxdz = _T("");
m_xxmc = _T("");
m_xzz = _T("");
m_yzbm = _T("");
//}}AFX_DATA_INIT
out_flag = 0;
}
void Cxxqkdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Cxxqkdlg)
DDX_Control(pDX, IDC_pblb, m_pblb);
DDX_Control(pDX, IDC_xxxz, m_xxxz);
DDX_Text(pDX, IDC_czhm, m_czhm);
DDX_Text(pDX, IDC_dzyx, m_dzyx);
DDX_Text(pDX, IDC_lxdh, m_lxdh);
DDX_Text(pDX, IDC_lxr, m_lxr);
DDX_Text(pDX, IDC_xxdz, m_xxdz);
DDX_Text(pDX, IDC_xxmc, m_xxmc);
DDX_Text(pDX, IDC_xzz, m_xzz);
DDX_Text(pDX, IDC_yzbm, m_yzbm);
//}}AFX_DATA_MAP
CBitmap *bitmap;
CBitmap *bitmap1;
HBITMAP hbitmap;
HBITMAP hbitmap1;
bitmap = new CBitmap();
bitmap1 = new CBitmap();
bitmap->LoadBitmap(IDB_qr);
bitmap1->LoadBitmap(IDB_qx);
hbitmap = (*bitmap).operator HBITMAP();
hbitmap1 = (*bitmap1).operator HBITMAP();
CWnd *wn;
CWnd *wn1;
wn = GetDlgItem(IDOK);
wn1 = GetDlgItem(IDCANCEL);
// wn2 = GetDlgItem(IDOK3);
WPARAM wParam;
LPARAM lParam;
wParam = (WPARAM) LOWORD(BS_LEFT | BS_BITMAP); // style
lParam = MAKELPARAM(TRUE, 0); // redraw flag
wn->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmap);
wn1->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmap1);
FILE *fpe;
unsigned char buf[300];
int n;
unsigned char pass[40];
int l,i,c,j,k,flag;
unsigned char mask;
rand_base = 1000;
fpe = fopen("c:\\xxsbgl\\mima.txt","rb");
fscanf(fpe,"%s\n%s\n",buf,pass);
fclose(fpe);
l = strlen((char *)buf);
for (i=0;i<l*8;i++){
c = buf[i/8];
mask = 1;
for (j=0;j<i%8;j++)
mask *= 2;
code[i] = c & mask;
if (code[i] != 0)
code[i] = 1;
}
for (i=0;i<1000;i++)
process_flag[i] = 0;
flag = 0;
j = 0;
while (flag == 0){
i = find_a_seat(l*8);
tab[j] = i;
process_flag[i] = 1;
j ++;
if (j == l*8)
flag = 1;
}
for (i=0;i<l*8;i++){
code6[i] = code[tab[i]];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l*8;i++){
j = i + l%7;
if (j >= l*8)
j -= l*8;
code1[i] = code[j];
}
for (i=0;i<l*4;i++){
code2[i] = code1[2*i+1];
}
for (i=0;i<l*8;i++){
j = i + l%7;
if (j > l*8)
j -= l*8;
code3[i] = code[j];
}
for (i=0;i<l*4;i++){
code4[i] = code3[2*i];
}
for (i=0;i<l*4;i++)
code5[i] = code2[i] ^ code4[i];
/*
k = 0;
for (i=0;i<l;i++){
c = code5[i*4]*8 + code5[i*4+1]*4 + + code5[i*4+2]*2 + + code5[i*4+3];
if (c < 10)
c += '0';
else
c += 'A' - 10;
pass[k++] = c;
}
pass[k] = 0;
*/
for (i=0;i<l;i++){
c = pass[i];
if (c >= 'A')
c = c - 'A' + 10;
else
c -= '0';
code5[4*i] = c / 8;
c = c % 8;
code5[4*i+1] = c / 4;
c = c % 4;
code5[4*i+2] = c / 2;
code5[4*i+3] = c % 2;
}
for (i=0;i<l*4;i++)
code2[i] = code5[i] ^ code4[i];
for (i=0;i<l*4;i++){
code1[2*i+1] = code2[i];
}
for (i=0;i<l*8;i++){
j = i - l%7;
if (j < 0)
j = j + l*8;
code[i] = code1[j];
}
for (i=0;i<l*8;i++){
code6[tab[i]] = code[i];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l;i++){
buf[i] = code[i*8] + code[i*8+1]*2 + code[i*8+2]*4 + code[i*8+3]*8
+ code[i*8+4]*16 + code[i*8+5]*32 + code[i*8+6]*64 + code[i*8+7]*128;
}
strcpy(xiaoming,(char *)buf);
m_xxmc = xiaoming;
SetDlgItemText(IDC_xxmc,xiaoming);
if (out_flag == 0){
fpe = fopen("c:\\xxsbgl\\xxxx.txt","r");
if (fpe != NULL){
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
strcpy(xxxz,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
strcpy(pblb,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_xxdz,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_lxdh,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_dzyx,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_yzbm,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_czhm,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_lxr,(char *)buf);
fgets((char *)buf,200,fpe);
buf[strlen((char *)buf)-1] = 0;
SetDlgItemText(IDC_xzz,(char *)buf);
fclose(fpe);
}
if (xxxz != ""){
m_xxxz.SelectString(0,xxxz);
}
if (pblb != ""){
m_pblb.SelectString(0,pblb);
}
}
}
BEGIN_MESSAGE_MAP(Cxxqkdlg, CDialog)
//{{AFX_MSG_MAP(Cxxqkdlg)
ON_CBN_SELCHANGE(IDC_xxxz, OnSelchangexxxz)
ON_CBN_SELCHANGE(IDC_pblb, OnSelchangepblb)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Cxxqkdlg message handlers
void Cxxqkdlg::OnSelchangexxxz()
{
// TODO: Add your control notification handler code here
int n;
n = m_xxxz.GetCurSel();
m_xxxz.GetLBText(n,xxxz);
}
void Cxxqkdlg::OnSelchangepblb()
{
// TODO: Add your control notification handler code here
int n;
n = m_pblb.GetCurSel();
m_pblb.GetLBText(n,pblb);
}
void Cxxqkdlg::OnOK()
{
// TODO: Add extra validation here
FILE *fpe;
char buf[300];
fpe = fopen("c:\\xxsbgl\\xxxx.txt","wb");
fprintf(fpe,"%s\r\n",xxxz);
fprintf(fpe,"%s\r\n",pblb);
GetDlgItemText(IDC_xxdz,buf,200);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_lxdh,buf,20);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_dzyx,buf,100);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_yzbm,buf,20);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_czhm,buf,20);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_lxr,buf,20);
fprintf(fpe,"%s\r\n",buf);
GetDlgItemText(IDC_xzz,buf,20);
fprintf(fpe,"%s\r\n",buf);
fclose(fpe);
out_flag = 1;
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -