Thread: How to make a program that runs in the process

  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    14

    How to make a program that runs in the process

    hello I'm using visual c++ 6. I would like to ask how can i make a program that runs in the processes. Because I noticed that each time I make a program it is running in the applications. I would like to ask how's it done and if anybody can provide me a link, that would be much of a help. Thank you.
    Flamers are worst than Newbies

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Wait...huh? Did you try compiling the program and not running it from a debugger?

    (That was me taking a wild stab at what Makoy means)

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Maybe you mean running it as a service ?

    Anyway, can you clarify your question ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Any program that is seen in the Applications tab of the task manager is also in the Processes tab.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Thats what I thought you meant. Are you sure its not running in the processes tab? If its not, may I please use your source code.

  6. #6
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Maybe he wants to know how to make a program NOT appear under the applications tab?

  7. #7
    Registered User
    Join Date
    Feb 2004
    Posts
    14
    Maybe he wants to know how to make a program NOT appear under the applications tab?
    Yes I want to make the program that runs as service and invisible in the applications tab. Can you guys teach me how?
    Flamers are worst than Newbies

  8. #8
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    All you need to do is create a windows program that doesn't register a class or create a window and it will not show up in the applications tab of the task manager.

    Code:
    int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR, int) {
    
           while(true) {
    
                     // do something
           }
    
           return 0;
    }
    Now you really should hook into some event such as timer or keyboard input so you don't just go around hogging up CPU usage. This example simply demonstrates the lack of creating a window (well basically the lack of doing anything)

  9. #9
    Registered User
    Join Date
    Feb 2004
    Posts
    14

    Smile

    hello andy. I'm not really familiar with the class register thing. If you can give me a full source code or at least a link for this stuff, I will really appreciate it. Thanks
    Flamers are worst than Newbies

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Oh! Ok. I thought you were saying it was only showing up as an application. And if you are wanting to write a service, I suggest you start off by learning the basics.

  11. #11
    Registered User
    Join Date
    Feb 2004
    Posts
    14
    Oh! Ok. I thought you were saying it was only showing up as an application. And if you are wanting to write a service, I suggest you start off by learning the basics.
    Yeah I did that part already. All I need now is a few codes to make the magic work. If you know any links to share I would really appreciate it. Just few links and tuts to extend my ideas further. Thank you very much!
    Flamers are worst than Newbies

  12. #12
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I don't know any good links, nor was I able to find one, but if you have the platform sdk then you can take a peek at the sample service that they provide in /Samples/winbase/Service directory.

  13. #13
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    All right, basically it is the type of project you are making in VC++. If you make a console app, which I am assuming you have been doing in the past, windows automatically creates a viewpoint for your program and that is what shows up in the applications tab.

    So, create a new VC++ project and select Win32 App as the type. Ensure that you have selected a Windows program, vice console application and check the check box indicating that you want to create an empty project. Click OK to open your project. Add a cpp file to it and call it whatever you like.

    Now to get into the whole windows, vice console thing. Instead of main, you need WinMain. Here is the barebones layout that will do it:

    Code:
    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdline, int iCmdShow) {
    
    //your program here
    
    
    }
    Thats it, that will create a program that doesn't show up in the application tab.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  2. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  3. How do you make a program to interface with another?
    By Finchie_88 in forum C++ Programming
    Replies: 6
    Last Post: 08-24-2007, 03:48 AM
  4. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  5. make a program stay....
    By Nirav in forum C Programming
    Replies: 6
    Last Post: 10-12-2003, 07:01 PM