• 1301阅读
  • 0回复

1.1一个最简单的外挂(EXE版本) [复制链接]

上一主题 下一主题
离线啊冲
 

只看楼主 倒序阅读 使用道具 楼主  发表于: 2015-10-25

// LLKAuxiliaryDlg.cpp : implementation file
//

#include "stdafx.h"
#include "LLKAuxiliary.h"
#include "LLKAuxiliaryDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLLKAuxiliaryDlg dialog

CLLKAuxiliaryDlg::CLLKAuxiliaryDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CLLKAuxiliaryDlg::IDD, pParent)
{
    //{{AFX_DATA_INIT(CLLKAuxiliaryDlg)
    m_Str = _T("");
    //}}AFX_DATA_INIT
    // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CLLKAuxiliaryDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CLLKAuxiliaryDlg)
    DDX_Text(pDX, IDC_EDIT_Str, m_Str);
    //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CLLKAuxiliaryDlg, CDialog)
    //{{AFX_MSG_MAP(CLLKAuxiliaryDlg)
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    ON_BN_CLICKED(IDC_BUTTON_GetWindow, OnBUTTONGetWindow)
    ON_BN_CLICKED(IDC_BUTTON_StartGame, OnBUTTONStartGame)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLLKAuxiliaryDlg message handlers

BOOL CLLKAuxiliaryDlg::OnInitDialog()
{
    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
    
    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 CLLKAuxiliaryDlg::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 CLLKAuxiliaryDlg::OnQueryDragIcon()
{
    return (HCURSOR) m_hIcon;
}

void CLLKAuxiliaryDlg::OnBUTTONGetWindow()
{
    // TODO: Add your control notification handler code here
    WCHAR szBuffer[255] = {0};
    //找到窗体
    HWND gameh = ::FindWindow(NULL,L"QQ游戏 - 连连看角色版");
    wsprintf(szBuffer,L"窗体句柄:%08X",gameh);
    m_Str = szBuffer;
    //TRUE 是更新窗体数据到内存
    //FALSE 是更新数据到窗体
    this->UpdateData(FALSE);
    return;
}

void CLLKAuxiliaryDlg::OnBUTTONStartGame()
{
    // TODO: Add your control notification handler code here
    RECT r1;
    POINT OldP;
    //找到窗体
    HWND gameh = ::FindWindow(NULL,L"QQ游戏 - 连连看角色版");
    //设置窗体属性
    ::SetWindowPos(gameh,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
    //得到窗体位置
    ::GetWindowRect(gameh,&r1);
    //656 567
    //保存原始鼠标位置
    GetCursorPos(&OldP);
    //设置鼠标位置
    SetCursorPos(r1.left+656,r1.top+567);
    //模拟鼠标单击事件
    //抬起
    mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
    //压下
    mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
    //抬起
    mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
    //休息一下
    Sleep(200);
    //还原鼠标原始位置
    SetCursorPos(OldP.x,OldP.y);
    return;
}
善者 慈悲心常在 无怨无恨 以苦为乐
默认压缩密码www.hifyl.com
文件分享密码问题:http://www.hifyl.com/read-htm-tid-4444.html
快速回复
限100 字节
批量上传需要先选择文件,再选择上传
 
上一个 下一个