2012-01-16  Source: Original Site  Category:Visual C++  Views:0 


I have two applications, one is dialog based and the other is property sheet based.
For both applications, I would like to close the window without terminating the application when the 'X' button is clicked.
I can do this to the dialog based application by overwritting the OnClose(). However I cannot do this to the property sheet based application. I think that is because it sends WM_DESTROY instead of WM_CLOSE when the 'X' button is clicked.
So how to solve this problem on my property sheet? Please help.

Related articles
  • How can I hook the Message WM_CLOSE or WM_DESTROY in Win9x? 2014-12-08

    I use the function SetWindowsHookEx() to hook windows message in Win9x(98 or Me), I want to hook the WM_CLOSE or WM_DESTROY message while the App is closed. But, no matter I use WH_CBT, WH_GETMESSAGE, WH_CALLWNDPROC, and WH_CALLWNDPROCRET, I can't ho

  • CDialog WM_CLOSE or WM_DESTROY? 2012-01-07

    I have a recordset pointer in my dialog that I must clean up when the user closes the dialog. I tried to do this in both the OnClose() and OnDestroy() windows messages but I get an exception for the recordset pointer object which tells me it is alrea

  • Trapping a WM_CLOSE Message in Dialog Based Application 2015-04-25

    My problem is following. I have created a simple dialog based project in VC++. After creating this project the Wizard gives you a dialog box that you can start using. Instead of using this one I have created my own window using CreateEx function and

  • SubClassing - WM_CLOSE 2015-06-03

    Have written formless exe scheduler. Other than an internal error, the application runs similar to a service, that is no forms, dialogs, etc. I need to hook system calls that terminate the application, such as messages sent by TaskManager like WM_CLO

  • Spy++ Message Question 2012-05-02

    I do have a window call back procedure that has the following messages. WM_CLOSE: and WM_DESTROY: I want to know if it is possible to use Spy++ to see the mesages. went to Spy++ to see information about the specify window, but I did not see these two

  • Resizing Window 2012-06-24

    How do I control the size of a window? I curently have the following code but if the user tries to resize I get loads of flickering. Basically I have variables g_XRes & g_YRes and I want the window to be fixed at these Sizes. Also if I was to cha

  • Closing child window 2012-12-11

    I have an application, let's CMyApp. I create a COM object, CChild. In CChild, I create a window with CreateWindowEx. In CMyApp, I can create multiple instances of CChild. At some time, I want to close and destroy the window (CChild) but only one at

  • Catching OnClose message for CDialogBar 2013-01-14

    I'm trying to catch a WM_CLOSE or WM_DESTROY message for a control bar, but something is not right. I have a class MyClass that inherits from CDialogBar. An instance of MyClass is created in a class CMainFrame that inherits from CMDIFrameWnd. The con

  • Sticky dialog 2013-02-24

    I have a dialog with a button, when it is clicked, it will display another dialog that is moved around when the mouse cursor moves. I right-click to pick a "Close" menu item I added in the context menu but this dialog doesn't go away. in the windowpr

  • the 'X' button that closes the application 2013-02-27

    i wrote a dialog based app, i want to override the function that deals with the 'X' close button to place my app in the tray and not destroy the window. i dont know what function handles this??? i tried WM_Close and WM_Destroy and it didn't help.....

  • Multiple dialogs in an MFC app 2013-03-02

    I'm creating a program that logs into a server. When you execute the program the login dialog pops up. If you login successfully what is supposed to happen is that login dialog closes and the lobby dialog pops up. The problem is the lobby dialog pops

  • Closing Property Sheet App from Property Pages 2013-06-22

    XP SP2 VC++ 6.0 My application is a property sheet. My DestroyWindow does cleanup and then passes control on. BOOL CMyPropSht::DestroyWindow() {CleanUp(); return CPropertySheet::DestroyWindow(); } What I can't seem to work out is the right way to clo

  • creating a child to a child in MDI how to? 2013-10-02

    Well, the title says it all: i deal w/ an MDI app and Win32 API. For each child of the app I need to be able to create a single window, which to be a child to the child so to say. The child uses ChildProc() and the child of child in question uses Chi

  • destructors for dialogs 2013-10-19

    I noticed class wizard does not add destructors for dialog classes..is there any special reason that for some weired reason that they are not recommended to use in dialog classes? Do the want us the implement WM_CLOSE or WM_DESTROY messages instead?

  • protecting you window from IM windows and other dangers :P 2013-11-08

    I want the user to choose when they close down my application, so I listen for user input... but these pesky IM windows always interrupt my app and steal focus. I've tried not responding to the following messages.... then I tried what you'll see belo

  • menu problem: what's wrong with this code? 2014-04-04

    I'm trying to write a Win32 program that displays a simple blank window with two menus, labeled "File" (with a "Quit" option) and "Display", which displays different text in specified colors. But when I try to run the program, the menus appear, but w

  • 2d game engine need help :S 2014-09-28

    I know the basics of C++, PHP, JavaScript and VB I've read for C++ from rly old books so some things may have changed. Now I've started reading Advamced-2D-Game-Development by Jonathan S. Harbour. He has given a source code of an 2d game engine using

  • Win32 Dialog Questions 2014-10-24

    Dialog questions - Any of these that you can answer would be appreciated. 1) Is there any way to pass the address of a fxn in a structure as the main dialog procedure to DialogBox or DialogBoxParam? Even trying to use the offset address of the fxn in

  • Creating a Window Problem 2014-11-15

    My code was working fine at first and I added to things on and now it no longer runs :(. I have removed just about everything now and got it down to the following code, this code can simply be put in a cpp file and it should run without any setting c

  • weird loop exit 2015-05-03

    I've been programming for 2 days now, and I ran in a problem now that I can't solve. I've been trying to find a solution for a day now, and I can't find anything. The problem is, that a loop is exited to early, causing the program to terminate. I'll