Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There are 2 computers in A,B
if A have to know B program opened. What should I do?
Maybe refer by IP Address or Computer name

The single computer as below :

C#
private bool ProgramIsRunning(string FullPath)
    {
        string FilePath =  Path.GetDirectoryName(FullPath);
        string FileName = Path.GetFileNameWithoutExtension(FullPath).ToLower();
        bool isRunning = false;

        Process[] pList = Process.GetProcessesByName(FileName);
        foreach (Process p in pList)
            if(p.MainModule.FileName.StartsWith(FilePath, StringComparison.InvariantCultureIgnoreCase))
                isRunning = true;

        return isRunning;
    }


ProgramIsRunning(@"c:\loc1\test.exe");


What I have tried:

I must control all the computer is program open
Posted
Updated 18-May-16 21:23pm
v2
Comments
Mehdi Gholam 19-May-16 3:23am    
Why?

1 solution

Are you going to spy someone else's PC? :-)
You need a (possibly TCP) server on computer B keen to sending you (i.e. your client program) such a piece of info.
 
Share this answer
 
Comments
patnaree 19-May-16 3:38am    
Would you have any example source code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900