Strange! why cannot exit?

Hi,

 in my FormView, i have a button "exit". when i click the button, the applicaiton shld terminates.
 the code is:
 void OnExit(){
 exit(0);
 }

 but each time after i processing some data, it can not exit; but if i did not do the processing, then can terminate the application. why? any idea? what function shld i use to
 exit the program?
 thanks!
greenbirdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZoppoCommented:
Hi greenbird,

Have you tried using PostQuitMessage()?

ZOPPO
0
akalmaniCommented:
Hi greenbird !!
 Try this
  ::PostQuitMessage(0);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WynCommented:
You have only one CPU,RIGHT?

Wyn
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

WynCommented:
and you have only one thread,right?
0
WynCommented:
So,How can CPU jump to your message handler when she is dancing there?

Regards
Wyn
0
greenbirdAuthor Commented:
Hi,

It still does not work, the program just hang there. any idea?
thanks a lot!
0
WynCommented:
Wow,what are you doing , greenbird.
My answer points out the reason you program doesnt work ,not the solution.But the answer you accept makes no sense.
Good Luck.
Regards
Wyn
0
greenbirdAuthor Commented:
Hi, Wyn,

well ur answer is tooooo high-level that i can not understand :) i am just a beginner to VC++. well for my program there will be more problems come out, so keep on helping lah :) thanks!
0
ZoppoCommented:
:(
0
greenbirdAuthor Commented:
HI, Zoppo,

ur answer is same as akalmani's, but his is early than urs, so i accept his answer.  but actually for my program, i have to use terminateporcess() finally to terminate it.

really thanks for the great help u had given, and hope to learn more fro u!
:) do not :( .

thanks a lot!

have a nice day!
0
ZoppoCommented:
Hi greenbird,

>...but his is early than urs...
???

My comment: Monday, January 24 2000 - 01:33PM CET
akalmani's comment: Monday, January 24 2000 - 01:39PM CET

BTW, never mind ...

ZOPPO
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.