www.gusucode.com > 侠盗猎车手圣安地列斯DIY作弊器VC++源码-源码程序 > 侠盗猎车手圣安地列斯DIY作弊器VC++源码-源码程序\code\侠盗猎车手GDlg.cpp

    // 侠盗猎车手GDlg.cpp : implementation file
//作者:仁者紫轩   娱乐之余,主要是帮新手学习一下消息函数、抓句柄函数以及列表控件
//这个程序简单好用,网上想找一个万能侠盗作弊器也没有,无赖,自己做了个可以DIY的
//使用时注意:先开本程序,但不要点RUN,添加要用的作弊码(内置几个常用的)然后开游戏
//进入场景后切出来点RUN,你有10秒的时间进入游戏(一定是进场景),进去后不要按键,
//这时会自动开刷,直到没有“作弊码开启”出现,这就可以了
// Download by http://www.NewXing.com
#include "stdafx.h"
#include "侠盗猎车手G.h"
#include "侠盗猎车手GDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGDlg dialog

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

void CGDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGDlg)
	DDX_Control(pDX, IDC_CODELIST, m_ListBox);
	DDX_Text(pDX, IDC_ADDEDIT, m_Edit);
	DDX_Text(pDX, IDC_EDIT1, m_Addr);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CGDlg, CDialog)
	//{{AFX_MSG_MAP(CGDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_ADDBUTTON, OnAddbutton)
	ON_BN_CLICKED(IDC_DELBUTTON, OnDelbutton)
	ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGDlg message handlers

BOOL CGDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// 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
	m_ListBox.AddString("HESOYAM");
	m_ListBox.AddString ("PROFESSIONALSKIT");
    m_ListBox.AddString ("FULLCLIP");
    m_Addr="http://hi.baidu.com/new/renzhezixuan";
	UpdateData(FALSE);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CGDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// 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 CGDlg::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 CGDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}
void SendGameCode(CString s_Code,HWND hWnd)
{
	int i;
	for (i=0;i<s_Code.GetLength();i++)
	{
		::SendMessage(hWnd,WM_KEYDOWN,s_Code[i],0);
	    Sleep(100);
		::SendMessage(hWnd,WM_KEYUP,s_Code[i],0);
	    Sleep(100);
	}
}

void CGDlg::OnOK() 
{		
	::Sleep(6000);
	 //HWND hWnd=::FindWindow(NULL,"GTA: San Andreas");
	  CString str;
	  POINT curpos;
      GetCursorPos(&curpos);
      HWND hWnd =:: WindowFromPoint(curpos);
	if(hWnd)
	{
		for(int i=0;i<m_ListBox.GetCount();i++)
		{
        m_ListBox.GetText(i,str);
		SendGameCode(str,hWnd);
		//Sleep(1000);
		}
	}
	else
	MessageBox("找不到程序,可能是您的游戏还没有运行!","敬告");
}

void CGDlg::OnAddbutton() 
{
	     UpdateData(TRUE);
         m_ListBox.AddString (m_Edit);
}

void CGDlg::OnDelbutton() 
{
	if(m_ListBox.GetCurSel()!=LB_ERR)
   m_ListBox.DeleteString(m_ListBox.GetCurSel());
}

void CGDlg::OnChangeEdit1() 
{
    m_Addr="http://hi.baidu.com/new/renzhezixuan";
	UpdateData(FALSE);
}