| | 2 | Get the process ID of the specified name exluding the running process |
| | 3 | |
| | 4 | {{{ |
| | 5 | int GetProcessID(const string& strName); |
| | 6 | |
| | 7 | int GetProcessID(const char* pszName); |
| | 8 | }}} |
| | 9 | |
| | 10 | == Parameters == |
| | 11 | |
| | 12 | * strName - string name of process to check |
| | 13 | * pszName - character array name of process to check |
| | 14 | |
| | 15 | == Return Value == |
| | 16 | |
| | 17 | * Returns process ID if a process matches the name is found, 0 if not. |
| | 18 | |
| | 19 | == Remarks == |
| | 20 | |
| | 21 | |
| | 22 | == Examples == |
| | 23 | |
| | 24 | {{{ |
| | 25 | string strProc = "myapp"; |
| | 26 | if(GetProcessIDExcludeSelf(strProc) != 0) |
| | 27 | { |
| | 28 | exit(0); |
| | 29 | } |
| | 30 | }}} |
| | 31 | |
| | 32 | The example code above can be used at the beginning of a program to prevent running multiple instances. |
| | 33 | |
| | 34 | == See Also == |
| | 35 | |
| | 36 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Display/GetProcessID GetProcessID] |
| | 37 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Display/KillProcess KillProcess] |
| | 38 | |
| | 39 | |