home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
WTJ9403.ZIP
/
WILDASS
/
SOURCE
/
TASKS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-13
|
2KB
|
98 lines
// taks.h
//
// class interface to the classes
// CTask
// CTaskList
// which encapsulates the toolhelps TASKENTRY and other structures
//
// update: 1.00 06-08-93 tw
#ifndef _INC_TASKH
#define _INC_TASKH
#include <toolhelp.h>
class CTask : public CObject
{
private:
TASKENTRY m_te; // an SDK taskentry
CString m_strExePath; // exepath from this tasks moduleentry
// list of all top-level non-owned windows of this task
// -> send them a WM_CLOSE
static BOOL CALLBACK __export EnumTaskWndProcCloseApp( HWND hWnd, LPARAM lParam );
public:
CTask( TASKENTRY * pTE );
// return the taskhandle
HTASK HTask() const;
operator HTASK() const;
// return the instance handle
HINSTANCE HInstance() const;
operator HINSTANCE() const;
// retrieve the module handle
HMODULE HModule() const;
// operator HMODULE() const;
// wont work as HINSTANCE==HMODULE
// retrieve the exes name and the modules name
// associated to this task
const char* ExeName() const;
const char* ModuleName() const;
void DieHard() const; // kill this task (abprupt termination)
void Die() const; // close this task (clean termination)
static BOOL IsTask( CTask * ); // is this a valid task
static BOOL IsTask( HTASK );
BOOL IsTask() const;
#ifdef _DEBUG
void Dump() const;
void AssertValid() const;
#endif
// retrieving details
HTASK HParent() const;
WORD Events() const;
WORD Usage() const;
};
class CTaskList : public CObList
{
public:
CTaskList();
~CTaskList();
// rebuild the list
void Rebuild();
// clear the list
void Clear();
void CloseDirty( CTask * pTask ); // kill this task
void CloseClean( CTask * pTask ); // close this task
// avoid casts in usage
CTask*& GetNext( POSITION& rPos );
CTask* GetNext( POSITION& rPos ) const;
CTask*& GetAt( POSITION pos );
CTask* GetAt( POSITION pos ) const;
// remove a CTask from the list using a pointer to it
void Remove( CTask * );
#ifdef _DEBUG
void Dump() const;
#endif
};
#endif // _INCTASKH