C++ ile fare ile basılan yere Zoom nasıl yapılır?

Kernel60Hz

Decapat
Katılım
22 Nisan 2023
Mesajlar
221
Çözümler
1
Daha fazla  
Cinsiyet
Erkek
C++ kullanarak bir tuşa bastığım zaman otomatikman mouse imlecinin olduğu yere Zoom yapmasını istiyorum bunu nasıl yaparım?
 
Hocam bu kodların işinizi görmesi gerekiyor ama emin olamadım bende yeniyim.
Zoom için Z
tekrar eski haline dönmesi için Z tuşunu kullanıyorsunuz.


#include <Windows.h>
#include <iostream>

int main()
{
bool zoomed = false;
INPUT input = { 0 };
input.type = INPUT_MOUSE;
input.mi.dwFlags = MOUSEEVENTF_WHEEL;
input.mi.mouseData = WHEEL_DELTA;

while (true) {
if (GetAsyncKeyState('Z') & 0x8000) {
if (!zoomed) {
POINT p;
GetCursorPos(&p);
SendInput(1, &input, sizeof(INPUT));
zoomed = true;
}
} else if (GetAsyncKeyState('Z') & 0x0000) {
if (zoomed) {
POINT p;
GetCursorPos(&p);
SetCursorPos(p.x, p.y);
zoomed = false;
}
}
}

return 0;
}
 
Hocam bu kodların işinizi görmesi gerekiyor ama emin olamadım bende yeniyim.
Zoom için Z
Tekrar eski haline dönmesi için Z tuşunu kullanıyorsunuz.

#İnclude <Windows.h>
#İnclude <iOStream>

İnt main()
{
Bool zoomed = false;
Input input = { 0 };
İnput. Type = ınput_mouse;
İnput. Mi? Dwflags = mouseeventf_wheel;
İnput. Mi? Mousedata = wheel_delta;

While (true) {
İf (getasynckeystate('Z') & 0x8000) {
İf (!zoomed) {
Poınt p;
Getcursorpos(&p);
Sendınput(1, &input, sizeof(ınput));
Zoomed = true;
}
} Else if (getasynckeystate('Z') & 0x0000) {
İf (zoomed) {
Poınt p;
Getcursorpos(&p);
Setcursorpos(p. X, p. Y);
Zoomed = false;
}
}
}

Return 0;
}

Hocam kodu denedim fakat herhangi bir yakınlaştırma olmadı?
 
Hocam kodu denedim fakat herhangi bir yakınlaştırma olmadı?

Hocam kusura bakmayın biraz geç oldu rica etsem bir de şunu dener misiniz?

#include <Windows.h>
#include <iostream>

int main()
{
while (true) {

if (GetAsyncKeyState('Z') & 0x8000) {

int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);


int centerX = screenWidth / 2;
int centerY = screenHeight / 2;


HWND zoomWindow = CreateWindowEx(
WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW,
L"STATIC", NULL, WS_POPUP | WS_VISIBLE,
centerX - 100, centerY - 100, 200, 200,
NULL, NULL, NULL, NULL);


SetLayeredWindowAttributes(zoomWindow, RGB(0, 0, 0), 128, LWA_ALPHA);


HDC hdc = GetDC(zoomWindow);
HBRUSH brush = CreateSolidBrush(RGB(255, 0, 0));
SelectObject(hdc, brush);
Ellipse(hdc, 0, 0, 200, 200);
ReleaseDC(zoomWindow, hdc);
DeleteObject(brush);
}
}

return 0;
}
 
Hocam kusura bakmayın biraz geç oldu rica etsem bir de şunu dener misiniz?

#İnclude <Windows.h>
#İnclude <iOStream>

İnt main()
{
While (true) {

İf (getasynckeystate('Z') & 0x8000) {

İnt screenwidth = getsystemmetrics(sm_cxscreen);
İnt screenheight = getsystemmetrics(sm_cyscreen);

İnt centerx = screenwidth / 2;
İnt centery = screenheight / 2;

Hwnd zoomwindow = createwindowex(
Ws_ex_topmost | ws_ex_layered | ws_ex_transparent | ws_ex_toolwındow,
L"statıc", null, ws_popup | ws_vısıble,
Centerx - 100, centery - 100, 200, 200,
Null, null, null, null);

Setlayeredwindowattributes(zoomwindow, RGB(0, 0, 0), 128, lwa_alpha);

Hdc hdc = getdc(zoomwindow);
Hbrush brush = createsolidbrush(RGB(255, 0, 0));
Selectobject(hdc, brush);
Ellipse(hdc, 0, 0, 200, 200);
Releasedc(zoomwindow, hdc);
Deleteobject(brush);
}
}

Return 0;
}

Hocam Z ye bastığım zaman ortaya siyah kutunun içinde kırmızı yuvarlak geliyor ve Z ye basınca gitmiyor?
 

Technopat Haberler

Yeni konular

Geri
Yukarı