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. windows message - when the window was displayed

windows message - when the window was displayed

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 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.
  • D Offline
    D Offline
    daavena
    wrote on last edited by
    #1

    Hello, I am using dialog boxes and I need to capture window message when the window/dialog was displayed I tried WM_SHOWWINDOW but the help says: WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. I can not fint the proper message.Can you give me a hind? Thank you very much.

    S I 2 Replies Last reply
    0
    • D daavena

      Hello, I am using dialog boxes and I need to capture window message when the window/dialog was displayed I tried WM_SHOWWINDOW but the help says: WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. I can not fint the proper message.Can you give me a hind? Thank you very much.

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      daavena wrote:

      displayed

      What do you mean by 'displayed' - created, shown, redrawn?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      D 1 Reply Last reply
      0
      • D daavena

        Hello, I am using dialog boxes and I need to capture window message when the window/dialog was displayed I tried WM_SHOWWINDOW but the help says: WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. I can not fint the proper message.Can you give me a hind? Thank you very much.

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        WM_WINDOWPOSCHANGING? Or you could even could WM_PAINT - that was when the window was actually shown to people! So it depends on what you mean... Iain.

        Codeproject MVP for C++, I can't believe it's for my lounge posts...

        D 1 Reply Last reply
        0
        • S Stuart Dootson

          daavena wrote:

          displayed

          What do you mean by 'displayed' - created, shown, redrawn?

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          D Offline
          D Offline
          daavena
          wrote on last edited by
          #4

          when I click on the button I need: show window/dialog with message "Loading profile it can take several minutes" inside and than when the window is shown(is visible) I need to run the function - but only once.

          S 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            WM_WINDOWPOSCHANGING? Or you could even could WM_PAINT - that was when the window was actually shown to people! So it depends on what you mean... Iain.

            Codeproject MVP for C++, I can't believe it's for my lounge posts...

            D Offline
            D Offline
            daavena
            wrote on last edited by
            #5

            Thanks for reply. I need message when window/dialog has been shown - I need to see the window first and then run my function(only once).

            1 Reply Last reply
            0
            • D daavena

              when I click on the button I need: show window/dialog with message "Loading profile it can take several minutes" inside and than when the window is shown(is visible) I need to run the function - but only once.

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #6

              There's no window message that you only get when the window is shown the first time. Instead, catch WM_SHOWWINDOW. Maintain a flag that tells you if your message has been shown. You can use this flag to tell you whether you should show your message or not - something like:

              void CMyWindow::OnShowWindow(BOOL bShow, UINT nStatus)
              {
              if (bShow && !m_bShownMyMessage)
              {
              // show the message
              m_bShownMyMessage = TRUE;
              }

              // Do other stuff
              }

              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

              D 1 Reply Last reply
              0
              • S Stuart Dootson

                There's no window message that you only get when the window is shown the first time. Instead, catch WM_SHOWWINDOW. Maintain a flag that tells you if your message has been shown. You can use this flag to tell you whether you should show your message or not - something like:

                void CMyWindow::OnShowWindow(BOOL bShow, UINT nStatus)
                {
                if (bShow && !m_bShownMyMessage)
                {
                // show the message
                m_bShownMyMessage = TRUE;
                }

                // Do other stuff
                }

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                D Offline
                D Offline
                daavena
                wrote on last edited by
                #7

                Thaks for reply, WM_SHOWWINDOW WPARAM wParam LPARAM lParam; Parameters wParam Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden. lParam is still 0 when I capture WM_SHOWWINDOW so wParam is always 1 -the window is being shown. My function always runs first. Then I see the window. This function takes a time - 10sec, that is reason why I need to see the window first. WM_SHOWWINDOW message is called only once. I think it is not possible to do that.

                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