|
Revision 5, 0.9 kB
(checked in by qbert, 6 years ago)
|
Initial ( and last :( ) commit
|
| Line | |
|---|
| 1 |
#ifndef EXECUTOR_H |
|---|
| 2 |
#define EXECUTOR_H |
|---|
| 3 |
|
|---|
| 4 |
typedef void (*OnLine )( string); |
|---|
| 5 |
typedef void (*OnFinished )( string ); |
|---|
| 6 |
|
|---|
| 7 |
#define TIMEOUT -2 |
|---|
| 8 |
|
|---|
| 9 |
class Executor { |
|---|
| 10 |
public: |
|---|
| 11 |
Executor(const CString& cmd, const string& _lib = "" ): command(cmd) , waitToComplete(true), onLine(NULL),onFinished(NULL ),lib(_lib) { } |
|---|
| 12 |
Executor(const CString & cmd , OnLine l, OnFinished f , const string& _lib = "") : command(cmd),onLine(l),onFinished(f), waitToComplete(false),lib(_lib) { } |
|---|
| 13 |
|
|---|
| 14 |
unsigned long Run(); |
|---|
| 15 |
string output; |
|---|
| 16 |
|
|---|
| 17 |
protected: |
|---|
| 18 |
CString command; |
|---|
| 19 |
string line; |
|---|
| 20 |
string lib; |
|---|
| 21 |
bool waitToComplete; |
|---|
| 22 |
|
|---|
| 23 |
OnLine onLine; |
|---|
| 24 |
OnFinished onFinished; |
|---|
| 25 |
|
|---|
| 26 |
HANDLE hreadFromChild; |
|---|
| 27 |
static UINT Listener(LPVOID me); |
|---|
| 28 |
void Listener(); |
|---|
| 29 |
UINT Pid; // process ID assigned by caller |
|---|
| 30 |
|
|---|
| 31 |
}; |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
DWORD RunSilent(char* strFunct, char* strstrParams, const string& outputFile = "none"); |
|---|
| 35 |
DWORD RunLoud(char* strFunct, char* strParams); |
|---|
| 36 |
#endif |
|---|