Thaum sau lwm cov kev pab cuam hauv C ++ hom lus programming, koj tuaj yeem ua ke ua haujlwm uas tso cai rau lwm cov ntawv thov khiav ntawm lub operating system ntawm tus kheej ntiag tug.
Cov Lus Qhia
Kauj ruam 1
Sau koj tus kheej cov yees duab sorting app. Txhawm rau ntxiv originality thiab ua haujlwm rau nws, koj tuaj yeem ntxiv hu rau lub graphical interface ncaj qha los ntawm cov program heev uas koj tau ua haujlwm. Muaj ob txoj haujlwm ntawm C ++ lus kom ua tiav cov haujlwm ntawd. Txuas lub windows.h thiab Shellapi.h cov tsev qiv ntawv kom tuaj yeem siv cov haujlwm ntawm kev tsim cov ntawv thov sab nraud ntawm lub operating system. Cov chaw qiv tau txuas nrog siv tus lej #include.
Kauj ruam 2
Siv lub ShellExecute () ua haujlwm yog tias koj xav tau kom dhau tsis dhau qhov kev thov hu ua. Kev ua haujlwm muaj qhov tsis xws li cov haujlwm: hwnd rau lub qhov rais cim, lpOperation qhia meej kev ua haujlwm rau daim ntawv thov hu ua (piv txwv, luam tawm lossis qhib), lpDirectory qhia qhov tseeb cov npe chaw npe, nShowCmd rau daim ntawv thov tso tawm hom, thiab lpParameters rau kev hla lwm cov tsis muaj xa mus rau npe thov.
Kauj ruam 3
Txhawm rau khiav cov haujlwm tshwj xeeb, siv WinExec () haujlwm. Ib txoj hlua parameter tau dhau mus rau qhov program code, uas qhia meej tag nrho txoj kev rau daim ntawv thov, nrog rau hom pib ua haujlwm ntawm daim ntawv thov no.
Kauj ruam 4
Cov ntawv hauv qab no tuaj yeem siv los ua piv txwv:
#ncig teb chaws
#ncig teb chaws
tsis muaj ntsiab ()
{
WinExec ("c: / windows / system32 / calc.exe", SW_SHOW);
}
Kauj ruam 5
Raws li kev coj ua cov kev cai no, lub Windows tshuab xam zauv zoo yuav qhib. Koj tuaj yeem piav qhia ntau yam teeb meem nyob rau hauv uas kev siv sab nraud ntawm lub operating system raug hu ua. Nco ntsoov suav nrog cov tsev qiv ntawv xav tau los ua haujlwm nrog cov haujlwm no.
Kauj Ruam 6
Sau cov ntawv teev npe txheem uas cov neeg siv yuav zoo los nruab. Khaws qhov no hauv siab yog tias koj tsis yog tib tug siv qhov program. Yog tias koj muaj teeb meem sau ib qho program, saib cov lus qhia tshwj xeeb video hauv Is Taws Nem.