|
|
http://yunpan.cn/QGq4Ubh46vMYp
// xlsx.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "xlsx.h"
#include "WGForm.h"
//RECT GameRECT;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
WGForm *gameform;
HWND gameh;
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CXlsxApp
BEGIN_MESSAGE_MAP(CXlsxApp, CWinApp)
//{{AFX_MSG_MAP(CXlsxApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CXlsxApp construction
CXlsxApp::CXlsxApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CXlsxApp object
int CXlsxApp::ExitInstance()
{
delete gameform;//释放相应内存空间
gameform=NULL;
return CWinApp::ExitInstance();//winApp基类函数
}
CXlsxApp theApp;
LRESULT CALLBACK Gameproc(
int code, // hook code
WPARAM wParam, //按键代码 =VK_F12 VK_HOME
LPARAM lParam // 31位为0 则是被按下
)
{ AFX_MANAGE_STATE(AfxGetStaticModuleState());
//比如说 按下VK_HOME 我们要做什么 WM_LBUTTONUP WM_LBUTTONDOWN
//if ((wParam==VK_HOME)&&((lParam&(1<<31))==0))
/*if (wParam==WM_LBUTTONUP)
{
//AfxMessageBox("按下Home键");
if (gameform==NULL)
{
gameform=new WGForm;
gameform->Create(IDD_DIALOG1);
gameform->ShowWindow(true);
}
}*/
if (GetActiveWindow()!=gameh)
{
if (WH_GETMESSAGE)
{
if (gameform==NULL)
{
gameform=new WGForm;
gameform->Create(IDD_DIALOG1);
gameform->ShowWindow(true);
}
}
}
return CallNextHookEx(0,code,wParam,lParam);
}
//Afx:400000:0:10011:0:0
//Afx:400000:0:10011:0:0
//#define GameClass "Afx:400000:0:10011:0:0"
#define GameCaption1 "【兽血沸腾】决战多洛特-1.083.011"
#define GameCaption2 "【迅雷兽血沸腾】 战神化身-1.083.011"
//#define GameCaption2 "【迅雷兽血沸腾】 战神化身-1.082.012 经典网通一区-贾巴尔w1-1"
//#define GameCaption2 "???乃-驹?てō? OBそ代-1.072.032"
//#define GameCaption "新建 文本文档 - 记事本"
//安装勾子的函数
void SetHook()
{ AFX_MANAGE_STATE(AfxGetStaticModuleState());
//获取游戏主线程ID号
//FindWindow
gameh=FindWindow(NULL,GameCaption1);
if (gameh>0)
{
//GetWindowThreadProcessID
DWORD tid=::GetWindowThreadProcessId(gameh,NULL);
//安装线程勾子
::SetWindowsHookEx(WH_MOUSE,&Gameproc,::GetModuleHandle("xlsx.dll"),tid);
}
//SendMessage(gameh1,WM_LBUTTONUP,0,NULL); //抬起鼠标左键
/*
char s,GameCaption;
GameCaption=GetWindowText(gameh,&s,50);
//SetWindowText(gameh,&GameCaption+1);
char * ss;
ss="【迅雷兽血沸腾】 战神化身-1.081.008";
if ((&GameCaption+1)==ss)
{
SetWindowText(gameh,&GameCaption+11);
}
else
{
//SetWindowText(gameh,&GameCaption);
}
}*/
gameh=FindWindow(NULL,GameCaption2);;
if (gameh>0)
{
//GetWindowThreadProcessID
DWORD tid=::GetWindowThreadProcessId(gameh,NULL);
//安装线程勾子
//::SetWindowsHookEx(WH_KEYBOARD,&Gameproc,::GetModuleHandle("xlsx.dll"),tid);
::SetWindowsHookEx(WH_MOUSE,&Gameproc,::GetModuleHandle("xlsx.dll"),tid);
}
}
|
|