
#ifndef APIMACRO_H
#define APIMACRO_H
//方便使用的几个API宏
// Sets the dialog box icons
inline void chSETDLGICONS(HWND hWnd, int idi) {
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)
LoadIcon((HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
MAKEINTRESOURCE(idi)));
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)
LoadIcon((HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
MAKEINTRESOURCE(idi)));
}
inline void chMB(PCSTR szMsg) {
char szTitle[MAX_PATH];
GetModuleFileNameA(NULL, szTitle, _countof(szTitle));
MessageBoxA(GetActiveWindow(), szMsg, szTitle, MB_OK);
}
#define chBEGINTHREADEX(psa, cbStackSize, pfnStartAddr, \
pvParam, dwCreateFlags, pdwThreadId) \
((HANDLE)_beginthreadex( \
(void *) (psa), \
(unsigned) (cbStackSize), \
(PTHREAD_START) (pfnStartAddr), \
(void *) (pvParam), \
(unsigned) (dwCreateFlags), \
(unsigned *) (pdwThreadId)))
#endif
//{
{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Main.rc
//
#define IDD_DIALOG 101
#define IDR_MENU1 102
#define IDD_DIALOG2 103
#define IDI_ICON 104
#define IDB_BITMAP1 105
#define IDB_BITMAP 105
#define IDR_MENU2 106
#define IDC_SHOW 1001
#define IDC_WIN 1002
#define IDC_STATIC1 1003
#define IDC_1 1004
#define IDC_2 1005
#define IDC_4 1006
#define IDC_6 1007
#define IDC_7 1008
#define IDC_8 1009
#define IDC_EDIT1 1010
#define IDC_EDIT2 1011
#define IDC_EDITL1 1012
#define IDC_EDIT4 1013
#define IDC_EDITL4 1014
#define IDC_EDIT6 1015
#define IDC_EDIT5 1015
#define IDC_EDIT7 1016
#define IDC_EDIT8 1017
#define IDC_EDITR3 1018
#define IDC_EDITR1 1019
#define IDC_EDITR2 1020
#define IDC_EDITL2 1021
#define IDC_EDITL3 1022
#define IDC_EDITR4 1023
#define IDC_CHECK 1024
#define IDC_CHANGE 1024
#define ID_40001 40001
#define IDM_HELP_ABOUT 40002
#define ID_40003 40003
#define ID_EXIT 40004
#define ID_40005 40005
#define ID_SHOW 40006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40007
#define _APS_NEXT_CONTROL_VALUE 1025
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
#include <windows.h>
#include <process.h>
#include <shellapi.h>
#include "resource.h"
#include "ApiMacro.h"
//搞掉些烦人的警告
#pragma warning(disable:4244)
#pragma warning(disable:4996)
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0'\
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#define WM_HOOK WM_USER+0x100 //钩子和主窗口通信的消息(这里没用到,钩子如果放在DLL中就需要了)
#define WM_SHELLNOFITY WM_USER+0x50 //托盘消息ID
#define ID 0 //托盘图标ID
#define CHAT_MOD 0x6FAE8450 //聊天模式地址
#define TIME 1 //计时器ID
BOOL CALLBACK DialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); //主窗口过程
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL EnablePrivilege(PCTSTR szPrivilege, BOOL fEnable); //提升本进程权限(调试权限)
VOID Function_Set(HWND hDlg, BOOL bEnable); //一些设置
VOID IniSetting(HWND hDlg); //初始化设置(读取配置文件)
VOID SaveSetting(HWND hDlg); //退出时保存设置(保存配置文件)
LPCSTR IniFileName = ".\\K.ini"; //配置文件
HINSTANCE hInst; //本模块实例句柄
HWND hWnd; //本模块窗口句柄
HWND hWar3; // 魔兽争霸窗口句柄
HWND hWar3Stau; //记录游戏是否运行的控件
DWORD dwMessage; //窗口句柄和自定义消息ID,用来和主窗口通信
BOOL g_bPrivilege; // 是否启动特权成功
BOOL g_bActive; // 魔兽窗口是否激活
BOOL g_bShow; // 显示血条
BOOL g_bInvalidWin; // 是否屏蔽WIN键
BOOL g_bChangeKey; // 是否启动改键盘
//小键盘改键数据
WORD g_OldData[10] = { VK_NUMPAD0, VK_NUMPAD1,VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9};
WORD g_NewData[10];
//技能改键数据
WORD g_OldSkill[5];
WORD g_NewSkill[5];
UINT WINAPI Activation_Test(PVOID); //线程检测魔兽窗口是否激活
BOOL Set_Hook(DWORD dwThreadId, DWORD dwMessageId, BOOL bInstall); //安装钩子
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
hInst = hInstance;
g_bPri