In need a simple code that will check if proccesname is running, and if it does it terminate the c++ exefile, but if it dont it will continue to the code i want to run, can this be done? please somone help me out only thing i need to complete my project

In need a simple code that will check if proccesname is running, and if it does it terminate the c++ exefile, but if it dont it will continue to the code i want to run, can this be done?

You might state the operating system that you are running.

I'm not a C++ coder, but i did something similar in python using WMI.
Or if you can call the command line from C++ you could use "tasklist", and check if its running.
This is windows only though.

i use windows xp, but i assume it shoud be possible to use one code witch will support windows xp and vista, however i know how to do this with command line that is unsure because it can easy be manipulated by changing the name of the exefile witch i only want to run once but i tought of can you bind a mutex application to the application you do not want to run duplicated, if so i woud like to know something witch might be very simple for your guys but not me...

begin
hide
end.

something like this at c++ so i could test to bind a mutex application to the program i woud like to run, hopefully works if not i guess i got no other choices then searching for process name.

or is there somewhere to search for id`? like taskmgr.exe run on id 3740, notepad 2176, explorer.exe, 1612, so if they do change name id will not change so can you make the code search for that instead of name ?

it will work with a code that stop if found a certain form titlename, not windowname because this utility dont has a windowname (its hided from taskbar)

so if it can search for a form title name and then if that name is there then application will not start, but if it dont find it then it will.

woud this be possible atleast ?

please somone help me i get done with a project as soon as i am done with this.

Yes it is completely possible. First, stop flooding the forum with useless messages. When someone logs in that can answer the question, they will answer. No need to badger us when no one is logged on. Second, use sentences. Don't run all your sentences together. In order for us to understand you, you need to post in an understandable form. This is not a chatroom.

You will need to look through MSDN.com. You can start here

I got very little knowledge with c++, so if you could please just give me a fully source witch works and what to change for it to not run if chosen process is active, preferaly an secured way witch is not like: change name of exe or change folder of it then its totally useless.

I don't think anyone is going to do it for you.

Well atleast can you correct me on this one:
i think its something wrong with findwindow and also is abort the code to abort it from running ?
so if i put this in front of the other main then shoud that do the trick ?

#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;


return 0;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.