Daim application application interface ntawm Windows operating systems yog sawv cev los ntawm ib pawg ntawm kev khiav dej num. Thaum lawv raug hu, ntau yam khoom (cov ntaub ntawv, txheej txheem, xov, cov khoom sib txuas ua ke, thiab lwm yam) tuaj yeem tsim. Txhawm rau muab kev nkag tau yooj yim thiab kev sib koom ua ke ntawm cov khoom no, lawv cov cim tau ua tiav siv cov lus piav qhia - "tsis tseem ceeb" suav qhov muaj nuj nqis.
Tsim nyog
- - tus txhais lus los ntawm hom lus programming uas tso cai rau siv ntawm Windows API;
- - muaj peev xwm Windows Platform SDK.
Cov Lus Qhia
Kauj ruam 1
Tau txais tes ntawm qhov rais. Muaj ntau txoj hauv kev los ua qhov no. Tus txheej txheem tseeb nyob ntawm lub hom phiaj kawg.
Siv cov CreateWindow lossis CreateWindowEx APIs los tsim lub qhov rai. Lawv xa rov qab ua ke ntawm kev vam meej thiab NULL ntawm kev ua tsis tiav.
Tshawb nrhiav cov theem siab saum thiab cov qhov rai ntawm cov me nyuam los ntawm ntau cov qauv siv FindWindow thiab FindWindowEx ua haujlwm, feem. Ntawm kev ua tiav ntawm kev soj ntsuam, lub qhov rai kov yuav tau txais.
Enumerate lub qhov rais nrog EnumWindows, EnumChildWindows, EnumThreadWindows ua haujlwm. Cov tes ntawm lub qhov rais pom yuav dhau los ua lus parameter rau callback muaj nuj nqi.
Pom tus kov rau lub qhov rai nyob ntawm ib txoj haujlwm tshwj xeeb ntawm lub vijtsam. Hu ib qho ntawm cov haujlwm: WindowFromPoint, ChildWindowFromPoint, lossis ChildWindowFromPointEx.
Kauj ruam 2
Tau cov txheej txheem leeg. Tsim cov txheej txheem tshiab los ntawm kev hu xov tooj rau CreateProcess, CreateProcessAsUser, CreateProcessWithTokenW, lossis CreateProcessWithLogonW API haujlwm. Lawv txhua tus xa rov qab tus kov rau tus txheej txheem tshiab hauv thaj chaw hProcess ntawm PROCESS_INFORMATION tus qauv, tus pointer uas yuav tsum tau xa mus rau lawv raws li dhau qhov ntsuas.
Nrhiav tus kov rau txoj kev los ntawm nws cov npe uas paub. Siv cov xov tooj hu OpenProcess. Cov npav ID ntawm txhua cov txheej txheem khiav yuav muab tau, piv txwv li, siv cov CreateToolhelp32Snapshot, Process32First, thiab Process32Nws cov haujlwm ntawm lub tsev qiv ntawv pab.
Rov qab tuav lub pseudo ua ntawm cov txheej txheem tam sim no uas siv GetCurrentProcess muaj nuj nqi.
Kauj ruam 3
Tau txais cov lus piav qhia ntawm cov xov. Tus Tsim Tsim Kev Tshaj Tawm thiab CreateRemoteThread tsim cov xov hauv lawv tus kheej thiab lwm tus txheej txheem, ntsig txog, rov qab lawv cov tes. Koj tuaj yeem qhib cov xov uas twb muaj lawm siv nws cov cim thiab tau txais cov coj ua tau siv OpenThread muaj nuj nqi. Lub pseudo-kov ntawm cov dej ntws tam sim no rov qab thaum GetCurrentThread hu.
Kauj ruam 4
Cov lus piav qhia txog cov ntaub ntawv, cov ntawv sau npe, cov kev tawm dag zog lub cev, cov ntawv pov thawj, cov chaw pov npav, cov khoom siv sib txuas lus (I / O ports), cov ntawv xa tawm, thiab cov npe hu ua tuaj yeem tau los ntawm kev hu mus rau ib qho haujlwm, CreateFile.
Kauj ruam 5
Cov ntaub ntawv-rau-nco daim phiaj qhia cov khoom piav yog xa rov qab los ntawm kev hu xov tooj mus rau CreateFileMapping thiab OpenFileMapping.
Kauj Ruam 6
Cov CreateMutex, CreateSemaphore, thiab CreateEvent lub zog tsim, thiab cov OpenMutex, OpenSemaphore, thiab OpenEvent cov haujlwm qhib cov khoom tam sim no (mutexes, semaphores, thiab cov xwm txheej). Lawv txhua tus rov qab piav qhia.
Kauj Ruam 7
Txhua yam khoom siv GDI (xws li cov khoom siv, cov ntawv sau, ntawv sau, xaum, xaum, cov khoom siv thiab cov cuab yeej ywj pheej, DIB ntu, thiab lwm yam) raug tswj los ntawm lawv cov ntawv piav qhia. Lub luag haujlwm rau kev tsim cov khoom siv GDI muaj ntau yam thiab yuav tsum tau sab laj txog ntu ntawm MSDN rau cov ntaub ntawv ntawm lawv.
Kauj ruam 8
Cov lus piav qhia tau nyob rau hauv ib qho txheej txheem, raws li txoj cai, tsis tuaj yeem siv rau hauv lwm qhov. Txawm li cas los xij, nyob hauv qee kis nws muaj peev xwm muab tau cov lus piav qhia tseem ceeb sib xws rau thawj qhov khoom. Hu rau DuplicateHandle API kom theej tawm tus kov. Qhov no tuaj yeem siv, piv txwv, qhia cov khoom siv tsis muaj npe synchronization lossis cov chaw ntawm ntau cov txheej txheem.