HomeProjectsServicesContactus
» Guest
  Sign In     Register    
Projects » CSpawn
Developer : Ritey
Date : 2005-03-27 00:00

» Summary :

C++ class for spawning and monitoring applications.

» Catagories :


  • Development Status: Stable
  • Operating System: Windows
  • Development Environment: MSVS.NET

» Latest Project Downloads:

Total Download Count For Project : 323
 
CSpawnspawn.zip
 2005-11-27Source Code2 KbNotes / ChangesMD5:35a63e427f5ba4c8278153593b6dcfe0323 HitsDownload
 

» Project Information :

Class CSpawn

This class will spawn an application and watch for it to close. Also the ability to terminate the app is possible. You can also run the app in eternal mode. Which means that if the app terminates it will be restarted.

It makes use of CreateProcess() to spawn the app and GetExitCodeThread to retrieve the exit code and also uses the process handle to watch for the terminate event.

In eternal mode a thread is created to watch for termination of the app then on termination it is restated.

Methods:

::SetInfo()
Set information about the app you want to run. Such as the file/parameters/working directory and whether you want it to be invisible.

::Run()
This will run the app. And wait till its finished loading. There must not be another process already running. And SetInfo must have beem successfully called.

::CheckExit()
Check for the application exit code. And wait if specified.

::Terminate()
Terminate the spawned application (if still running) and close internal handles and free internal memory allocated when the app was spawed.

::GetFilename()
::GetCmdLine()
::GetWorkingDir()
::GetHandle()
Get various properties of the class.

::IsEternal()
Get whether the app is running in eternal mode.

Sample Usage:
Code:
    CSpawn theapp;
   
    //Set info
    theapp.SetInfo("notepad.exe",0,0,0);

    //spawn the app
    theapp.Run(1,0);

    //wait for exit
    theapp.CheckExit(INFINITE);

    //cleanup
    theapp.Terminate();

This sample will run notepad and wait for it to exit.
0 member(s), 12 guest(s)
| Site Map | Statistics | Terms of Use | Privacy Policy |
Copyright (C) GoCoding.Com 2004-2007
Powered by Seditio
Contacts