receiving notification when user runs a program

This is a discussion on receiving notification when user runs a program within the C++ Programming forums, part of the General Programming Boards category; hi, i am creating a program to respond to other programes run by the user if the user runs "hello.exe", ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    114

    receiving notification when user runs a program

    hi,
    i am creating a program to respond to other programes run by the user

    if the user runs "hello.exe", my program gets notified and perform some action.

    so the basic problem is: how do i get this notification to my program??

    so i am looking for something like

    Code:
    OnProgramRun
    {
    do action ......
    }
    platform : win98se

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    You mean in the same way that a virus scanner gets run whenever anyone tries to run an executable?

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    Quote Originally Posted by Salem
    You mean in the same way that a virus scanner gets run whenever anyone tries to run an executable?
    yup!

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    SetWindowsHookEx is given a "ShellProc".
    HSHELL_WINDOWCREATED is the nCode.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Change the value at the registry key HKEY_CLASSES_ROOT\exefile\shell\open\command\ from ""%1" %*" to "yourprogram.exe "%1" %*". Each time the user runs a program your program will be run with the name of the program as an argument, you need only check the name against a list of program you need notification for.
    Be careful with this: If your program dosen't run the programs it recieves as arguments then you wont be able to open any programs and will likely not be able to open regedit to fix it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 08-23-2008, 07:44 AM
  2. Replies: 2
    Last Post: 07-24-2008, 06:05 AM
  3. Receiving a notification after resuming from sleep state
    By foxman in forum Windows Programming
    Replies: 7
    Last Post: 02-23-2008, 05:41 PM
  4. Program crashing when user orders more than 13 arrays.
    By omnificient in forum C Programming
    Replies: 13
    Last Post: 01-02-2008, 06:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21