Click here to Skip to main content
15,908,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: difftime hell [modified] Pin
CPallini22-Jan-07 10:15
mveCPallini22-Jan-07 10:15 
GeneralRe: difftime hell Pin
David Crow23-Jan-07 2:59
David Crow23-Jan-07 2:59 
GeneralRe: difftime hell Pin
CPallini23-Jan-07 4:26
mveCPallini23-Jan-07 4:26 
QuestionHow to prevent a Dialog from being resized by choosen font size? Pin
madmax000122-Jan-07 8:56
madmax000122-Jan-07 8:56 
AnswerRe: How to prevent a Dialog from being resized by choosen font size? Pin
ThatsAlok22-Jan-07 18:54
ThatsAlok22-Jan-07 18:54 
QuestionWhat's function use for close process? Pin
Max++22-Jan-07 6:42
Max++22-Jan-07 6:42 
AnswerRe: What's function use for close process? Pin
Mark Salsbery22-Jan-07 7:13
Mark Salsbery22-Jan-07 7:13 
GeneralRe: What's function use for close process? Pin
Stephen Hewitt22-Jan-07 14:00
Stephen Hewitt22-Jan-07 14:00 
As you say, "you don't have any way to know what state the other process is in when you use TerminateProcess()." In particular, you don't know if it's in a safe state to terminate. For example, it could have half written out a file and when killed the file is corrupted. Way too many people use TerminateProcess as if it's an acceptable way to close a process; it's not - only when all else fails.

Here's what MSDN has too say on this issue:
 
"The TerminateProcess function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.

TerminateProcess initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.

A process cannot prevent itself from being terminated."


Don't get me wrong, I know you did allude to this in your post. I like to point this out explicitly however as not to accidentally encourage bad practice.


Steve

GeneralRe: What's function use for close process? Pin
Mark Salsbery22-Jan-07 14:06
Mark Salsbery22-Jan-07 14:06 
AnswerRe: What's function use for close process? Pin
CPallini22-Jan-07 7:49
mveCPallini22-Jan-07 7:49 
GeneralRe: What's function use for close process? Pin
toxcct22-Jan-07 8:15
toxcct22-Jan-07 8:15 
GeneralRe: What's function use for close process? Pin
CPallini22-Jan-07 8:22
mveCPallini22-Jan-07 8:22 
GeneralRe: What's function use for close process? Pin
toxcct22-Jan-07 8:26
toxcct22-Jan-07 8:26 
GeneralRe: What's function use for close process? Pin
CPallini22-Jan-07 9:08
mveCPallini22-Jan-07 9:08 
GeneralRe: What's function use for close process? Pin
Stephen Hewitt22-Jan-07 11:26
Stephen Hewitt22-Jan-07 11:26 
GeneralRe: What's function use for close process? Pin
CPallini22-Jan-07 20:50
mveCPallini22-Jan-07 20:50 
GeneralRe: What's function use for close process? Pin
Stephen Hewitt22-Jan-07 11:25
Stephen Hewitt22-Jan-07 11:25 
AnswerRe: What's function use for close process? Pin
Stephen Hewitt22-Jan-07 12:47
Stephen Hewitt22-Jan-07 12:47 
AnswerRe: What's function use for close process? Pin
ThatsAlok22-Jan-07 18:59
ThatsAlok22-Jan-07 18:59 
Questioninitialization text on dialog box Pin
Shah Satish22-Jan-07 6:37
Shah Satish22-Jan-07 6:37 
AnswerRe: initialization text on dialog box Pin
toxcct22-Jan-07 7:09
toxcct22-Jan-07 7:09 
GeneralRe: initialization text on dialog box Pin
Shah Satish22-Jan-07 21:55
Shah Satish22-Jan-07 21:55 
AnswerRe: initialization text on dialog box Pin
Hamid_RT22-Jan-07 17:46
Hamid_RT22-Jan-07 17:46 
GeneralRe: initialization text on dialog box Pin
Shah Satish22-Jan-07 21:57
Shah Satish22-Jan-07 21:57 
AnswerRe: initialization text on dialog box Pin
ThatsAlok22-Jan-07 19:05
ThatsAlok22-Jan-07 19:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.