Dlg6.cpp
资源名称:WarH_2.10.rar [点击查看]
上传用户:tree100901
上传日期:2016-07-12
资源大小:182k
文件大小:3k
源码类别:
外挂编程
开发平台:
Visual C++
- // Dlg6.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "WarH.h"
- #include "Dlg6.h"
- #include "MH.h"
- #define ALPHA(n) (n * 255 / 100)
- // CDlg6 对话框
- IMPLEMENT_DYNAMIC(CDlg6, CDialog)
- CDlg6::CDlg6(CWnd* pParent /*=NULL*/)
- : CDialog(CDlg6::IDD, pParent)
- {
- }
- CDlg6::~CDlg6()
- {
- }
- void CDlg6::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_SLIDER1, m_Alpha);
- DDX_Control(pDX, IDC_MEGGAGE, m_Msg);
- }
- BOOL CDlg6::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_Alpha.SetRange(0, 100);
- m_Alpha.SetPos(80);
- m_tooltips.Create(GetDlgItem(IDC_SLIDER1));
- m_tooltips.Activate(TRUE);
- HWND hWnd = ::AfxGetApp()->m_pMainWnd->m_hWnd;
- ::SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) ^ WS_EX_LAYERED);
- ::SetLayeredWindowAttributes(hWnd, 0, ALPHA(m_Alpha.GetPos()), LWA_ALPHA);
- return FALSE;
- }
- BEGIN_MESSAGE_MAP(CDlg6, CDialog)
- ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
- ON_WM_HSCROLL()
- ON_BN_CLICKED(IDC_MH, &CDlg6::OnBnClickedMh)
- ON_WM_CTLCOLOR()
- END_MESSAGE_MAP()
- // CDlg6 消息处理程序
- HBRUSH CDlg6::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
- {
- HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
- // TODO: 在此更改 DC 的任何属性
- int nID = pWnd->GetDlgCtrlID();
- switch (nID)
- {
- case IDC_STATIC:
- pDC->SetTextColor(RGB(0, 0, 255));
- break;
- case IDC_STATIC_LOW:
- case IDC_STATIC_HIG:
- case IDC_STATIC_VER:
- pDC->SetTextColor(RGB(255, 0, 0));
- break;
- }
- // TODO: 如果默认的不是所需画笔,则返回另一个画笔
- return hbr;
- }
- void CDlg6::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
- {
- // TODO: Add your message handler code here and/or call default
- CDialog::OnHScroll(nSBCode,nPos,pScrollBar);
- CSliderCtrl *pSlidCtrl=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
- int m_nCur=pSlidCtrl->GetPos();
- CString str;
- str.Format(_T("%dn"),m_nCur);
- TRACE(str);
- HWND hWnd = ::AfxGetApp()->m_pMainWnd->m_hWnd;
- ::SetLayeredWindowAttributes(hWnd, 0, ALPHA(m_Alpha.GetPos()), LWA_ALPHA);
- m_tooltips.Update();
- }
- BOOL CDlg6::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
- {
- TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
- UINT nID = pNMHDR->idFrom;
- if (pTTT->uFlags & TTF_IDISHWND)
- {
- // idFrom is actually the HWND of the tool
- nID = ::GetDlgCtrlID((HWND)nID);
- if (nID)
- {
- CString strToolTips;
- strToolTips.Format(_T("Alpha:%d%c"), m_Alpha.GetPos(), '%');
- wcscpy(pTTT->lpszText, strToolTips);
- pTTT->hinst = NULL;
- return(TRUE);
- }
- }
- return(FALSE);
- }
- CListBox* pMsg;
- void text(LPCTSTR s)
- {
- if (pMsg->GetCount() > 100)
- pMsg->ResetContent();
- pMsg->InsertString(pMsg->GetCount(), s);
- }
- void CDlg6::OnBnClickedMh()
- {
- // TODO: 在此添加控件通知处理程序代码
- pMsg = &m_Msg;
- startMH(text);
- }