Thread: Only run if dont find a process

  1. #16
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    You mention notepad. Can we assume that you are running Windows, then?
    Well he did mention "myprocess.exe" in the first post, and Windows is the only OS I know that cares about file extensions.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    True, I missed that.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    No my project is not to create a maleware, and yes i do not got much knowledge in c++, if i already knew how to do this then i woud not post howto woud i ?

  4. #19
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Firstly, everything you've asked for relies on specific support from the operating system, and are not in the scope of C/C++.

    However, while there are valid reasons that one program may wish to start another without multiple instances (and the techniques to do that have been described), your post asking how to hide a process, or modifying one to do what you want, rang alarm bells. Such things are firmly in the realm of malware. Even operating system services - one of the few types of application that might justifiably be hidden from users - don't do that.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #20
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    Can somone just help me, it shoud not take several days or what ?

  6. #21
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    You have received help. Elysia in post 10 has pointed you to the EnumWindows() and Mike_ in post 12 has pointed you to the FindWindow() function. Those address the requirement of finding a window, which you need. Read the documentation for them for a description of their use.

    As to other aspects, which are things only malware will do, you will not get an answer here.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  7. #22
    Registered User
    Join Date
    Mar 2010
    Posts
    9

    This did work

    bind mutex app into the exe works for it to only run once, but then the command to open script get confused so need another method.

    However on the microsoft sample are you supose to change anything in there i get error messages when i try to compile it.


    bind mutex app into the exe works for it to only run once, but then the command to open script get confused so need another method.

    However on the microsoft sample are you supose to change anything in there i get error messages when i try to compile it.

    Here is my failure attempt to add it in the code:

    #define _WIN32_WINNT 0x0500
    #include <windows.h>
    #include <iostream>
    #include <stdlib.h>
    int main() {
    HWND btr, script;


    HWND hWnd = GetConsoleWindow();

    btr = FindWindow(NULL, "window name");
    if(FindWindow(NULL, "window name") then
    abort;



    while(FindWindow(NULL, "Window name")) {
    Sleep(2);
    }

    return 0;
    }



    i think the find window command is wrong also, is abort really the command witch will break the code if what so ever statement is true ?
    Last edited by tom1; 03-09-2010 at 06:23 AM.

  8. #23
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    Quote Originally Posted by rags_to_riches View Post
    This post:

    seems suspicious to me. Someone looking at process level stuff with what appears to be no knowledge -- and providing no code -- added with that post, makes me uneasy.
    I figured in c++ then
    begin
    end.

    is equal to this
    Code:
    int main() {
    
    }
    i want to learn, im no black hat programmer.



    In this forum you are supose to ask for help if there is something you are wondering of am i right? because thats exactly what i did, nothing to be suspecious about.
    Last edited by tom1; 03-09-2010 at 02:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. Killing A Process
    By tommyb05 in forum C Programming
    Replies: 8
    Last Post: 06-01-2009, 06:41 AM
  3. find the process id
    By nevali in forum C Programming
    Replies: 3
    Last Post: 10-02-2007, 08:33 AM
  4. Round Robin Scheduling using c.
    By eclipt in forum C Programming
    Replies: 8
    Last Post: 12-28-2005, 04:58 PM
  5. Process sending file descriptors to another process
    By Yasir_Malik in forum C Programming
    Replies: 4
    Last Post: 04-07-2005, 07:36 PM