📄 j_shkdlg.cpp
字号:
// j_shkDlg.cpp : implementation file
//
#include "stdafx.h"
#include "j_shk.h"
#include "j_shkDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CJ_shkDlg dialog
CJ_shkDlg::CJ_shkDlg(CWnd* pParent /*=NULL*/)
: CDialog(CJ_shkDlg::IDD, pParent)
{
m_bRecord=false;
m_bCp=false;
m_csRecord=_T("");
//{{AFX_DATA_INIT(CJ_shkDlg)
m_cs0 = _T("");
m_cs1 = _T("");
m_cs10 = _T("");
m_cs11 = _T("");
m_cs12 = _T("");
m_cs13 = _T("");
m_cs14 = _T("");
m_cs2 = _T("");
m_cs3 = _T("");
m_cs4 = _T("");
m_cs5 = _T("");
m_cs6 = _T("");
m_cs7 = _T("");
m_cs8 = _T("");
m_cs9 = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_pMySock=new CMySock(this);
}
void CJ_shkDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CJ_shkDlg)
DDX_Text(pDX, IDC_EDIT_0, m_cs0);
DDX_Text(pDX, IDC_EDIT_1, m_cs1);
DDX_Text(pDX, IDC_EDIT_10, m_cs10);
DDX_Text(pDX, IDC_EDIT_11, m_cs11);
DDX_Text(pDX, IDC_EDIT_12, m_cs12);
DDX_Text(pDX, IDC_EDIT_13, m_cs13);
DDX_Text(pDX, IDC_EDIT_14, m_cs14);
DDX_Text(pDX, IDC_EDIT_2, m_cs2);
DDX_Text(pDX, IDC_EDIT_3, m_cs3);
DDX_Text(pDX, IDC_EDIT_4, m_cs4);
DDX_Text(pDX, IDC_EDIT_5, m_cs5);
DDX_Text(pDX, IDC_EDIT_6, m_cs6);
DDX_Text(pDX, IDC_EDIT_7, m_cs7);
DDX_Text(pDX, IDC_EDIT_8, m_cs8);
DDX_Text(pDX, IDC_EDIT_9, m_cs9);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CJ_shkDlg, CDialog)
//{{AFX_MSG_MAP(CJ_shkDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_WM_NCHITTEST()
ON_BN_CLICKED(IDC_BUTTONERR, OnButtonerr)
ON_BN_CLICKED(IDC_BUTTON_CP, OnButtonCp)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SOCKTTHREAD,OnThread)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CJ_shkDlg message handlers
BOOL CJ_shkDlg::OnInitDialog()
{
SETLAYEREDWINDOWATTRIBUTES SetLayeredWindowAttributes;
HMODULE hMod =GetModuleHandle("user32");
if(hMod) SetLayeredWindowAttributes =(SETLAYEREDWINDOWATTRIBUTES)GetProcAddress(hMod, "SetLayeredWindowAttributes");
CDialog::OnInitDialog();
// 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
// SetWindowPos(&wndTopMost ,0,0,100,200,SWP_NOZORDER|SWP_NOMOVE|SWP_SHOWWINDOW );
::SetWindowPos(m_hWnd,HWND_TOPMOST, -1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
SetWindowLong(m_hWnd,GWL_EXSTYLE,GetWindowLong(m_hWnd,GWL_EXSTYLE)^WS_EX_LAYERED);
SetLayeredWindowAttributes(m_hWnd,RGB(0,0,0),200,LWA_ALPHA);
if(!m_pMySock->CreateSock())
AfxMessageBox("Socket建立失败");
//GotoDlgCtrl(GetDlgItem(IDC_STATIC));
m_diaRecord.Create(CDialogH::IDD,this);
//m_dRigh.Create(CDialogV::IDD,this);
//m_dLeft.Create(CDialogV::IDD,this);
//m_dFace.SetWindowText("对家");
//m_dRigh.SetWindowText("右家");
//m_dLeft.SetWindowText("左家");
//RECT rect;
//m_dRigh.GetWindowRect(&rect);
//rect.left+=300;rect.right+=300;
//m_dRigh.MoveWindow(&rect);
//m_dFace.ShowWindow(SW_SHOW);
//m_dRigh.ShowWindow(SW_SHOW);
//m_dLeft.ShowWindow(SW_SHOW);
return TRUE; // return TRUE unless you set the focus to a control
}
// 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 CJ_shkDlg::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 CJ_shkDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CJ_shkDlg::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::PreCreateWindow(cs);
// cs.dwExStyle|=WS_EX_TOPMOST;
}
int CJ_shkDlg::OnThread(WPARAM wParam, LPARAM lParam)
{
UpdateData(false);
return 0;
}
/*WM_NCHITTEST
UINT CSampleDialog : : OnNcHitTest (Cpoint point )
{
UINT nHitTest =Cdialog: : OnNcHitTest (point );
return (nHitTest = =HTCLIENT)? HTCAPTION : nHitTest ;
}*/
void CJ_shkDlg::OnButton1()
{
m_bRecord=!m_bRecord;
if(m_bRecord){
m_diaRecord.ShowWindow(SW_SHOW);
//m_dRigh.ShowWindow(SW_SHOW);
//m_dLeft.ShowWindow(SW_SHOW);
//CheckDlgButton(IDC_BUTTON1,2);
}else{
m_diaRecord.ShowWindow(SW_HIDE);
//m_dRigh.ShowWindow(SW_HIDE);
//m_dLeft.ShowWindow(SW_HIDE);
}
}
UINT CJ_shkDlg::OnNcHitTest(CPoint point)
{
// TODO: Add your message handler code here and/or call default
UINT nHitTest =CDialog:: OnNcHitTest (point );
return (nHitTest == HTCLIENT)? HTCAPTION : nHitTest ;
// return CDialog::OnNcHitTest(point);
}
void CJ_shkDlg::OnButtonerr()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(FALSE,NULL,"*.txt",NULL,"谢谢你的保存(*.txt)");
if(dlg.DoModal()==IDOK){
CStdioFile file;
if(!file.Open(dlg.GetPathName(),CFile::modeWrite|CFile::typeText|CFile::modeCreate)){
AfxMessageBox("Can't open file!");return;
}
file.WriteString( (LPCTSTR)m_csRecord);
}
}
void CJ_shkDlg::OnButtonCp()
{
// TODO: Add your control notification handler code here
// m_bCp=!m_bCp;
// if(m_bCp)
// SetDlgItemText(IDC_BUTTON_CP,"暂停追铺");
// else
// SetDlgItemText(IDC_BUTTON_CP,"开始追铺");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -