Joke Collection Website - Joke collection - How mfc exits the process completely
How mfc exits the process completely
{?
//Create process snapshots (TH32CS_SNAPPROCESS means to create snapshots of all processes)?
Handle? hSnapShot? =? createtoolhelp 32 snapshot(th 32 cs _ snap process,0); ?
//PROCESSENTRY32 What is the structure of the process snapshot?
PROCESSENTRY32? PE; ?
//What initialization operation must be done before using Process32First to get the first snapshot after instantiation?
pe.dwSize? =? sizeof(process entry 32); ?
//The following IF effects are the same:?
//if(hProcessSnap? ==? INVALID_HANDLE_VALUE) Invalid handle?
If (! process 32 first(hSnapShot & amp; pe))?
{?
Return? Fake; ?
}?
//Convert a string to lowercase?
strProcessName。 make lower(); ?
//If the handle is valid? And then continue to get the next handle and loop on?
What time? (process 32 next(hSnapShot & amp; pe))?
{?
//pe.szExeFile Get the executable file name of the current process?
CString? scTmp? =? pe.szExeFile?
//Change all English letters of the executable file name to lowercase?
scTmp。 make lower(); ?
//Compare whether the executable file name of the current process and the passed-in file name are the same?
//Similarly, Compare returns 0?
If (! scTmp。 Compare(strProcessName))?
{?
//Get the PID of the snapshot process (that is, the PID in the task manager)?
DWORD? dwProcessID? =? PE . th 32 processid; ?
Handle? hProcess? =? * open PROCESS(PROCESS _ termin ate,FALSE,dwProcessID); ?
* termin ate process(h process,0); ?
close handle(h process); ?
Return? True; ?
}?
scTmp。 ReleaseBuffer()。 ?
}?
strProcessName。 ReleaseBuffer()。 ?
Return? Fake; ?
}
- Previous article:A Brief Introduction to the Story of Sweet Home A Brief Introduction to the Story of Sweet Home
- Next article:What are CM Punk's tattoos?
- Related articles
- Recognized as the godfather of love songs, who do you think is worthy?
- Does being a lawyer mean black as white and white as black?
- How to say genius English?
- The funny story of drying zongzi in a circle of friends, talking about a sentence copy of Dragon Boat Festival
- Is it permanent to freeze lip hair once?
- The boy said to a girl, Pikachu, what does he mean?
- The glory of the king hahahahahaha, what the hell are Han Xin and Li Bai?
- Yi Song said he didn't want to star in "Widowed Husband 2" with Guo Qilin. What is the reason?
- China 1 Who wrote the Book of Tea to promote tea art?
- Who are Jin Yong's top ten strange girls?