I want to practice with code to terminate a process, but...
Time:10-08
The following is part of the code:
BOOL TerminateProcessFromld (DWORD DWLD)//here need to enter a; ? { BOOL bRet=FALSE; HANDLE hProcess=: : OpenProcess (POCESS_ALL_ACCESS, FALSE, DWLD);//it is replace DWLD with an ID number is ok? If (hProcess!=NULL) { //termination process BRet=: : the TerminateProcess (hProcess, 0);
} The CloseHandle (hProcess); Return bRet. }
When the small white in the compiler to knock:
# include # include
Int main (int arg c, char * argv []) { //BOOL TerminateProcessFromld (DWORD DWLD); BOOL TerminateProcessFromld (DWORD DWLD) {//why there is an error here, tip error: should input; ? Don't understand the BOOL bRet=FALSE; HANDLE hProcess=: : OpenProcess (PROCESS_ALL_ACCESS, FALSE, DWLD); If (hProcess!=NULL) { BRet=: : the TerminateProcess (hProcess, 0); } The CloseHandle (hProcess); Return bRet. } }
CodePudding user response:
If (hProcess!=NULL)
The inside!=as a whole, you can't! And=plus a space in the middle
CodePudding user response:
Here again, POCESS_ALL_ACCESS spelt wrong, should be PROCESS_ALL_ACCESS
CodePudding user response:
BOOL TerminateProcessFromld (DWORD DWLD) this function how to implement in the main function?
CodePudding user response:
Try to use simple PostMessage WM_CLOSE way he can close. Generally I preferred, close the other processes to itself in its own way to close if not only The TerminateProcess
CodePudding user response:
Int main (int arg c, char * argv []) In defining a BOOL TerminateProcessFromld (DWORD DWLD)? Put the main outer
CodePudding user response:
The main function in a nested function? BOOL TerminateProcessFromld (DWORD DWLD) on the outside, the main function call TerminateProcessFromld function,
CodePudding user response:
This is all you grammar mistakes ~
CodePudding user response:
Code cannot be nested,
CodePudding user response:
About whether he is suitable for programming is very simple test: On a newspaper or magazine articles, for a period of about 1000 words in Word input again, after losing to refer to the following answer:
A. there are more than 10 words or punctuation B there is no words or punctuation mistakes and dare to bet for this No words or punctuation errors and C fonts and layout fully consistent with the original D print on the translucent paper and check the same original overlap, and feel very with a sense of accomplishment
A is not suitable for programming (reason: typing accuracy is low, careless) B junior programmer (reason: typing accuracy high, careful and meticulous, confident, understand the whole Angle of half Angle concept) C senior programmer (reason: in the B on the basis of understanding the font and layout is also an important factor of computer to print, but compared to D paranoid enough, strives for perfection, the results can verify) D software project manager (reason: to be able to give convincing for project detailed requirements to the pole and typical test cases, users almost pick is not at fault, major!)
If want to from A to B, to my resources http://download.csdn.net/detail/zhao4zhong1/4084259 download "for programmers keyboard practice"