Yuav Ua Li Cas Emulate Ib Nias

Cov txheej txheem:

Yuav Ua Li Cas Emulate Ib Nias
Yuav Ua Li Cas Emulate Ib Nias

Video: Yuav Ua Li Cas Emulate Ib Nias

Video: Yuav Ua Li Cas Emulate Ib Nias
Video: yuav ua li cas 2024, Kaum ib hlis
Anonim

Qee zaum sau ntawv ntawm tsab ntawv lossis khoos kas yuav tsum ua raws li qee cov neeg siv kev ua - piv txwv li, nias tus yuam sij lossis nyem nrog nas rau ntawm ib lub khoom. Qhov no tuaj yeem pom tseeb los ntawm cov lus ntuas nrog rau cov lus programming uas qhov kev zov me nyuam tau sau, lossis siv qhov kev sib tshuam tshwj xeeb ntawm cov kev ua haujlwm. Xws li lub ntsej muag yog tsim rau kev sib cuam tshuam ntawm cov ntawv thov kev pab cuam nrog cov khoos kas system thiab yog hu ua API - Kev Siv Lub Npe Phuam Haujlwm

Yuav ua li cas emulate ib nias
Yuav ua li cas emulate ib nias

Cov Lus Qhia

Kauj ruam 1

Tshawb nrhiav cov lus uas koj siv los sau cov program lossis cov ntawv sau tau ua-nyob rau keystroke emulation. Piv txwv, hauv JavaScript, sab laug nas khawm tau simulated siv ib txoj kev uas khi rau qee cov ntsiab lus ntawm tus neeg siv interface. Piv txwv li, txhawm rau ua ib tus laug nas lub pob nyem thaum tus cursor dhau ib lub pob npe hu ua autoClkButton tso rau hauv ib daim ntawv hu ua autoClkForm, koj yuav tsum siv daim ntawv.autoClkButton.autoClkForm.click () txua. Hauv hom lus no, tsis tsuas yog cov khawm (khawm, rov qab kho dua, xa) muaj cov nias () cuab yeej, tab sis kuj xaiv cov khoom xaiv - khij hauv xov tooj cua thiab xov tooj cua.

Kauj ruam 2

Siv tus txheej txheem sab nraud keybd_event yog tias hom lus uas koj siv tsis muaj cov cuab yeej txuas nrog uas koj xav tau ua txhua yam tsis siv neeg. Qhov no yog Win32 API ua haujlwm, yog li txhawm rau nkag mus rau lawv los ntawm koj qhov program, koj yuav tsum tso lub block thaum pib ntawm koj cov cai uas import cov haujlwm ntawm lub tsev qiv ntawv sab nraud. Qhov no yuav tsum ua tiav raws li lub syntax ntawm cov software siv ib puag ncig. Piv txwv, hauv MQL (MetaQuotes Cov Lus) cov lus qhia txog cov lus qhia ua lag luam rau cov khoom lag luam, txhawm rau hu cov haujlwm tso rau hauv lub tsev qiv ntawv system32.dll, koj yuav tsum tso cov kab hauv qab no thaum pib ntawm tus lej: #import "user32.dll" bool keybd_event (int bVk, int bScan); #import Tom qab ntawd, nws yuav tau siv keybd_event muaj nuj nqi tshaj tawm nyob rau hauv block block.

Kauj ruam 3

Keybd_event muaj plaub ntu. Thawj (bVk, cov ntaub ntawv hom BYTE) tuaj yeem nqa ib ntawm 255 qhov tseem ceeb thiab qhia tias tus yuam sij uas yuav raug sim thaum nias. Tshawb nrhiav seb qhov twg ntawm cov nqi no tau muab rau tus yuam sij uas koj xav tau ntawm nplooj ntawv no - https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx. Qhov tseem ceeb thib ob (bScan, BYTE hom) yog "scan code" uas tsim tawm thaum tus yuam sij xaiv tau nias. Qhov thib peb (dwFlags, hom DWORD) tuaj yeem nqa ib lossis ob qho ntawm nws cov nqi (KEYEVENTF_EXTENDEDKEY thiab KEYEVENTF_KEYUP). Thawj qhov qhia tias tus lej txuas ntxiv yuav tsim tawm, thiab qhov thib ob qhia tau tias lub pob raug nias thiab tom qab ntawd muab tso tawm. Plaub qhov tshwj xeeb (dwExtraInfo, hom ULONG_PTR) tuaj yeem muaj cov chij ntxiv tshwj xeeb rau txhua tus yuam sij.

Pom zoo: