getpixel ile pixel renk okuma ve mause cordinat okuma c++ örnek uygulama
[postlink]http://net4story.blogspot.com/2013/09/getpixel-ile-pixel-renk-okuma-ve-mause.html[/postlink]
// get color and coordinate.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
POINT p,p2;
HDC hdc;
COLORREF Color2;
void main(int argc, char* argv[])
{
SMALL_RECT windowSize = {0, 0, 22, 3};
SetConsoleWindowInfo(hConsole, TRUE, &windowSize);
SetConsoleTitleA("Get xy color");
system("Color 0f");
while(1)
{
Sleep(30);
hdc = GetDC(HWND_DESKTOP);
GetCursorPos(&p);
COLORREF Color = GetPixel( hdc, p.x,p.y );
if (Color!=Color2||p2.x!=p.x||p2.y!=p.y)
{ system("cls");
p2.x=p.x;
p2.y=p.y;
Color2=Color;
cout<<"x : "<<p.x<<" y : "<<p.y<<endl<<Color;
}
}
system("pause");
}
exe link: http://yadi.sk/d/ZxFXIY7Y8pXiU
0 yorum:
Post a Comment