1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include "stdafx.h"
#include <windows.h>
HDC hdc;
PAINTSTRUCT ps;
/***Serpent's function****************/
void LeftClick(void)
{
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}/************************************/
HWND hwnd,hwnd_outra_win;
MSG messages;
POINT pos_cursor;
POINT Move_mouse(int x,int y){
GetCursorPos(&pos_cursor);
pos_cursor.x+=(long)x;pos_cursor.y+=(long)y;
SetCursorPos(pos_cursor.x,pos_cursor.y);
return pos_cursor;
}
const int i_velox = 10;
const int hk_f4 = 0x64;
const int hk_cima = 0x26;
const int hk_baixo = 0x28;
const int hk_dir = 0x27;
const int hk_esq = 0x25;
LRESULT CALLBACK WinProc_Principal (HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
switch (message){
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
SetBkMode(hdc,TRANSPARENT);
ExtTextOut(hdc,10,5,ETO_OPAQUE,0,TEXT("by: wn_br"),9,0);
ExtTextOut(hdc,10,30,ETO_OPAQUE,0,TEXT("thanks to Serpent !"),19,0);
EndPaint(hwnd,&ps);
break;
case WM_HOTKEY:
if(wParam == (long)hk_f4)
LeftClick();
else if(wParam == (long)hk_cima) Move_mouse(0,-i_velox);
else if(wParam == (long)hk_baixo) Move_mouse(0,+i_velox);
else if(wParam == (long)hk_dir) Move_mouse(+i_velox,0);
else if(wParam == (long)hk_esq) Move_mouse(-i_velox,0);
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil){
WNDCLASSEX wincl ={sizeof(WNDCLASSEX),0,WinProc_Principal,0,0,
hThisInstance,LoadIcon(NULL,IDI_APPLICATION),LoadCursor(NULL,IDC_ARROW),
CreateSolidBrush(RGB(0,0,0xFF)),0,TEXT("C_Win"),LoadIcon(NULL,IDI_APPLICATION)};
if(!RegisterClassEx (&wincl))return 0;
hwnd = CreateWindowEx (0,TEXT("C_Win"),TEXT("S_Clicks"),WS_OVERLAPPED|WS_SYSMENU|WS_VISIBLE,CW_USEDEFAULT,CW_USEDEFAULT,150,100,HWND_DESKTOP,NULL,hThisInstance,NULL);
RegisterHotKey(hwnd,hk_f4,0,VK_F4);
RegisterHotKey(hwnd,hk_cima,0,hk_cima);
RegisterHotKey(hwnd,hk_baixo,0,hk_baixo);
RegisterHotKey(hwnd,hk_dir,0,hk_dir);
RegisterHotKey(hwnd,hk_esq,0,hk_esq);
while (GetMessage (&messages, NULL, 0, 0)){
TranslateMessage(&messages);
DispatchMessage(&messages);
};
return messages.wParam;
}
|