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. Which message window receives after all when it open?

Which message window receives after all when it open?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 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.
  • V Offline
    V Offline
    vgrigor
    wrote on last edited by
    #1

    I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks

    P H G 3 Replies Last reply
    0
    • V vgrigor

      I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      vgrigor wrote: Creation and Showing window is finished, and window ready to work and working ? I dont think there is a any that kinda message, but there is a workaround for this... If i assume that you are talking about dialog window. You need to do the following steps. 1.Define a custom window

      #define WM_MYMESSAGE WM_USER + 1

      2.Then at the end of the OnInitDialog you post this message

      PostMessage(WM_MYMESSAGE,0,0);

      3. Add a message handler for the message in the message map.

      ...
      ON_MESSAGE(WM_MYMESSAGE,OnMyMessage)
      ...

      4. Implement the function.


      MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.

      1 Reply Last reply
      0
      • V vgrigor

        I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks

        H Offline
        H Offline
        Harold Bamford
        wrote on last edited by
        #3

        I had a similar problem when starting up a program (Acrobat Reader) and wanted to wait until it had finished convulsing before trying to diddle it. I stumbled upon WaitForInputIdle(). Here is a working example of using it:STARTUPINFO startupInfo; PROCESS_INFORMATION processInfo; ::ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); ::ZeroMemory(&processInfo, sizeof(processInfo)); char cmd[MAX_PATH + MAX_PATH + 5]; sprintf(cmd,"\"%s\" \"%s\"", szExe, pdfFile); BOOL startedOK = CreateProcess( NULL, cmd, // Complete command line, including quoting NULL, // Process security NULL, // Thread security FALSE, // Inheritance 0, // no special startup flags NULL, // no special environment NULL, // no default startup directory &startupInfo, &processInfo); // Get hProcess and dwProcessId from this if(!startedOK) { ShowLastError(cmd); return; } // Don't attempt to control the Acrobat Reader until it is ready **WaitForInputIdle(processInfo.hProcess,INFINITE);**
        Of course, this is assuming the windows you're interested in are in another process...

        V 1 Reply Last reply
        0
        • V vgrigor

          I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks

          G Offline
          G Offline
          gUrM33T
          wrote on last edited by
          #4

          i guess PeekMessage can be used for this purpose. Gurmeet S. Kochar


          If you believe in God, it's because of the Devil

          1 Reply Last reply
          0
          • H Harold Bamford

            I had a similar problem when starting up a program (Acrobat Reader) and wanted to wait until it had finished convulsing before trying to diddle it. I stumbled upon WaitForInputIdle(). Here is a working example of using it:STARTUPINFO startupInfo; PROCESS_INFORMATION processInfo; ::ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); ::ZeroMemory(&processInfo, sizeof(processInfo)); char cmd[MAX_PATH + MAX_PATH + 5]; sprintf(cmd,"\"%s\" \"%s\"", szExe, pdfFile); BOOL startedOK = CreateProcess( NULL, cmd, // Complete command line, including quoting NULL, // Process security NULL, // Thread security FALSE, // Inheritance 0, // no special startup flags NULL, // no special environment NULL, // no default startup directory &startupInfo, &processInfo); // Get hProcess and dwProcessId from this if(!startedOK) { ShowLastError(cmd); return; } // Don't attempt to control the Acrobat Reader until it is ready **WaitForInputIdle(processInfo.hProcess,INFINITE);**
            Of course, this is assuming the windows you're interested in are in another process...

            V Offline
            V Offline
            vgrigor
            wrote on last edited by
            #5

            Imagine, if such a mad people will decide how to hang on real people really ? (Biting infinite) average dog is better. Only want to bite once.

            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