Changes between Version 1 and Version 2 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/Process/GetProcessID


Ignore:
Timestamp:
08/20/10 16:13:12 (14 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/Process/GetProcessID

    v1 v2  
    11= GetProcessID =
     2Get the process ID of the specified name
    23
     4{{{
     5int GetProcessID(const string& strName, pid_t exclude = 0);
     6
     7int GetProcessID(const char* pszName, pid_t exclude = 0);
     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{{{
     25string strProc = "wtsvr";
     26if(GetProcessID(strProc) == 0)
     27{
     28  DisplayText(0, 0, "Weight server is not running");
     29}
     30}}}
     31
     32{{{
     33if(GetProcessID("wtsvr") == 0)
     34{
     35  DisplayText(0, 0, "Weight server is not running");
     36}
     37}}}
     38
     39{{{
     40if(GetProcessID("myapp", getpid()) == 0)
     41{
     42  DisplayText(0, 0, "myapp already running");
     43  exit(0);
     44}
     45}}}
     46The example shows preventing running multiple instances of an application named "myapp".
     47
     48== See Also ==
     49
     50 * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Display/GetProcessIDExcludeSelf GetProcessIDExcludeSelf]
     51 * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Display/KillProcess KillProcess]
     52
     53