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. how to receive app launch message?

how to receive app launch message?

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

    I switch the default desktop to mine,and i produce taskbar myself.So i want to receive some message when system shell is ready to launch an application and to terminate an application. how can i do? hook? or other?

    J 1 Reply Last reply
    0
    • C chpsoft

      I switch the default desktop to mine,and i produce taskbar myself.So i want to receive some message when system shell is ready to launch an application and to terminate an application. how can i do? hook? or other?

      J Offline
      J Offline
      Joel Lucsy
      wrote on last edited by
      #2

      Typically you'd use SetWindowsHookEx with either the WH_CBT or WH_SHELL setting. -- Joel Lucsy

      C 1 Reply Last reply
      0
      • J Joel Lucsy

        Typically you'd use SetWindowsHookEx with either the WH_CBT or WH_SHELL setting. -- Joel Lucsy

        C Offline
        C Offline
        chpsoft
        wrote on last edited by
        #3

        thank you. But can you give me a demo code?or where can download such demo? thank you again.

        B 1 Reply Last reply
        0
        • C chpsoft

          thank you. But can you give me a demo code?or where can download such demo? thank you again.

          B Offline
          B Offline
          bilal78
          wrote on last edited by
          #4

          Hi! You will use WH_CBT hooks and look for HCBT_CREATEWND nCode on your hook proc. You will find an example for this at http://www.codeproject.com/shell/sweeptheminesweeper.asp?target=minesweeper[^] Regards, Bilal Anjum

          C 1 Reply Last reply
          0
          • B bilal78

            Hi! You will use WH_CBT hooks and look for HCBT_CREATEWND nCode on your hook proc. You will find an example for this at http://www.codeproject.com/shell/sweeptheminesweeper.asp?target=minesweeper[^] Regards, Bilal Anjum

            C Offline
            C Offline
            chpsoft
            wrote on last edited by
            #5

            can you tell me what's the difference of HCBT_CREATEWND and HSHELL_WINDOWCREATED?

            B 1 Reply Last reply
            0
            • C chpsoft

              can you tell me what's the difference of HCBT_CREATEWND and HSHELL_WINDOWCREATED?

              B Offline
              B Offline
              bilal78
              wrote on last edited by
              #6

              HI! Well according to MSDN (If its wrong it's Microsoft to blame :) ) HSHELL_WINDOWCREATED will be called when "A top-level, unowned window has been created. The window exists when the system calls a ShellProc function." and HCBT_CREATEWND will be called when "A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally." Regards, Bilal Anjum

              C 1 Reply Last reply
              0
              • B bilal78

                HI! Well according to MSDN (If its wrong it's Microsoft to blame :) ) HSHELL_WINDOWCREATED will be called when "A top-level, unowned window has been created. The window exists when the system calls a ShellProc function." and HCBT_CREATEWND will be called when "A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally." Regards, Bilal Anjum

                C Offline
                C Offline
                chpsoft
                wrote on last edited by
                #7

                i see!thank you!

                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