ConfigDlg.cpp
资源名称:CQQFind.rar [点击查看]
上传用户:cxh888fhc
上传日期:2017-07-08
资源大小:240k
文件大小:4k
源码类别:
钩子与API截获
开发平台:
Visual C++
- // ConfigDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "CQQFind.h"
- #include "ConfigDlg.h"
- #include "CQQFindDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CConfigDlg dialog
- CConfigDlg::CConfigDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CConfigDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CConfigDlg)
- m_nCirCle = -1;
- m_nWidth = 1;
- //}}AFX_DATA_INIT
- }
- void CConfigDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CConfigDlg)
- DDX_Control(pDX, IDOK, m_btnOK);
- DDX_Control(pDX, IDCANCEL, m_btnCancel);
- DDX_Control(pDX, IDC_BTN_COLOR, m_btnColor);
- DDX_Radio(pDX, IDC_CIRCLE, m_nCirCle);
- DDX_Text(pDX, IDC_EDIT_WIDTH, m_nWidth);
- DDV_MinMaxInt(pDX, m_nWidth, 1, 6);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CConfigDlg, CDialog)
- //{{AFX_MSG_MAP(CConfigDlg)
- ON_WM_PAINT()
- ON_BN_CLICKED(IDC_BTN_COLOR, OnBtnColor)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CConfigDlg message handlers
- void CConfigDlg::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- CBrush brush;
- brush.CreateSolidBrush(m_clrDraw);
- CBrush *pOldBrush=(CBrush *)dc.SelectObject(brush);
- dc.Rectangle(86,28,118,56);
- // dc.SelectObject(pOldBrush);
- // Do not call CDialog::OnPaint() for painting messages
- }
- void CConfigDlg::OnBtnColor()
- {
- // TODO: Add your control notification handler code here
- CColorDialog dlg(m_clrDraw);
- if(dlg.DoModal()==IDOK)
- {
- m_clrDraw=dlg.GetColor();
- InvalidateRect(CRect(85,27,119,57),TRUE);
- }
- }
- BOOL CConfigDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- m_clrDraw=((CCQQFindDlg *)GetParent())->m_clrDraw;
- m_nWidth=((CCQQFindDlg *)GetParent())->m_nWidth;
- m_nCirCle=((CCQQFindDlg *)GetParent())->m_bCircle==TRUE?0:1;
- UpdateData(FALSE);
- m_btnCancel.SetDefaultButton(TRUE);
- m_btnColor.SetDefaultButton(TRUE);
- m_btnOK.SetDefaultButton(TRUE);
- m_btnOK.SetDefaultFace();
- m_btnColor.SetDefaultFace();
- m_btnCancel.SetDefaultFace();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CConfigDlg::OnOK()
- {
- // TODO: Add extra validation here
- SetWindowLong(m_hWnd,GWL_EXSTYLE,
- GetWindowLong(m_hWnd,GWL_EXSTYLE)|0x80000);
- HINSTANCE hInst = LoadLibrary("User32.DLL");
- if(hInst)
- {
- typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
- MYFUNC fun = NULL;
- fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
- if(fun)
- {
- int i=255*3;
- {
- while(i--)
- {
- MSG msg;
- while(PeekMessage(&msg,m_hWnd,0,0,PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- fun(m_hWnd,0,i/3,2);
- }
- }
- }
- FreeLibrary(hInst);
- }
- CDialog::OnOK();
- }
- void CConfigDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- SetWindowLong(m_hWnd,GWL_EXSTYLE,
- GetWindowLong(m_hWnd,GWL_EXSTYLE)|0x80000);
- HINSTANCE hInst = LoadLibrary("User32.DLL");
- if(hInst)
- {
- typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
- MYFUNC fun = NULL;
- fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
- if(fun)
- {
- int i=255*3;
- {
- while(i--)
- {
- MSG msg;
- while(PeekMessage(&msg,m_hWnd,0,0,PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- fun(m_hWnd,0,i/3,2);
- }
- }
- }
- FreeLibrary(hInst);
- }
- CDialog::OnCancel();
- }