📄 nddlg.cpp
字号:
// nddlg.cpp : implementation file
//
#include "stdafx.h"
#include "xxgl.h"
#include "nddlg.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
Cnddlg::Cnddlg(CWnd* pParent /*=NULL*/)
: CDialog(Cnddlg::IDD, pParent)
{
//{{AFX_DATA_INIT(Cnddlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void Cnddlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Cnddlg)
DDX_Control(pDX, IDC_nd, m_nd);
//}}AFX_DATA_MAP
CBitmap *bitmap;
HBITMAP hbitmap;
bitmap = new CBitmap();
bitmap->LoadBitmap(IDB_qr);
hbitmap = (*bitmap).operator HBITMAP();
CWnd *wn;
wn = GetDlgItem(IDOK);
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);
int year;
time_t ltime;
struct tm *pti;
char tmpbuf[100];
char buf[1000];
char bu[1000];
time(<ime);
pti = gmtime(<ime);
year = pti->tm_year + 1900;
itoa(year,buf,10);
m_nd.SelectString(0,buf);
}
BEGIN_MESSAGE_MAP(Cnddlg, CDialog)
//{{AFX_MSG_MAP(Cnddlg)
ON_CBN_EDITCHANGE(IDC_nd, OnEditchangend)
ON_CBN_SELCHANGE(IDC_nd, OnSelchangend)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Cnddlg message handlers
void Cnddlg::OnOK()
{
// TODO: Add extra validation here
int t;
char buf[20];
GetDlgItemText(IDC_nd,buf,10);
t = atoi(buf);
if ((t < 1998)||(t > 2100)){
MessageBox("报表年度错误.","",MB_OK);
CWnd *wd;
wd = GetDlgItem(IDC_nd);
wd->SetFocus();
return;
}
g_nzbb_nd = t;
CDialog::OnOK();
}
void Cnddlg::OnEditchangend()
{
// TODO: Add your control notification handler code here
char buf[40];
int l,i,flag,j;
GetDlgItemText(IDC_nd,buf,12);
l = strlen(buf);
if (l > 0){
if (l > 4){
buf[4] = 0;
SetDlgItemText(IDC_nd,buf);
}
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
if (i == 0){
strcpy(buf,"2000");
}
else
buf[i] = 0;
SetDlgItemText(IDC_nd,buf);
}
}
}
}
void Cnddlg::OnSelchangend()
{
// TODO: Add your control notification handler code here
char buf[40];
int l,i,flag,j;
int n;
n = m_nd.GetCurSel();
m_nd.GetLBText(n,buf);
l = strlen(buf);
if (l > 0){
if (l > 4){
buf[4] = 0;
SetDlgItemText(IDC_nd,buf);
}
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
if (i == 0){
strcpy(buf,"2000");
}
else
buf[i] = 0;
SetDlgItemText(IDC_nd,buf);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -