Running custom code when MFC application terminates: d'tor or WM_CLOSE?

I have an MFC dialog application that needs to stop the Windows Wifi service to work correctly, but I want to turn it on again when my application exits.

So, I thought I would put in code that will restart the service in the destructor of the main dialog class.

Now it occurred to me that others are using their own code, which should be run during program termination in a message handler WM_CLOSE.

Both methods seem to work, but I would like to know if there are any flaws anyway.

+5
source share
2 answers

MFC InitInstance, DoModal. MFC (MDI, SDI) ExitInstance.

SDI/MDI , InitInstance FALSE, - DoModal.

ExitInstance , .

Edit. , WM_DESTROY ( ) , WM_CLOSE. WM_CLOSE , , " ? - ". , , WM_CLOSE WM_DESTROY . , , Windows .

+3

: wifi , . InitInstance, ExitInstance; WM_CREATE - , WM_CLOSE ..

, , / .

InitInstance ExitInstance, Windows, WM_CLOSE, , , , .

+3

All Articles