Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Programming a "Shocking Surprise" program in C#

Back to Forum: Tech Off
  • User profile image

    Firstly... I recognize the taboo behind joining and immediately posting topics in forums of this caliber however I couldn't find an "Ask newbie questions here" thread and I believe that my question will be easily answered anyway.


    I'm currently in a inrtoductory level C# class and for our main project, I've decided that I want to build a program that when run, stores itself in memory, watches for a specific program to be run, does something (For instance displaying an image or playing a sound clip.), and then removes itself from memory.
    I realize this program needs two main parts: A time based portion where the program checks for the program in question  to be run every second or so as well as a line or three of code telling the program what to do when it finds said file running.

    At first I thought it would be as simple as telling the program: 
    If (Targetprogramrunning == true)

    I now realize that the coding is a bit more difficult than I originally thought, so before I up and give up and change projects I figured that someone here might be able to get me started.


    What I honestly need are ideas as to what events and commands I need to use to:

    a. Run the program and store the image and sound clip information in memory

    b. Watch/Find the target program

    c. The events to use to display the audio/visuals

    d. Wipe the program from memory


    Again, I understand the trivial nature of my question, but would appreciate any code, pseudocode, or tips you guys can give me.


    Thanks so much for taking time to read this! Any input is appreciated! Smiley


  • User profile image

    think processes. look at the systems.diagnostics namespace. think about how you're going to identify the target program and close it.

  • User profile image

    For the sound/video, it might be easiest to use the Windows Media Player COM control. Add a COM reference to Windows Media Player (wmp.dll) and check out what it gives you.

  • User profile image



    you'd basically want a timer (such as System.Threading.Timer) to call System.Diagnostics.Process.GetProcesses()

    that'd give you an array of the programms running.


    then you can use wpf to display whatever, here is an example of doing that. (this blog has examples in vb but the class library is common, only the language syntax is diffrent)

    Good luck freaking out your friends and family Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.