16 Haziran 2013 Pazar

boş vakit buldum internette baktım arıyan var basit birşey hazırladım

GetCursorPos ; Mouse Bulunduğu X ve Y kordinatlarını okumak için kullanacagımız fonksiyon

GetCursorPos(LPPOINT lpPoint)

LPPOINT ; Bu Bir işaretçi noktası imleçin kordinatlarını almak için

POINT kordinat;
GetCursorPos ( &kordinat );

X Kordinatını almak için

kordinat.x

Y Kordinatını almak için
kordinat.y

SetCursorPos ; Mouse İstenilen Kordinata sürüklemek için kullanacagımız fonksiyon

Kullanımı basittir

SetCursorPos (xKordinatı ,YKordinatı)

Mouse_event : mouse için bir işlem uygulamamızı sağlıcak fonksiyon ( sağ click sol click gibi)

şimdi mouse ile bir işlem yaparken örnegin sol tuşuna bastık ve daha sonra elimizi cektik bir click oluştu bilgisayarda basıldıgı an ve elimizi cektigimiz an 2 adet kod oluşturulur

sol click tıklatmak için yapmamız gereken

mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);

Örnek Bir Uygulama basit bişeydir

Resim, takriben 10% (600x298) ölçeklenmiştir. Orjinal boyutta (666x330) görmek için bu çubuğa tıklayın. Yeni bir pencerede açmak için resme tıklayın.
[Resim: hx4fx.png]


// ########  ##########  #########  #########   ########  #########
// ###  ###  ###     ##  ###   ###  ###   ###   ###            ###
// ########  ##########  ###   ###  ###   ###   ########     #######
// ###  ###  ###     ##  ###   ###  ###   ###   ###   ##       ###
// ###  ###  ##########  #########  #########   ########       ###
#include <iostream>
#include <fstream>
#include <windows.h>
using namespace::std;
int XKordinat [60];
int YKordinat [60];
int sayı = 0;
int kayıt = 0;
int menusecim;
int oynat = 0;
int aboo67 = 0;
class mousee {
public:
    int x,y;
    void kordinatal();
    void kordinatgit( int xkordinat , int ykordinat );
    void kordinatkaydet ( int x , int y);
    void solclick();
}mouse;

void mousee::kordinatal() {
POINT kordinat;
GetCursorPos ( &kordinat );
x = kordinat.x;
y = kordinat.y;
}   
void mousee::kordinatgit( int xkordinat , int ykordinat ) {
SetCursorPos(xkordinat,ykordinat);
}

void mousee::kordinatkaydet ( int x , int y){
    ofstream kordinat;
    kordinat.open ("kordinat.txt");
    kordinat << x << y << endl;
}

void mousee::solclick(){
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);
}

void girisyazısı () {
    system("color 3");
    cout << "################################################################################​" << endl <<  "                            aboo67 OtoClicker v0.1 " << endl << "                            ---------------------- " << endl;
    cout << "                            1- Kordinat Kaydi Al " << endl;
    cout << "                            2- Kaydi Oynat " << endl;
    cout << "                            3- Cikis " <<  endl << endl;
    cout << "################################################################################​" ;

}

void menu () {
cin >> menusecim;
switch(menusecim){
case 1:
    system( "cls" );
    girisyazısı();
    cout << endl << "Kordinat Kaydetmek icin DELETE tusuna basiniz" << endl << "kaydi tamamlamak için END tusuna basin ve kaydedin ";
    kayıt = 1;
    break;
case 2:
    system( "cls" );
    girisyazısı();
    cout << endl << "Kayit Oynatiliyor";
    oynat = 1;
    break;
case 3:
    exit(1);
}
}

void main () {
girisyazısı();
menu();
while (1) {
if (oynat == 1) {
aboo67++;
Sleep(200);
mouse.kordinatgit(XKordinat[aboo67],YKordinat[aboo67]);
mouse.solclick();
}
if (kayıt == 1){
if(GetAsyncKeyState(VK_DELETE)){ 
sayı++;
//cout << sayı;
mouse.kordinatal();
cout << endl <<  "mouse X:" << mouse.x << "mouse Y:" << mouse.y; // ekrana yansıt
mouse.kordinatkaydet(mouse.x,mouse.y);
XKordinat[sayı] = mouse.x;
YKordinat[sayı] = mouse.y;
}
Sleep(200);
}
if(GetAsyncKeyState(VK_END)){
kayıt = 0;
cout << endl <<  "Kayit Bitmistir Bir Sonraki İslemi Seciniz" << endl;
menu();
//deneme++;
//cout << kayıtlıkordinat[deneme];
Sleep(200);
}
}
}

Categories:

0 yorum:

Yorum Gönder

Subscribe to RSS Feed Follow me on Twitter!