Лупа (Отобразить)
CODE:
options ("stop","X");
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define SRCCOPY 13369376
#define PS_USERSTYLE 7
#define PS_SOLID 0
#define BS_SOLID 0
#define COLOR_BLACK 0
#define COLOR_WHITE 16777215
#define SPI_GETMOUSESPEED 112
#define SPI_SETMOUSESPEED 113
external(INT, "SystemParametersInfo", "SystemParametersInfoA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "ReleaseDC", "ReleaseDC", "User32.dll");
external(INT, "FillRect", "FillRect", "User32.dll");
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "WindowFromPoint", "WindowFromPoint", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll" );
external(INT, "StretchBlt", "StretchBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll" );
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll" );
external(INT, "LineTo", "LineTo", "Gdi32.dll");
external(INT, "MoveTo", "MoveToEx", "Gdi32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "ExtCreatePen", "ExtCreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
int mouse_speed, mouse_speed_current;
int mouseX, mouseY;
int LOGBRUSH[3]={BS_SOLID, COLOR_WHITE, 0}
int pstyle[2]={1, 1}
int pos, wSrc, hSrc, delta;
int Brush, Pen_black, Pen, oldPen;
int HDC0, HDC_dialog, Comp, Comp2, bitmap, bitmap2;
int static[6], button_[4];
win dialog;
int rect[4]={0, 0, 200, 200}
int color[1][1];
int zoom=10;
createdialog(0);
showdialog(0, "Dialog", 0, 0, 220, 380, 4, 1);
enabletimer(0);
loop()sleep(10);
end:;
function getmessage (0, WM_CREATE)
{
dialog=formatiw(gethwnd(0));
SystemParametersInfo(SPI_GETMOUSESPEED, 0, address(#mouse_speed), 0);
mouse_speed_current=mouse_speed;
HDC_dialog=GetDC(gethwnd(0));
HDC0=GetDC(0);
Comp=CreateCompatibleDC(HDC_dialog);
Comp2=CreateCompatibleDC(HDC_dialog);
bitmap=CreateCompatibleBitmap(HDC_dialog, 200, 200);
bitmap2=CreateCompatibleBitmap(HDC_dialog, 200, 200);
SelectObject(Comp, bitmap);
SelectObject(Comp2, bitmap2);
Brush=CreateSolidBrush(COLOR_WHITE);
Pen_black=CreatePen(PS_SOLID, 1, COLOR_BLACK);
Pen=ExtCreatePen(PS_USERSTYLE, 1, address(#LOGBRUSH[0]), sizearray(pstyle), address(#pstyle[0]));
static[0]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 220, 130, 20, gethwnd(0), 0, 0, 0);
static[1]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 240, 130, 20, gethwnd(0), 0, 0, 0);
static[2]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 260, 130, 20, gethwnd(0), 0, 0, 0);
static[3]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 280, 130, 20, gethwnd(0), 0, 0, 0);
static[4]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 300, 80, 20, gethwnd(0), 0, 0, 0);
static[5]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 320, 130, 20, gethwnd(0), 0, 0, 0);
button_[0]=CreateWindow(0, "BUTTON", "+", WS_CHILD | WS_VISIBLE, 100, 300, 16, 16, gethwnd(0), 0, 0, 0);
button_[1]=CreateWindow(0, "BUTTON", "-", WS_CHILD | WS_VISIBLE, 120, 300, 16, 16, gethwnd(0), 0, 0, 0);
button_[2]=CreateWindow(0, "BUTTON", "+", WS_CHILD | WS_VISIBLE, 150, 320, 16, 16, gethwnd(0), 0, 0, 0);
button_[3]=CreateWindow(0, "BUTTON", "-", WS_CHILD | WS_VISIBLE, 170, 320, 16, 16, gethwnd(0), 0, 0, 0);
}
function getmessage (0, WM_CLOSE)
{
ReleaseDC(0, HDC0); ReleaseDC(gethwnd(0), HDC_dialog);
DeleteObject(Comp); DeleteObject(Comp2);
DeleteObject(bitmap); DeleteObject(bitmap2);
DeleteObject(Brush); DeleteObject(Pen); DeleteObject(Pen_black);
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed, 0);
goto global end;
}
function getmessage (0, WM_COMMAND)
{
if(message.lparam == button_[0])
{
if(zoom<20)zoom++; return;
}
if(message.lparam == button_[1])
{
if(zoom>1)zoom--; return;
}
if(message.lparam == button_[2])
{
if(mouse_speed_current<20)mouse_speed_current++;
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed_current, 0);
return;
}
if(message.lparam == button_[3])
{
if(mouse_speed_current>1)mouse_speed_current--;
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed_current, 0);
return;
}
}
CREATE_TIMER(0, 20)
{
getmouse(mouseX, mouseY);
color[0][0]=getcolor(mouseX, mouseY);
// изменить текст статиков
SetWindowText(static[0], "X, Y: "+format(mouseX)+", "+format(mouseY));
SetWindowText(static[1], "Color: "+format(color[0][0]));
SetWindowText(static[2], "RGB: "+format(rvalue(color[0][0]))+", "+format(gvalue(color[0][0]))+", "+format(bvalue(color[0][0])));
SetWindowText(static[3], "Handle: "+format(WindowFromPoint(mouseX, mouseY)));
SetWindowText(static[4], "Zoom: x"+format(zoom));
SetWindowText(static[5], "Mouse Speed: x"+format(mouse_speed_current));
FillRect(Comp, address(#rect[0]), Brush);
pos = 100 / zoom; wSrc = 200 / zoom; hSrc = 200 / zoom;
StretchBlt(Comp, 0, 0, wSrc * zoom, hSrc * zoom, HDC0, mouseX - pos, mouseY - pos, wSrc, hSrc, SRCCOPY);
BitBlt(Comp2, 0, 0, 200, 200, Comp, 0, 0, SRCCOPY);
delta = pos * zoom + zoom / 2;
oldPen=SelectObject(Comp2, Pen_black);
MoveTo(Comp2, 0, delta, 0); LineTo(Comp2, 200, delta);
MoveTo(Comp2, delta, 0, 0); LineTo(Comp2,delta, 200);
SelectObject(Comp2, oldPen);
oldPen=SelectObject(Comp2, Pen);
MoveTo(Comp2, 0, delta, 0); LineTo(Comp2, 200, delta);
MoveTo(Comp2, delta, 0, 0); LineTo(Comp2,delta, 200);
SelectObject(Comp2, oldPen);
BitBlt(HDC_dialog, 5, 5, 200, 200, Comp2, 0, 0, SRCCOPY);
visualwindow(dialog, 0, 0, 0, 1, 1, 160, 240, 3000, #color[0][0]);
}
#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define SRCCOPY 13369376
#define PS_USERSTYLE 7
#define PS_SOLID 0
#define BS_SOLID 0
#define COLOR_BLACK 0
#define COLOR_WHITE 16777215
#define SPI_GETMOUSESPEED 112
#define SPI_SETMOUSESPEED 113
external(INT, "SystemParametersInfo", "SystemParametersInfoA", "User32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "ReleaseDC", "ReleaseDC", "User32.dll");
external(INT, "FillRect", "FillRect", "User32.dll");
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "SetWindowText", "SetWindowTextA", "User32.dll");
external(INT, "WindowFromPoint", "WindowFromPoint", "User32.dll");
external(INT, "BitBlt", "BitBlt", "Gdi32.dll" );
external(INT, "StretchBlt", "StretchBlt", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll" );
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll" );
external(INT, "SelectObject", "SelectObject", "Gdi32.dll" );
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll" );
external(INT, "LineTo", "LineTo", "Gdi32.dll");
external(INT, "MoveTo", "MoveToEx", "Gdi32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "ExtCreatePen", "ExtCreatePen", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
int mouse_speed, mouse_speed_current;
int mouseX, mouseY;
int LOGBRUSH[3]={BS_SOLID, COLOR_WHITE, 0}
int pstyle[2]={1, 1}
int pos, wSrc, hSrc, delta;
int Brush, Pen_black, Pen, oldPen;
int HDC0, HDC_dialog, Comp, Comp2, bitmap, bitmap2;
int static[6], button_[4];
win dialog;
int rect[4]={0, 0, 200, 200}
int color[1][1];
int zoom=10;
createdialog(0);
showdialog(0, "Dialog", 0, 0, 220, 380, 4, 1);
enabletimer(0);
loop()sleep(10);
end:;
function getmessage (0, WM_CREATE)
{
dialog=formatiw(gethwnd(0));
SystemParametersInfo(SPI_GETMOUSESPEED, 0, address(#mouse_speed), 0);
mouse_speed_current=mouse_speed;
HDC_dialog=GetDC(gethwnd(0));
HDC0=GetDC(0);
Comp=CreateCompatibleDC(HDC_dialog);
Comp2=CreateCompatibleDC(HDC_dialog);
bitmap=CreateCompatibleBitmap(HDC_dialog, 200, 200);
bitmap2=CreateCompatibleBitmap(HDC_dialog, 200, 200);
SelectObject(Comp, bitmap);
SelectObject(Comp2, bitmap2);
Brush=CreateSolidBrush(COLOR_WHITE);
Pen_black=CreatePen(PS_SOLID, 1, COLOR_BLACK);
Pen=ExtCreatePen(PS_USERSTYLE, 1, address(#LOGBRUSH[0]), sizearray(pstyle), address(#pstyle[0]));
static[0]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 220, 130, 20, gethwnd(0), 0, 0, 0);
static[1]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 240, 130, 20, gethwnd(0), 0, 0, 0);
static[2]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 260, 130, 20, gethwnd(0), 0, 0, 0);
static[3]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 280, 130, 20, gethwnd(0), 0, 0, 0);
static[4]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 300, 80, 20, gethwnd(0), 0, 0, 0);
static[5]=CreateWindow(0, "STATIC", "", WS_CHILD | WS_VISIBLE, 10, 320, 130, 20, gethwnd(0), 0, 0, 0);
button_[0]=CreateWindow(0, "BUTTON", "+", WS_CHILD | WS_VISIBLE, 100, 300, 16, 16, gethwnd(0), 0, 0, 0);
button_[1]=CreateWindow(0, "BUTTON", "-", WS_CHILD | WS_VISIBLE, 120, 300, 16, 16, gethwnd(0), 0, 0, 0);
button_[2]=CreateWindow(0, "BUTTON", "+", WS_CHILD | WS_VISIBLE, 150, 320, 16, 16, gethwnd(0), 0, 0, 0);
button_[3]=CreateWindow(0, "BUTTON", "-", WS_CHILD | WS_VISIBLE, 170, 320, 16, 16, gethwnd(0), 0, 0, 0);
}
function getmessage (0, WM_CLOSE)
{
ReleaseDC(0, HDC0); ReleaseDC(gethwnd(0), HDC_dialog);
DeleteObject(Comp); DeleteObject(Comp2);
DeleteObject(bitmap); DeleteObject(bitmap2);
DeleteObject(Brush); DeleteObject(Pen); DeleteObject(Pen_black);
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed, 0);
goto global end;
}
function getmessage (0, WM_COMMAND)
{
if(message.lparam == button_[0])
{
if(zoom<20)zoom++; return;
}
if(message.lparam == button_[1])
{
if(zoom>1)zoom--; return;
}
if(message.lparam == button_[2])
{
if(mouse_speed_current<20)mouse_speed_current++;
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed_current, 0);
return;
}
if(message.lparam == button_[3])
{
if(mouse_speed_current>1)mouse_speed_current--;
SystemParametersInfo(SPI_SETMOUSESPEED, 0, mouse_speed_current, 0);
return;
}
}
CREATE_TIMER(0, 20)
{
getmouse(mouseX, mouseY);
color[0][0]=getcolor(mouseX, mouseY);
// изменить текст статиков
SetWindowText(static[0], "X, Y: "+format(mouseX)+", "+format(mouseY));
SetWindowText(static[1], "Color: "+format(color[0][0]));
SetWindowText(static[2], "RGB: "+format(rvalue(color[0][0]))+", "+format(gvalue(color[0][0]))+", "+format(bvalue(color[0][0])));
SetWindowText(static[3], "Handle: "+format(WindowFromPoint(mouseX, mouseY)));
SetWindowText(static[4], "Zoom: x"+format(zoom));
SetWindowText(static[5], "Mouse Speed: x"+format(mouse_speed_current));
FillRect(Comp, address(#rect[0]), Brush);
pos = 100 / zoom; wSrc = 200 / zoom; hSrc = 200 / zoom;
StretchBlt(Comp, 0, 0, wSrc * zoom, hSrc * zoom, HDC0, mouseX - pos, mouseY - pos, wSrc, hSrc, SRCCOPY);
BitBlt(Comp2, 0, 0, 200, 200, Comp, 0, 0, SRCCOPY);
delta = pos * zoom + zoom / 2;
oldPen=SelectObject(Comp2, Pen_black);
MoveTo(Comp2, 0, delta, 0); LineTo(Comp2, 200, delta);
MoveTo(Comp2, delta, 0, 0); LineTo(Comp2,delta, 200);
SelectObject(Comp2, oldPen);
oldPen=SelectObject(Comp2, Pen);
MoveTo(Comp2, 0, delta, 0); LineTo(Comp2, 200, delta);
MoveTo(Comp2, delta, 0, 0); LineTo(Comp2,delta, 200);
SelectObject(Comp2, oldPen);
BitBlt(HDC_dialog, 5, 5, 200, 200, Comp2, 0, 0, SRCCOPY);
visualwindow(dialog, 0, 0, 0, 1, 1, 160, 240, 3000, #color[0][0]);
}