Click here to Skip to main content
15,915,800 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear sir or madam,

I just learning to write c++ console app, and now encounter the problem of handling the windows-CLOSE event properly.

Here's the context:
----------------------------------------------------------------------------------------
now the program is runing, if I click the X on the top right conner of console forms, the program trigger a breakpoint(haven't set the breakpoint manually) unexpected and the screen print:

forrtl: error (200): program aborting due to window-CLOSE event

I have search through the internet,method post in codeproject such as:
Console Event Handling[^]

did not work in win7, and one of this article's reader confirm this, he introduce to use 'Microsoft.Win32.SystemEvents class'

I try but still fail, and one article name 'Microsoft.Win32.SystemEvents.SessionEnding Does Not Work' url: http://vbcity.com/forums/t/165037.aspx

explain this class don't work in visual studio compiler .

has anyone run into this problem before?

can someone introduce a successful solution of event handling in the context of : win7 64bit,VS2010,C++ win32 console ?

thanks you very much!

Zhishang
Posted

1 solution

I already explained the issue in your previous question at forrtl: error (200): program aborting due to window-CLOSE event[^]. You cannot capture Windows events/messages in a console program.
 
Share this answer
 
Comments
Member 10362802 3-May-14 21:34pm    
Thanks Richard,

There must be some problem in my console project.

Just now I switch the console project to winForm project and the problem was gone...

Thanks you again for the kindly help!

Sincerely,

Zhishang

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900