📄 winable.h
字号:
// --------------------------------------------------------------------------
//
// WINABLE.H
//
// Hooking mechanism to receive system events.
//
// --------------------------------------------------------------------------
#ifndef _WINABLE_
#define _WINABLE_
#if !defined(_WINABLE_)
#define WINABLEAPI DECLSPEC_IMPORT
#else
#define WINABLEAPI
#endif
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include <stdarg.h>
//
// In USER32
//
//
// This gets GUI information out of context. If you pass in a NULL thread ID,
// we will get the 'global' information, using the foreground thread. This
// is guaranteed to be the real active window, focus window, etc. Yes, you
// could do it yourself by calling GetForegorundWindow, getting the thread ID
// of that window via GetWindowThreadProcessId, then passing the ID into
// GetGUIThreadInfo(). However, that takes three calls and aside from being
// a pain, anything could happen in the middle. So passing in NULL gets
// you stuff in one call and hence also works right.
//
typedef struct tagGUITHREADINFO
{
DWORD cbSize;
DWORD flags;
HWND hwndActive;
HWND hwndFocus;
HWND hwndCapture;
HWND hwndMenuOwner;
HWND hwndMoveSize;
HWND hwndCaret;
RECT rcCaret;
} GUITHREADINFO, FAR * LPGUITHREADINFO;
#define GUI_CARETBLINKING 0x00000001
#define GUI_INMOVESIZE 0x00000002
#define GUI_INMENUMODE 0x00000004
#define GUI_SYSTEMMENUMODE 0x00000008
#define GUI_POPUPMENUMODE 0x00000010
BOOL
WINAPI
GetGUIThreadInfo(
DWORD idThread,
LPGUITHREADINFO lpgui
);
UINT
WINAPI
GetWindowModuleFileNameW(
HWND hwnd,
LPWSTR lpFileName,
UINT cchFileName
);
UINT
WINAPI
GetWindowModuleFileNameA(
HWND hwnd,
LPSTR lpFileName,
UINT cchFileName
);
#ifdef UNICODE
#define GetWindowModuleFileName GetWindowModuleFileNameW
#else
#define GetWindowModuleFileName GetWindowModuleFileNameA
#endif
//
// This returns FALSE if the caller doesn't have permissions to do this
// esp. if someone else is dorking with input. I.E., if some other thread
// disabled input, and thread 2 tries to diable/enable it, the call will
// fail since thread 1 has the cookie.
//
BOOL
WINAPI
BlockInput(
BOOL fBlockIt
);
#if (_WIN32_WINNT < 0x0403) // these structures and this function prototype
// are in NT 4.03 and above winuser.h
//
// Note that the dwFlags field uses the same flags as keybd_event and
// mouse_event, depending on what type of input this is.
//
typedef struct tagMOUSEINPUT {
LONG dx;
LONG dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
DWORD dwExtraInfo;
} MOUSEINPUT, *PMOUSEINPUT, FAR* LPMOUSEINPUT;
typedef struct tagKEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
DWORD dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT, FAR* LPKEYBDINPUT;
typedef struct tagHARDWAREINPUT {
DWORD uMsg;
WORD wParamL;
WORD wParamH;
DWORD dwExtraInfo;
} HARDWAREINPUT, *PHARDWAREINPUT, FAR* LPHARDWAREINPUT;
#define INPUT_MOUSE 0
#define INPUT_KEYBOARD 1
#define INPUT_HARDWARE 2
typedef struct tagINPUT {
DWORD type;
union
{
MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
};
} INPUT, *PINPUT, FAR* LPINPUT;
//
// This returns the number of inputs played back. It will disable input
// first, play back as many as possible, then reenable input. In the middle
// it will pulse the RIT to make sure that the fixed input queue doesn't
// fill up.
//
UINT
WINAPI
SendInput(
UINT cInputs, // number of input in the array
LPINPUT pInputs, // array of inputs
int cbSize); // sizeof(INPUT)
#endif // (_WIN32_WINNT < 0x0403)
//
// This generates a notification that anyone watching for it will get.
// This call is superfast if nobody is hooking anything.
//
WINABLEAPI
void
WINAPI
NotifyWinEvent(
DWORD event,
HWND hwnd,
LONG idObject,
LONG idChild
);
//
// hwnd + idObject can be used with OLEACC.DLL's OleGetObjectFromWindow()
// to get an interface pointer to the container. indexChild is the item
// within the container in question. Setup a VARIANT with vt VT_I4 and
// lVal the indexChild and pass that in to all methods. Then you
// are raring to go.
//
//
// Common object IDs (cookies, only for sending WM_GETOBJECT to get at the
// thing in question). Positive IDs are reserved for apps (app specific),
// negative IDs are system things and are global, 0 means "just little old
// me".
//
#define CHILDID_SELF 0
// Reserved IDs for system objects
#define OBJID_WINDOW 0x00000000
#define OBJID_SYSMENU 0xFFFFFFFF
#define OBJID_TITLEBAR 0xFFFFFFFE
#define OBJID_MENU 0xFFFFFFFD
#define OBJID_CLIENT 0xFFFFFFFC
#define OBJID_VSCROLL 0xFFFFFFFB
#define OBJID_HSCROLL 0xFFFFFFFA
#define OBJID_SIZEGRIP 0xFFFFFFF9
#define OBJID_CARET 0xFFFFFFF8
#define OBJID_CURSOR 0xFFFFFFF7
#define OBJID_ALERT 0xFFFFFFF6
#define OBJID_SOUND 0xFFFFFFF5
#define CCHILDREN_FRAME 7
//
// System Alerts (indexChild of system ALERT notification)
//
#define ALERT_SYSTEM_INFORMATIONAL 1 // MB_INFORMATION
#define ALERT_SYSTEM_WARNING 2 // MB_WARNING
#define ALERT_SYSTEM_ERROR 3 // MB_ERROR
#define ALERT_SYSTEM_QUERY 4 // MB_QUESTION
#define ALERT_SYSTEM_CRITICAL 5 // HardSysErrBox
#define CALERT_SYSTEM 6
typedef DWORD HWINEVENTHOOK;
typedef VOID (CALLBACK* WINEVENTPROC)(
HWINEVENTHOOK hEvent,
DWORD event,
HWND hwnd,
LONG idObject,
LONG idChild,
DWORD idEventThread,
DWORD dwmsEventTime);
#define WINEVENT_OUTOFCONTEXT 0x0000 // Events are ASYNC
#define WINEVENT_SKIPOWNTHREAD 0x0001 // Don't call back for events on installer's thread
#define WINEVENT_SKIPOWNPROCESS 0x0002 // Don't call back for events on installer's process
#define WINEVENT_INCONTEXT 0x0004 // Events are SYNC, this causes your dll to be injected into every process
#define WINEVENT_32BITCALLER 0x8000 // ;Internal
#define WINEVENT_VALID 0x8007 // ;Internal
WINABLEAPI
HWINEVENTHOOK
WINAPI
SetWinEventHook(
DWORD eventMin,
DWORD eventMax,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -