Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need to catch Close message in Formview

Need to catch Close message in Formview

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tjkrz
    wrote on last edited by
    #1

    I have a Formview class and I'm trying to display a message box when the user hits the X to close the form. If I do the processing in OnDestroy, the message box doesn't show up until after the form has closed. How can I show this messagebox before the form goes away? I tried to catch a WM_CLOSE or WM_DESTROY message with PreTranslateMessage, but neither seem to work.

    V N 2 Replies Last reply
    0
    • T tjkrz

      I have a Formview class and I'm trying to display a message box when the user hits the X to close the form. If I do the processing in OnDestroy, the message box doesn't show up until after the form has closed. How can I show this messagebox before the form goes away? I tried to catch a WM_CLOSE or WM_DESTROY message with PreTranslateMessage, but neither seem to work.

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      Interesting. Add some breakpoints in OnClose(). What gets called when you exit the program? Kuphryn

      1 Reply Last reply
      0
      • T tjkrz

        I have a Formview class and I'm trying to display a message box when the user hits the X to close the form. If I do the processing in OnDestroy, the message box doesn't show up until after the form has closed. How can I show this messagebox before the form goes away? I tried to catch a WM_CLOSE or WM_DESTROY message with PreTranslateMessage, but neither seem to work.

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        Handle WM_CLOSE in your frame window class and not in your view class as you might probably be doing now. Nish


        Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups