Running hidden executables in background

This is a discussion on Running hidden executables in background within the Windows Programming forums, part of the Platform Specific Boards category; How do i program a hidden executable that runs at startup? working on a C Server for my new program. ...

  1. #1
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19

    Running hidden executables in background

    How do i program a hidden executable that runs at startup?

    working on a C Server for my new program. Thanks in advance

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    Hidden from who?
    Why are you trying to hide it (this sounds like malware to me)
    What operating system are you using anyway (this is nothing to do with C, and everything to do with your OS).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19
    lol. u people are so goddang paranoid its funny. it's also none of your business

    but anyways, like i said, i'd like a friggin hidden background server in my new program that hides things on MY computer. it's personal. also, i run off of windows XP (the only one that'd more than likely allow this )

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,163
    No one's going to buy that line of crap. Why would we help you with something that sounds suspicious? And your "it's none of your business" response really helps...

    There's no reason to hide something on your system from yourself, so I'd say our "paranoia" is pretty justified.
    If you understand what you're doing, you're not learning anything.

  5. #5
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19
    good lord. i never thought people never thought of running background programs. i mean really, my instant messenger runs in the background.

    I AM NOT A HACKER.

    i need a background program to run a server for a program to give a list of things to do so they can be done without me havin to run TWO programs at once with my command line.

    it's a big prog that runs off of Java swing gui and i'm havin trouble managing it all in one place. the whole purpose is for me to have my personal IDE, 2D game area, and a small OS. Java's runtime.exec helps with the executables but i'd like to run some in the background as a hidden program that will start up with the computer.

    If you want it, however, i'll give u my currently not finished JAR file that contains my unfinished project. it operates to a certain extent even though davac is the only menu item that does anything. also, if u wish to know, the password to get into it is nydo. but erm.... not .jar extensions.....

    i'll e-mail it to you if u wish or just get a snapshot of it. it's called b4u because it was meant to be used b4u do something on my comp that i didn't want u to (like read an important for me to only see file. it mixes up the file's characters and can reaarange them back so only my b4u program can read it. it can't do this yet, however. plus some other functions required me learning C. like file I/O and cleanup within the JAR file for my IDE)
    Last edited by Fender Bender; 04-16-2005 at 03:45 PM.

  6. #6
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    I always use Linux but in Windows what I would do is put your executable inside of the Start->All Programs->Startup folder. If that's what you want. Perhaps a batch file in the startup folder if you really want to get tricky! If you want to get super tricky you could go Start->Run "regedit" and then go to...ummm

    Local_Machine-->Microsoft-->Windows-->Current Version??->Run

    Add a new key with the path to your executable you want to add to the background. Did I get your question ok? I was skimming pretty fast.

  7. #7
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19
    yes. however when i tried that the command prompt pops up. it also stays up, lol. desirable until i don't want to see the command prompt, which is rather quick...

  8. #8
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    You could create a Win32 app instead and use SW_HIDE to hide the window.

  9. #9
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19
    not too familiar with windowing, so do i put the code in the message loop or the handler? i don't mean the SW_HIDE, though i'd like to know where i need to put that too....
    Last edited by Fender Bender; 04-16-2005 at 09:12 PM.
    pardon the double post. My browser didn't react quickly for DSL and i thought i didn't click the button properly

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    If you don't want a window to be displayed then don't create one, as long as it isn't a console app you will see no window.

  11. #11
    Registered Trademark
    Join Date
    Apr 2005
    Posts
    19
    actually console apps run on cmdLine. meaning the cmdLine has to stay up and, as always has been, visible, which causes a problem.
    pardon the double post. My browser didn't react quickly for DSL and i thought i didn't click the button properly

  12. #12
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    I'm still pretty new, but the idea of creating a pretty blank window then hiding it sounds good.

    if you're not familiar with windowing, read the first few sections of http://winprog.org/tutorial. It's quite simple and that'll teach you the basics of making a window. Unless of course you're not that new to it.

    Then, look for the line, in your WinMain, that looks like this.
    Code:
    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);
    And change it to
    Code:
    ShowWindow(hwnd, SW_HIDE);
    UpdateWindow(hwnd);
    This'll keep the window from ever appearing.

    For your window's procedure, all you'd need is
    Code:
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
     {
      case: WM_DESTROY:
        PostQuitMessage;
      break;
      default: 
        return DefWindowProc(hwnd, Message, wParam, lParam);
     }
    In fact, you might be able to get away with setting DefWindowProc as your window's procdure when registering the class, and not having to write your own at all. I don't really know though, cause I haven't tried it myself.

    Finally, you would basically copy and paste the code from your current program after the UpdateWindow line, before the message loop. Note, however, that you NEED to put the line
    Code:
    DestroyWindow(hwnd);
    somewhere in your code. Otherwise, the program will never terminate, which will cause problems. Also note that by destroying your window, you will immediately end your program.

  13. #13
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by Jaken Veina
    Otherwise, the program will never terminate, which will cause problems.
    You could force the user to use CTRL+ALT+DELETE lol, or perhaps create an application that destroys all running spawns of your program as a faster alternative.

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by Fender Bender
    actually console apps run on cmdLine. meaning the cmdLine has to stay up and, as always has been, visible, which causes a problem.
    Which is why I said no window will be displayed if you don't create a console app. Win32 GUI apps can accept command line arguments as well.
    If you create a Win32 GUI app you can still create a console window at anytime if you want it and destroy it when needed.

  15. #15
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    You could put a shortcut to your program in the Startup folder.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running in the background.
    By samus250 in forum C Programming
    Replies: 6
    Last Post: 06-29-2008, 10:23 AM
  2. Running code in the background
    By random in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2005, 01:04 PM
  3. Running A Routine in the background
    By smegly in forum C Programming
    Replies: 4
    Last Post: 05-16-2004, 06:42 PM
  4. running executables with system("ren ....")
    By Leeman_s in forum C++ Programming
    Replies: 4
    Last Post: 12-17-2002, 10:04 PM
  5. Running program on background?
    By Couhilin in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2001, 06:50 AM

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