Click here to Skip to main content
15,892,005 members
Articles / Desktop Programming / MFC

Remote Processes and Machine control of Windows NT based systems (2000/XP)

Rate me:
Please Sign up or sign in to vote.
4.80/5 (35 votes)
1 Apr 2012CPOL5 min read 157.1K   8.9K   103  
Control certain aspects of machines sitting remotely, without having to install and trigger an application on the remote machine.
#ifndef COMMAND_H
#define COMMAND_H

class CRemoteAdminDoc;
class CRemoteAdminView;
class CMachineView;
class CMainFrame;

struct SCommand  // Server machine uses this for ending threads
{
    BOOL m_bThreadExit;  // TRUE == exit thread, FALSE == continue
};

struct SExecuteCommand
{
    TCHAR m_szProcessPath[_MAX_PATH]; // Process to start 
    TCHAR m_szUsername[_MAX_PATH];    // client to log on
    TCHAR m_szDomain[_MAX_PATH];      // domain of client's account
    TCHAR m_szPassword[_MAX_PATH];    // client's password
};


// Since worker threads cannot call the global, GetDocument(), GetMachineView(),
// or GetRemoteAdminView() as windows GUI elments acnnot be accesed from 
// worker threads, it crashes.
// Hence we wrap these values in these structures and pass them to the worker
// threads

//SDocView is passed to the thread function, UpdateprocessListForAllMachines()
struct SDocView
{
    CRemoteAdminDoc*  pDoc;
    CRemoteAdminView* pRemoteAdminView;
    CMachineView*     pMachineView;
};

// SConnectInfo is passed to the thread function, ConnectToMachine()
struct SConnectInfo
{
    CRemoteAdminDoc*  pDoc;
    CRemoteAdminView* pRemoteAdminView;
    CMachineView*     pMachineView;
    CString           strIP;
    CString           strPwd;
};

struct SSysShutDownInfo
{
    BOOL bShutDown;   // TRUE if you want to shutdown,FALSE if want to cancel shutdown
    BOOL bReboot;     // Reboot if TRUE, else HALT if FALSE
    UINT iTimeToShutDown; // Time given to user before shutdown in secs
};


#endif // COMMAND_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions